[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) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2022-09-21 02:25:56 +02:00
parent f6e553438f
commit 71b62dd148
2 changed files with 12 additions and 2 deletions
@@ -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
@@ -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'])