Fill template2xxx only if record has a template

This was introduced by changeset 532fd5a46527

issue5453
review25001002
This commit is contained in:
Cédric Krier committed 2016-04-02 16:00:05 +02:00
1 parent 18fb4ef92b
commit 48fb51567f
3 files changed
+14 -5

No files matched your search

+2 -2
View File
@@ -288,7 +288,7 @@ class Type(ModelSQL, ModelView):
if vals:
values.append([child])
values.append(vals)
template2type[child.template.id] = child.id
template2type[child.template.id] = child.id
childs = sum((c.childs for c in childs), ())
if values:
self.write(*values)
@@ -897,7 +897,7 @@ class Account(ModelSQL, ModelView):
if vals:
values.append([child])
values.append(vals)
template2account[child.template.id] = child.id
template2account[child.template.id] = child.id
childs = sum((c.childs for c in childs), ())
if values:
self.write(*values)
+3 -3
View File
@@ -270,7 +270,7 @@ class TaxCode(ModelSQL, ModelView):
if vals:
values.append([child])
values.append(vals)
template2tax_code[child.template.id] = child.id
template2tax_code[child.template.id] = child.id
childs = sum((c.childs for c in childs), ())
if values:
cls.write(*values)
@@ -1004,7 +1004,7 @@ class Tax(ModelSQL, ModelView):
if vals:
values.append([child])
values.append(vals)
template2tax[child.template.id] = child.id
template2tax[child.template.id] = child.id
childs = sum((c.childs for c in childs), ())
if values:
cls.write(*values)
@@ -1548,7 +1548,7 @@ class TaxRuleLine(ModelSQL, ModelView, MatchMixin):
if vals:
values.append([line])
values.append(vals)
template2rule_line[line.template.id] = line.id
template2rule_line[line.template.id] = line.id
if values:
cls.write(*values)
+9
View File
@@ -103,6 +103,7 @@ class AccountTestCase(ModuleTestCase):
'Test creation and update of minimal chart of accounts'
pool = Pool()
Account = pool.get('account.account')
Tax = pool.get('account.tax')
UpdateChart = pool.get('account.update_chart', type='wizard')
company = create_company()
@@ -110,6 +111,14 @@ class AccountTestCase(ModuleTestCase):
create_chart(company, tax=True)
root, = Account.search([('parent', '=', None)])
# Create an account and tax without template
cash, = Account.search([('name', '=', 'Main Cash')])
Account.copy([cash.id])
tax, = Tax.search([])
Tax.copy([tax.id])
session_id, _, _ = UpdateChart.create()
update_chart = UpdateChart(session_id)
update_chart.start.account = root