You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2019 Coop IT Easy SCRLfs
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import api, fields, models, _
  5. class ResCompany(models.Model):
  6. _inherit = 'res.company'
  7. display_info_session_confirmation = fields.Boolean(
  8. help="Choose to display a info session checkbox on the cooperator"
  9. " website form."
  10. )
  11. info_session_confirmation_required = fields.Boolean(
  12. string="Is info session confirmation required?"
  13. )
  14. info_session_confirmation_text = fields.Html(
  15. translate=True,
  16. help="Text to display aside the checkbox to confirm"
  17. " participation to an info session."
  18. )
  19. @api.onchange('info_session_confirmation_required')
  20. def onchange_info_session_confirmatio_required(self):
  21. if self.info_session_confirmation_required:
  22. self.display_info_session_confirmation = True
  23. _sql_constraints = [(
  24. 'info_session_approval_constraint',
  25. """CHECK ((info_session_confirmation_required=FALSE
  26. AND display_info_session_confirmation=FALSE)
  27. OR display_info_session_confirmation=TRUE)
  28. """,
  29. "Approval can't be mandatory and not displayed."
  30. )]