From 88ae41db5cfe3174eb9e8d588b9dfd0ce09db195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmoda=E2=80=9D?= Date: Thu, 12 Oct 2023 09:37:41 +0200 Subject: [PATCH] [IMP] sale: adapt override of ProductAttributeCustomValue in sale The problem is that a mandatory field from the sale module has been added to the ProductAttributeCustomValue template, but in point of sale we also use this model without necessarily filling this field. Previously, the sale module was the only module to use the ProductAttributeCustomValue model (product.attribute.custom.value). In the override, a field set to mandatory has been added "sale_order_line_id", a relationship between the sale.order.line model and product.attribute.custom.value. We now remove the mandatory parameter from this field so that we can create new data without getting an error indicating that a mandatory field is missing. This has no impact on the operation of the Sale module as this field will be populated anyway, since the only way to create a record of this type is via a sale_order_line or a pos_order_line. Part-of: odoo/odoo#138013 --- addons/sale/models/product_product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/product_product.py b/addons/sale/models/product_product.py index 77ba4fa433f..afcb9a57a14 100644 --- a/addons/sale/models/product_product.py +++ b/addons/sale/models/product_product.py @@ -99,7 +99,7 @@ class ProductProduct(models.Model): class ProductAttributeCustomValue(models.Model): _inherit = "product.attribute.custom.value" - sale_order_line_id = fields.Many2one('sale.order.line', string="Sales Order Line", required=True, ondelete='cascade') + sale_order_line_id = fields.Many2one('sale.order.line', string="Sales Order Line", ondelete='cascade') _sql_constraints = [ ('sol_custom_value_unique', 'unique(custom_product_template_attribute_value_id, sale_order_line_id)', "Only one Custom Value is allowed per Attribute Value per Sales Order Line.")