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
26 lines
894 B
from odoo import api, fields, models, _
|
|
|
|
|
|
class EventQuestion(models.Model):
|
|
_inherit = "event.question"
|
|
|
|
add_products = fields.Boolean(
|
|
string="Add extra products on answers",
|
|
help="Checking this box allows",
|
|
)
|
|
qty_by_attendees = fields.Boolean(
|
|
string="Multiply quantity by attendees count",
|
|
help="For the questions asked only once per registration.\n"
|
|
"If checked, Odoo will add the extra product for each attendee.\n"
|
|
"Otherwise, Odoo will add the extra product only once.",
|
|
)
|
|
|
|
@api.onchange("question_type")
|
|
def onchange_qtype(self):
|
|
if self.question_type != "simple_choice" and self.add_product:
|
|
self.add_product = False
|
|
|
|
@api.onchange("once_per_order")
|
|
def onchange_qtype(self):
|
|
if not self.once_per_order and self.qty_by_attendees:
|
|
self.qty_by_attendees = False
|