[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
This commit is contained in:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user