From 1fb070c211c9647a9c616259e241c2d9e2f0a2bc Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Thu, 16 Mar 2017 21:45:02 +0100 Subject: [PATCH] [FIX] Include tax amounts from all move types --- account_tax_balance/__manifest__.py | 2 +- account_tax_balance/models/account_tax.py | 2 +- .../tests/test_account_tax_balance.py | 32 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/account_tax_balance/__manifest__.py b/account_tax_balance/__manifest__.py index 8fb7dc8b..18e5790a 100644 --- a/account_tax_balance/__manifest__.py +++ b/account_tax_balance/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Tax Balance", "summary": "Compute tax balances based on date range", - "version": "10.0.1.0.0", + "version": "10.0.1.0.1", "category": "Accounting & Finance", "website": "https://www.agilebg.com/", "author": "Agile Business Group, Therp BV, Tecnativa, " diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index a6596899..5c79daa4 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -91,7 +91,7 @@ class AccountTax(models.Model): if move_type == 'refund': return ['receivable_refund', 'payable_refund'] elif move_type == 'regular': - return ['receivable', 'payable'] + return ['receivable', 'payable', 'liquidity', 'other'] return [] def get_target_state_list(self, target_move="posted"): diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index a6c8c035..ed3e3237 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -3,6 +3,7 @@ # © 2016 Giovanni Capalbo # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from openerp.fields import Date from openerp.tests.common import TransactionCase from datetime import datetime from dateutil.rrule import MONTHLY @@ -143,3 +144,34 @@ class TestAccountTaxBalance(TransactionCase): self.assertEquals(tax.balance_regular, 10.) self.assertEquals(tax.base_balance_refund, -25.) self.assertEquals(tax.balance_refund, -2.5) + + # Taxes on liquidity type moves are included + liquidity_account_id = self.env['account.account'].search( + [('internal_type', '=', 'liquidity')], limit=1).id + self.env['account.move'].create({ + 'date': Date.context_today(self.env.user), + 'journal_id': self.env['account.journal'].search( + [('type', '=', 'bank')], limit=1).id, + 'name': 'Test move', + 'line_ids': [(0, 0, { + 'account_id': liquidity_account_id, + 'debit': 110, + 'credit': 0, + 'name': 'Bank Fees', + }), (0, 0, { + 'account_id': invoice_line_account_id, + 'debit': 0, + 'credit': 100, + 'name': 'Bank Fees', + 'tax_ids': [(4, tax.id)] + }), (0, 0, { + 'account_id': tax.account_id.id, + 'debit': 0, + 'credit': 10, + 'name': 'Bank Fees', + 'tax_line_id': tax.id, + })], + }).post() + tax.refresh() + self.assertEquals(tax.base_balance, 175.) + self.assertEquals(tax.balance, 17.5)