From 71b62dd1485d1350bb52d086e79121b36bb65869 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 20 Sep 2022 16:20:07 +0000 Subject: [PATCH] [IMP] sale_product_matrix: add related field to reduce rpc calls The matrix configurators makes a rpc call to know if the edited line is configurable through matrix or standard configurator. This rpc can be avoided (and the logic simplified while converting the widget to owl) with a related field on the lines. closes odoo/odoo#100613 Signed-off-by: Victor Feyens (vfe) --- addons/sale_product_matrix/models/__init__.py | 5 +++-- addons/sale_product_matrix/models/sale_order_line.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 addons/sale_product_matrix/models/sale_order_line.py diff --git a/addons/sale_product_matrix/models/__init__.py b/addons/sale_product_matrix/models/__init__.py index f2d32ff9c24..330596cf5ad 100644 --- a/addons/sale_product_matrix/models/__init__.py +++ b/addons/sale_product_matrix/models/__init__.py @@ -1,4 +1,5 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import sale_order + from . import product_template +from . import sale_order +from . import sale_order_line diff --git a/addons/sale_product_matrix/models/sale_order_line.py b/addons/sale_product_matrix/models/sale_order_line.py new file mode 100644 index 00000000000..accfb4b6b4a --- /dev/null +++ b/addons/sale_product_matrix/models/sale_order_line.py @@ -0,0 +1,9 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + product_add_mode = fields.Selection(related='product_template_id.product_add_mode', depends=['product_template_id'])