diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index 2f6bdabd..2a0c149e 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -45,7 +45,10 @@ class AccountTax(models.Model): def compute_balance(self, tax_or_base='tax'): self.ensure_one() move_lines = self.get_move_lines_domain(tax_or_base=tax_or_base) - total = sum([l.balance for l in move_lines]) + # balance is debit - credit whereas on tax return you want to see what + # vat has to be paid so: + # VAT on sales (credit) - VAT on purchases (debit). + total = -sum([l.balance for l in move_lines]) return total def get_balance_domain(self, state_list): diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index edefd417..db2d6a37 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -46,5 +46,5 @@ class TestAccountTaxBalance(TransactionCase): # change the state of invoice to open by clicking Validate button invoice.signal_workflow('invoice_open') - self.assertEquals(tax.base_balance, -100) - self.assertEquals(tax.balance, -10) + self.assertEquals(tax.base_balance, 100) + self.assertEquals(tax.balance, 10)