Skip to content

Commit

Permalink
[FIX] Include tax amounts from all move types
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanRijnhart authored and pedrobaeza committed Mar 18, 2017
1 parent 3fb75c9 commit 098523b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion account_tax_balance/__openerp__.py
Expand Up @@ -5,7 +5,7 @@
{
"name": "Tax Balance",
"summary": "Compute tax balances based on date range",
"version": "9.0.1.0.0",
"version": "9.0.1.0.1",
"category": "Accounting & Finance",
"website": "https://www.agilebg.com/",
"author": "Agile Business Group, Therp BV, Tecnativa, "
Expand Down
2 changes: 1 addition & 1 deletion account_tax_balance/models/account_tax.py
Expand Up @@ -91,7 +91,7 @@ def get_target_type_list(self, move_type=None):
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"):
Expand Down
32 changes: 32 additions & 0 deletions account_tax_balance/tests/test_account_tax_balance.py
Expand Up @@ -3,6 +3,7 @@
# © 2016 Giovanni Capalbo <giovanni@therp.nl>
# 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
Expand Down Expand Up @@ -143,3 +144,34 @@ def test_tax_balance(self):
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)

0 comments on commit 098523b

Please sign in to comment.