Browse Source

FIX

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).
pull/190/head
eLBati 8 years ago
parent
commit
a6c1489ce6
  1. 5
      account_tax_balance/models/account_tax.py
  2. 4
      account_tax_balance/tests/test_account_tax_balance.py

5
account_tax_balance/models/account_tax.py

@ -45,7 +45,10 @@ class AccountTax(models.Model):
def compute_balance(self, tax_or_base='tax'): def compute_balance(self, tax_or_base='tax'):
self.ensure_one() self.ensure_one()
move_lines = self.get_move_lines_domain(tax_or_base=tax_or_base) 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 return total
def get_balance_domain(self, state_list): def get_balance_domain(self, state_list):

4
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 # change the state of invoice to open by clicking Validate button
invoice.signal_workflow('invoice_open') 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)
Loading…
Cancel
Save