From a5fffa3f6861dd313e661b6ee75b72f7f09e72c0 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 22 Oct 2018 11:33:36 +0200 Subject: [PATCH] Update tax code lines when updating chart from template Also don't compare value with it's template when computing values to update issue7795 review51561002 --- tax.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tax.py b/tax.py index e067a75951..e090bb768c 100644 --- a/tax.py +++ b/tax.py @@ -299,7 +299,7 @@ class TaxCodeLineTemplate(ModelSQL, ModelView): def _get_tax_code_line_value(self, line=None): value = {} - for name in ['code', 'operator', 'amount', 'type']: + for name in ['operator', 'amount', 'type']: if not line or getattr(line, name) != getattr(self, name): value[name] = getattr(self, name) if not line or line.template != self: @@ -411,8 +411,10 @@ class TaxCodeLine(ModelSQL, ModelView): value['tax'] = template2tax.get(template.tax.id) if value: values.append([line]) - values.append(values) + values.append(value) template2tax_code_line[line.template.id] = line.id + if values: + cls.write(*values) class OpenChartTaxCodeStart(ModelView):