From eb12190e3bc9c8b75afe8d0d6fd76ef7a634e72f Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Tue, 28 Nov 2023 13:09:06 +0100 Subject: [PATCH] Not create prices when has not attributes #161709 --- configurator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configurator.py b/configurator.py index ab9c9fd..4c24f88 100644 --- a/configurator.py +++ b/configurator.py @@ -1335,6 +1335,7 @@ class Design(Workflow, ModelSQL, ModelView): Function = Pool().get('configurator.property') functions = Function.search([('type', '=', 'function'), ('parent', 'child_of', [self.template.id]) ]) + res = {} for attribute in self.attributes: parent = attribute.property.get_parent() @@ -1348,8 +1349,9 @@ class Design(Workflow, ModelSQL, ModelView): for function_ in functions: parent = function_.get_parent() - res[parent][function_] = function_.evaluate(function_.quantity, - res[parent], self) + if res.get(parent): + res[parent][function_] = function_.evaluate(function_.quantity, + res[parent], self) return res def create_object(self, object): @@ -1415,8 +1417,12 @@ class Design(Workflow, ModelSQL, ModelView): design.quoted_by = User(Transaction().user).employee design.product_codes = '' values = design.as_dict() + if not values: + continue + with Transaction().set_context(context): res = design.template.create_prices(design, values) + design.custom_operations(res) suppliers = dict((x.category, x.supplier) for x in design.suppliers)