From b3be95860bfde99a9bfa7c8e11735ea565e918e4 Mon Sep 17 00:00:00 2001 From: "Nasreddin Boulif (bon)" Date: Wed, 1 Feb 2023 22:03:14 +0000 Subject: [PATCH] [FIX] event_[booth_]sale: don't allow event product on quotation template Current behavior: In a sale order: a wizard pops up to complete the link with the event and attendee when we add an event product (same issue with event booth). In quotation template: the wizard doesn't pop up when we add an event as optional product. When we create a sales order with the quotation template, the event is added as product but the wizard still does not pop up, and therefore, the SO is not linked to the event. After this commit: Don't allow adding event (or event booth) as optional product to a quotation template. A same fix was already done on products (not optional) here: https://github.com/odoo/odoo/pull/100499 opw-3081853 closes odoo/odoo#113730 X-original-commit: a6bc38598f695ead9d9816b6858823b28b4ba95d Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: Nasreddin Boulif (bon) --- addons/event_booth_sale/models/__init__.py | 1 + .../event_booth_sale/models/sale_order_template_option.py | 6 ++++++ addons/event_sale/models/__init__.py | 1 + addons/event_sale/models/sale_order_template_option.py | 6 ++++++ 4 files changed, 14 insertions(+) create mode 100644 addons/event_booth_sale/models/sale_order_template_option.py create mode 100644 addons/event_sale/models/sale_order_template_option.py diff --git a/addons/event_booth_sale/models/__init__.py b/addons/event_booth_sale/models/__init__.py index ea5a057c6dd..d27b2530fc5 100644 --- a/addons/event_booth_sale/models/__init__.py +++ b/addons/event_booth_sale/models/__init__.py @@ -10,3 +10,4 @@ from . import event_type_booth from . import sale_order from . import sale_order_line from . import sale_order_template_line +from . import sale_order_template_option diff --git a/addons/event_booth_sale/models/sale_order_template_option.py b/addons/event_booth_sale/models/sale_order_template_option.py new file mode 100644 index 00000000000..19c3ed6b7d8 --- /dev/null +++ b/addons/event_booth_sale/models/sale_order_template_option.py @@ -0,0 +1,6 @@ +from odoo import fields, models + +class SaleOrderTemplateOption(models.Model): + _inherit = "sale.order.template.option" + + product_id = fields.Many2one(domain="[('sale_ok', '=', True), ('detailed_type', 'not in', ['event', 'event_booth']), ('company_id', 'in', [company_id, False])]") diff --git a/addons/event_sale/models/__init__.py b/addons/event_sale/models/__init__.py index 0a87ba308f1..8c4b3b034bb 100644 --- a/addons/event_sale/models/__init__.py +++ b/addons/event_sale/models/__init__.py @@ -8,3 +8,4 @@ from . import product from . import sale_order from . import sale_order_line from . import sale_order_template_line +from . import sale_order_template_option diff --git a/addons/event_sale/models/sale_order_template_option.py b/addons/event_sale/models/sale_order_template_option.py new file mode 100644 index 00000000000..8d8ed43f7fa --- /dev/null +++ b/addons/event_sale/models/sale_order_template_option.py @@ -0,0 +1,6 @@ +from odoo import fields, models + +class SaleOrderTemplateOption(models.Model): + _inherit = "sale.order.template.option" + + product_id = fields.Many2one(domain="[('sale_ok', '=', True), ('detailed_type', '!=', 'event'), ('company_id', 'in', [company_id, False])]")