From 42f6c04ac3167657fd3eb100d6c05dace0e7661e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Thu, 28 Mar 2024 23:36:47 +0100 Subject: [PATCH] product_supplierinfo_group: do not break native view, keep field editable, some other module can use it --- .../models/product_supplierinfo.py | 22 ++++++++++++++----- .../models/product_supplierinfo_group.py | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/product_supplierinfo_group/models/product_supplierinfo.py b/product_supplierinfo_group/models/product_supplierinfo.py index 0d106503acf..cf5aadfc987 100644 --- a/product_supplierinfo_group/models/product_supplierinfo.py +++ b/product_supplierinfo_group/models/product_supplierinfo.py @@ -27,12 +27,22 @@ class ProductSupplierinfo(models.Model): ondelete="cascade", ) company_id = fields.Many2one(related="group_id.company_id", store=True) - product_tmpl_id = fields.Many2one(related="group_id.product_tmpl_id", store=True) - name = fields.Many2one(related="group_id.partner_id", store=True, required=False) - product_id = fields.Many2one(related="group_id.product_id", store=True) - product_name = fields.Char(related="group_id.product_name", store=True) - product_code = fields.Char(related="group_id.product_code", store=True) - sequence = fields.Integer(related="group_id.sequence", store=True) + product_tmpl_id = fields.Many2one( + related="group_id.product_tmpl_id", store=True, readonly=False + ) + name = fields.Many2one( + related="group_id.partner_id", store=True, required=False, readonly=False + ) + product_id = fields.Many2one( + related="group_id.product_id", store=True, readonly=False + ) + product_name = fields.Char( + related="group_id.product_name", store=True, readonly=False + ) + product_code = fields.Char( + related="group_id.product_code", store=True, readonly=False + ) + sequence = fields.Integer(related="group_id.sequence", store=True, readonly=False) _sql_constraints = [ ( diff --git a/product_supplierinfo_group/models/product_supplierinfo_group.py b/product_supplierinfo_group/models/product_supplierinfo_group.py index d93f9d431fe..eb1ae0336b5 100644 --- a/product_supplierinfo_group/models/product_supplierinfo_group.py +++ b/product_supplierinfo_group/models/product_supplierinfo_group.py @@ -65,7 +65,7 @@ def _compute_has_variants(self): for rec in self: rec.has_multiple_variants = len(rec.product_tmpl_id.product_variant_ids) > 1 - @api.depends("supplierinfo_ids") + @api.depends("supplierinfo_ids.min_qty", "supplierinfo_ids.price") def _compute_unit_price_note(self): for rec in self: if len(rec.supplierinfo_ids) == 0: