Odoo modules related to events management
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.

26 lines
894 B

  1. from odoo import api, fields, models, _
  2. class EventQuestion(models.Model):
  3. _inherit = "event.question"
  4. add_products = fields.Boolean(
  5. string="Add extra products on answers",
  6. help="Checking this box allows",
  7. )
  8. qty_by_attendees = fields.Boolean(
  9. string="Multiply quantity by attendees count",
  10. help="For the questions asked only once per registration.\n"
  11. "If checked, Odoo will add the extra product for each attendee.\n"
  12. "Otherwise, Odoo will add the extra product only once.",
  13. )
  14. @api.onchange("question_type")
  15. def onchange_qtype(self):
  16. if self.question_type != "simple_choice" and self.add_product:
  17. self.add_product = False
  18. @api.onchange("once_per_order")
  19. def onchange_qtype(self):
  20. if not self.once_per_order and self.qty_by_attendees:
  21. self.qty_by_attendees = False