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
This commit is contained in:
Sergi Almacellas Abellana committed 2018-10-22 11:33:36 +02:00
1 parent 09a50cade9
commit a5fffa3f68
1 file changed
+4 -2
+4 -2
View File
@@ -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):