Skip to content

Commit

Permalink
[FIX] l10n_do_accounting: consider 1.8 and 1.6 ITBIS tax amounts (#1067
Browse files Browse the repository at this point in the history
…) (#1068)
  • Loading branch information
jose-pcg authored Jun 19, 2023
1 parent fbe8ba7 commit 39cd3c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion l10n_do_accounting/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"category": "Localization",
"license": "LGPL-3",
"website": "https://github.com/odoo-dominicana",
"version": "14.0.2.17.4",
"version": "14.0.2.17.5",
# any module necessary for this one to work correctly
"depends": ["l10n_latam_invoice_document", "l10n_do"],
# always loaded
Expand Down
21 changes: 17 additions & 4 deletions l10n_do_accounting/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,29 +238,42 @@ def _get_l10n_do_amounts(self):
in line.tax_ids.mapped("tax_group_id")
)

itbis_tax_amount_map = {
"18": (18, 1.8),
"16": (16, 1.6),
}

result = {
"base_amount": sum(taxed_lines.mapped("price_subtotal")),
"exempt_amount": sum(exempt_lines.mapped("price_subtotal")),
"itbis_18_tax_amount": sum(
self.currency_id.round(line.price_subtotal)
for line in itbis_tax_lines.filtered(
lambda tl: tl.tax_line_id.amount == 18
lambda tl: tl.tax_line_id.amount in itbis_tax_amount_map["18"]
)
),
"itbis_18_base_amount": sum(
itbis_taxed_lines.filtered(
lambda line: any(tax for tax in line.tax_ids if tax.amount == 18)
lambda line: any(
tax
for tax in line.tax_ids
if tax.amount in itbis_tax_amount_map["18"]
)
).mapped("price_subtotal")
),
"itbis_16_tax_amount": sum(
self.currency_id.round(line.price_subtotal)
for line in itbis_tax_lines.filtered(
lambda tl: tl.tax_line_id.amount == 16
lambda tl: tl.tax_line_id.amount in itbis_tax_amount_map["16"]
)
),
"itbis_16_base_amount": sum(
itbis_taxed_lines.filtered(
lambda line: any(tax for tax in line.tax_ids if tax.amount == 16)
lambda line: any(
tax
for tax in line.tax_ids
if tax.amount in itbis_tax_amount_map["16"]
)
).mapped("price_subtotal")
),
"itbis_0_tax_amount": 0, # not supported
Expand Down

0 comments on commit 39cd3c2

Please sign in to comment.