Browse Source

[FIX] Include tax amounts from all move types

pull/736/head
Stefan Rijnhart 8 years ago
committed by Francisco Ivan Anton Prieto
parent
commit
f56f1ca3bc
  1. 2
      account_tax_balance/__manifest__.py
  2. 2
      account_tax_balance/models/account_tax.py
  3. 32
      account_tax_balance/tests/test_account_tax_balance.py

2
account_tax_balance/__manifest__.py

@ -5,7 +5,7 @@
{ {
"name": "Tax Balance", "name": "Tax Balance",
"summary": "Compute tax balances based on date range", "summary": "Compute tax balances based on date range",
"version": "10.0.1.0.0",
"version": "10.0.1.0.1",
"category": "Accounting & Finance", "category": "Accounting & Finance",
"website": "https://www.agilebg.com/", "website": "https://www.agilebg.com/",
"author": "Agile Business Group, Therp BV, Tecnativa, " "author": "Agile Business Group, Therp BV, Tecnativa, "

2
account_tax_balance/models/account_tax.py

@ -91,7 +91,7 @@ class AccountTax(models.Model):
if move_type == 'refund': if move_type == 'refund':
return ['receivable_refund', 'payable_refund'] return ['receivable_refund', 'payable_refund']
elif move_type == 'regular': elif move_type == 'regular':
return ['receivable', 'payable']
return ['receivable', 'payable', 'liquidity', 'other']
return [] return []
def get_target_state_list(self, target_move="posted"): def get_target_state_list(self, target_move="posted"):

32
account_tax_balance/tests/test_account_tax_balance.py

@ -3,6 +3,7 @@
# © 2016 Giovanni Capalbo <giovanni@therp.nl> # © 2016 Giovanni Capalbo <giovanni@therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.fields import Date
from openerp.tests.common import TransactionCase from openerp.tests.common import TransactionCase
from datetime import datetime from datetime import datetime
from dateutil.rrule import MONTHLY from dateutil.rrule import MONTHLY
@ -143,3 +144,34 @@ class TestAccountTaxBalance(TransactionCase):
self.assertEquals(tax.balance_regular, 10.) self.assertEquals(tax.balance_regular, 10.)
self.assertEquals(tax.base_balance_refund, -25.) self.assertEquals(tax.base_balance_refund, -25.)
self.assertEquals(tax.balance_refund, -2.5) 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)
Loading…
Cancel
Save