changeset 6e8bc133e2fb in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset;node=6e8bc133e2fb
description:
Add test for update chart with inactive account
issue9473
review307941002
diffstat:
tests/test_account.py | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r c6b5ef51242b -r 6e8bc133e2fb tests/test_account.py
--- a/tests/test_account.py Fri Jul 24 09:55:35 2020 +0200
+++ b/tests/test_account.py Fri Jul 24 09:56:22 2020 +0200
@@ -1542,6 +1542,34 @@
for record in Model.search([]):
self.assertNotEqual(record.name, new_name)
+ @with_transaction()
+ def test_update_inactive(self):
+ "Test update chart of accounts with inactive account"
+ pool = Pool()
+ Account = pool.get('account.account')
+ UpdateChart = pool.get('account.update_chart', type='wizard')
+
+ company = create_company()
+ with set_company(company):
+ create_chart(company, tax=True)
+ root, = Account.search([('parent', '=', None)])
+
+ cash, = Account.search([('name', '=', 'Main Cash')])
+ cash.template_override = True
+ cash.end_date = datetime.date.min
+ cash.save()
+ self.assertFalse(cash.active)
+
+ session_id, _, _ = UpdateChart.create()
+ update_chart = UpdateChart(session_id)
+ update_chart.start.account = root
+ update_chart.transition_update()
+
+ with Transaction().set_context(active_test=False):
+ self.assertEqual(
+ Account.search([('name', '=', 'Main Cash')], count=True),
+ 1)
+
def suite():
suite = trytond.tests.test_tryton.suite()