From 6c3f0380d2334eca08528efc17e7b202f9c09cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Sat, 24 Sep 2022 20:17:24 +0200 Subject: [PATCH] [IMP]pms: list_price product property dependent with default value --- pms/models/product_template.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pms/models/product_template.py b/pms/models/product_template.py index b6b12f41c..a47fbfb54 100644 --- a/pms/models/product_template.py +++ b/pms/models/product_template.py @@ -108,3 +108,20 @@ class ProductTemplate(models.Model): self.env["ir.pms.property"].set_field_value( pms_property_id, self._name, "list_price", record.id, record.list_price ) + # Set default value in other properties + other_properties = self.env["pms.property"].search([]) + for other_property in other_properties.ids: + if not self.env["ir.pms.property"].get_field_value( + other_property, + self._name, + "list_price", + record.id, + type(record.list_price), + ): + self.env["ir.pms.property"].set_field_value( + other_property, + self._name, + "list_price", + record.id, + record.list_price, + )