__init__.py 722 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. from . import controllers
  3. from . import models
  4. from . import wizard
  5. from odoo import api, SUPERUSER_ID
  6. def post_init_hook(env):
  7. """
  8. Hook to whitelist attachment_ids for helpdesk.ticket in website forms.
  9. This runs after module installation/update.
  10. """
  11. # Use SQL to bypass "Properties of base fields cannot be altered" ORM check
  12. env.cr.execute("""
  13. UPDATE ir_model_fields
  14. SET website_form_blacklisted = false
  15. WHERE model = 'helpdesk.ticket' AND name = 'attachment_ids'
  16. """)
  17. # Verify if it was updated (optional, but good for debugging)
  18. # env.cr.commit() # Not strictly needed as post_init_hook runs in transaction? Odoo handles commit.