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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. # Copyright 2019 Coop IT Easy SCRLfs
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, fields, models
  4. class ResCompany(models.Model):
  5. _inherit = "res.company"
  6. display_info_session_confirmation = fields.Boolean(
  7. help="Choose to display a info session checkbox on the cooperator"
  8. " website form."
  9. )
  10. info_session_confirmation_required = fields.Boolean(
  11. string="Is info session confirmation required?"
  12. )
  13. info_session_confirmation_text = fields.Html(
  14. translate=True,
  15. help="Text to display aside the checkbox to confirm"
  16. " participation to an info session.",
  17. )
  18. @api.onchange("info_session_confirmation_required")
  19. def onchange_info_session_confirmatio_required(self):
  20. if self.info_session_confirmation_required:
  21. self.display_info_session_confirmation = True
  22. _sql_constraints = [
  23. (
  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. )
  31. ]