summaryrefslogtreecommitdiff
path: root/addons/account/tests/account_test_classes.py
diff options
context:
space:
mode:
authorqdp-odoo <qdp@odoo.com>2016-09-22 10:39:49 +0200
committerqdp-odoo <qdp@odoo.com>2016-09-22 10:57:11 +0200
commit22c9747e2ddfad05bdab6d61df4eefc267c1280b (patch)
treee2b81ab9224f310ef8ffc4d4bc293563eeb511d4 /addons/account/tests/account_test_classes.py
parent4bddd00813a2134840adc08688eb16d0e96a17e4 (diff)
[FIX] stock_landed_costs: fixed test case to work also in case of non anglo saxon accounting. Also changed TestLandedCosts to extend AccountingTestCase
Diffstat (limited to 'addons/account/tests/account_test_classes.py')
-rw-r--r--addons/account/tests/account_test_classes.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/account/tests/account_test_classes.py b/addons/account/tests/account_test_classes.py
index 76f8cd54013..cf37e2493ef 100644
--- a/addons/account/tests/account_test_classes.py
+++ b/addons/account/tests/account_test_classes.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from odoo.tests.common import HttpCase
+from odoo.exceptions import ValidationError
class AccountingTestCase(HttpCase):
""" This class extends the base TransactionCase, in order to test the
@@ -16,3 +17,14 @@ class AccountingTestCase(HttpCase):
domain = [('company_id', '=', self.env.ref('base.main_company').id)]
if not self.env['account.account'].search_count(domain):
self.skipTest("No Chart of account found")
+
+ def check_complete_move(self, move, theorical_lines):
+ for aml in move.line_ids:
+ line = (aml.name, round(aml.debit, 2), round(aml.credit, 2))
+ if line in theorical_lines:
+ theorical_lines.remove(line)
+ else:
+ raise ValidationError('Unexpected journal item. (label: %s, debit: %s, credit: %s)' % (aml.name, round(aml.debit, 2), round(aml.credit, 2)))
+ if theorical_lines:
+ raise ValidationError('Remaining theorical line (not found). %s)' % ([(aml[0], aml[1], aml[2]) for aml in theorical_lines]))
+ return True