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

[16.0][FIX] account_financial_report: take multiple account tags per tax into account #1267

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
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
4 changes: 0 additions & 4 deletions account_financial_report/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ you can set default interval configuration per company in:
Known issues / Roadmap
======================

* 'VAT Report' is valid only for cases where it's met that for each
Tax defined: all the "Account tags" of all the
'Repartition for Invoices' or 'Repartition for Credit Notes'
are different.
* It would be nice to have in reports a column indicating the
state of the entries when the option "All Entries" is selected
in "Target Moves" field in a wizard
Expand Down
4 changes: 0 additions & 4 deletions account_financial_report/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
* 'VAT Report' is valid only for cases where it's met that for each
Tax defined: all the "Account tags" of all the
'Repartition for Invoices' or 'Repartition for Credit Notes'
are different.
* It would be nice to have in reports a column indicating the
state of the entries when the option "All Entries" is selected
in "Target Moves" field in a wizard
8 changes: 5 additions & 3 deletions account_financial_report/report/vat_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def _get_vat_report_data(self, company_id, date_from, date_to, only_posted_moves
"net": 0.0,
"tax": tax_move_line["balance"],
"tax_line_id": tax_move_line["tax_line_id"][0],
"tax_tag_ids": tax_move_line["tax_tag_ids"],
}
)
for taxed_move_line in taxed_move_lines:
Expand All @@ -89,6 +90,7 @@ def _get_vat_report_data(self, company_id, date_from, date_to, only_posted_moves
"net": taxed_move_line["balance"],
"tax": 0.0,
"tax_line_id": tax_id,
"tax_tag_ids": taxed_move_line["tax_tag_ids"],
}
)
tax_ids = list(map(operator.itemgetter("tax_line_id"), vat_data))
Expand Down Expand Up @@ -161,12 +163,11 @@ def _get_vat_report_tag_data(self, vat_report_data, tax_data, tax_detail):
vat_report = {}
for tax_move_line in vat_report_data:
tax_id = tax_move_line["tax_line_id"]
tags_ids = tax_data[tax_id]["tags_ids"]
if tax_data[tax_id]["amount_type"] == "group":
continue
else:
if tags_ids:
for tag_id in tags_ids:
if tax_move_line["tax_tag_ids"]:
for tag_id in tax_move_line["tax_tag_ids"]:
if tag_id not in vat_report.keys():
vat_report[tag_id] = {}
vat_report[tag_id]["net"] = 0.0
Expand Down Expand Up @@ -240,4 +241,5 @@ def _get_ml_fields_vat_report(self):
"balance",
"tax_line_id",
"tax_ids",
"tax_tag_ids",
]
10 changes: 5 additions & 5 deletions account_financial_report/tests/test_vat_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ def test_01_compute(self):
tax_10_net, tax_10_tax = self._get_tax_line(self.tax_10.name, vat_report)
tax_20_net, tax_20_tax = self._get_tax_line(self.tax_20.name, vat_report)

self.assertEqual(tag_01_net, -100)
self.assertEqual(tag_01_net, 0)
self.assertEqual(tag_01_tax, -10)
self.assertEqual(tag_02_net, -350)
self.assertEqual(tag_02_net, 0)
self.assertEqual(tag_02_tax, -60)
self.assertEqual(tag_03_net, -250)
self.assertEqual(tag_03_net, 0)
self.assertEqual(tag_03_tax, -50)
self.assertEqual(tax_10_net, -100)
self.assertEqual(tax_10_net, 0)
self.assertEqual(tax_10_tax, -10)
self.assertEqual(tax_20_net, -250)
self.assertEqual(tax_20_net, 0)
self.assertEqual(tax_20_tax, -50)

# Check report based on taxgroups
Expand Down
Loading