Skip to content

Commit

Permalink
product_supplierinfo_group: do not break native view, keep field edit…
Browse files Browse the repository at this point in the history
…able, some other module can use it
  • Loading branch information
sebastienbeau committed Jun 13, 2024
1 parent 45a13ca commit 42f6c04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions product_supplierinfo_group/models/product_supplierinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 42f6c04

Please sign in to comment.