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.

25 lines
851 B

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