Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0] FIX VAT registries and VAT statement when invoices with negative lines #452

Merged
merged 1 commit into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion l10n_it_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
'name': 'Italian Localization - Account',
'version': '10.0.1.1.1',
'version': '10.0.1.1.2',
'category': 'Hidden',
'author': "Agile Business Group,Abstract,Odoo Community Association (OCA)",
'website': 'http://www.odoo-italia.net',
Expand Down
19 changes: 14 additions & 5 deletions l10n_it_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ def _compute_totals_tax(self, data):
'from_date': data['from_date'],
'to_date': data['to_date'],
}
registry_type = data.get('registry_type', 'customer')
if data.get('journal_ids'):
context['vat_registry_journal_ids'] = data['journal_ids']

tax = self.env['account.tax'].with_context(context).browse(self.id)
tax_name = tax._get_tax_name()
if not tax.children_tax_ids:
base_balance = tax.base_balance
balance = tax.balance
if registry_type == 'supplier':
base_balance = -base_balance
balance = -balance
return (
tax_name, abs(tax.base_balance), abs(tax.balance),
abs(tax.balance), 0
tax_name, base_balance, balance, balance, 0
)
else:
base_balance = tax.base_balance
Expand All @@ -69,7 +74,7 @@ def _compute_totals_tax(self, data):
):
# Prendo la parte di competenza di ogni registro e lo
# sommo sempre
child_balance = abs(child_balance)
child_balance = child_balance

elif child.cee_type:
continue
Expand All @@ -79,7 +84,11 @@ def _compute_totals_tax(self, data):
deductible += child_balance
else:
undeductible += child_balance
if registry_type == 'supplier':
base_balance = -base_balance
tax_balance = -tax_balance
deductible = -deductible
undeductible = -undeductible
return (
tax_name, abs(base_balance), abs(tax_balance), abs(deductible),
abs(undeductible)
tax_name, base_balance, tax_balance, deductible, undeductible
)