changeset ca99496a5c94 in modules/product_kit:default
details: 
https://hg.tryton.org/modules/product_kit?cmd=changeset&node=ca99496a5c94
description:
        Add domain to cost_price_method depending of type

        issue9720
diffstat:

 CHANGELOG  |  2 ++
 product.py |  6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r cc901557ccde -r ca99496a5c94 CHANGELOG
--- a/CHANGELOG Sun Jul 04 17:54:47 2021 +0200
+++ b/CHANGELOG Sun Jul 11 11:26:46 2021 +0200
@@ -1,2 +1,4 @@
+* Allow only fixed cost price as method for kit
+
 Version 6.0.0 - 2021-05-03
 * Initial release
diff -r cc901557ccde -r ca99496a5c94 product.py
--- a/product.py        Sun Jul 04 17:54:47 2021 +0200
+++ b/product.py        Sun Jul 11 11:26:46 2021 +0200
@@ -21,6 +21,12 @@
         super().__setup__()
         cls.type.selection.append(('kit', "Kit"))
 
+    @classmethod
+    def _cost_price_method_domain_per_type(cls):
+        types_cost_method = super()._cost_price_method_domain_per_type()
+        types_cost_method['kit'] = [('cost_price_method', '=', 'fixed')]
+        return types_cost_method
+
     @fields.depends('type', 'cost_price_method')
     def on_change_type(self):
         super().on_change_type()

Reply via email to