Skip to content

Commit

Permalink
[FIX] l10n_ke_edi_tremol: Multiline invoice taxes
Browse files Browse the repository at this point in the history
Before this commit:
In the case of an invoice with multiple product lines and a line has a tax amount in (16, 8, 0), a KeyError is raised while generating the message for the device.

After this commit:
The message for the device can be generated.

closes odoo#149778

X-original-commit: 00d9d3c
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
  • Loading branch information
thco-odoo committed Jan 18, 2024
1 parent a7837d3 commit 9efafb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/l10n_ke_edi_tremol/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def is_candidate(discount_line, other_line):
item_code = line.tax_ids[0].l10n_ke_item_code_id
for tax in tax_details['tax_details_per_record'][line]['tax_details']:
if tax['tax'].amount in (16, 8, 0): # This should only occur once
tax_details = tax_details['tax_details_per_record'][line]['tax_details'][tax]
price_total = abs(tax_details['base_amount_currency']) + abs(tax_details['tax_amount_currency'])
line_tax_details = tax_details['tax_details_per_record'][line]['tax_details'][tax]
price_total = abs(line_tax_details['base_amount_currency']) + abs(line_tax_details['tax_amount_currency'])
percentage = tax['tax'].amount
price = round(price_total / abs(line.quantity) * 100 / (100 - line.discount), 2) * currency_rate
uom = line.product_uom_id and line.product_uom_id.name or ''
Expand Down

0 comments on commit 9efafb1

Please sign in to comment.