From 2b296fa0c0f734cc56229d462dc426401c6bea10 Mon Sep 17 00:00:00 2001 From: "Daniel Kosky (dako)" Date: Tue, 9 Jan 2024 10:08:41 +0000 Subject: [PATCH] [FIX] l10n_ke_edi_tremol: fix reference to prepare_edi_tax_details A recent commit (03466c2) introduced a change that allowed for users to place multiple taxes on a line (provided only one of them was a VAT tax) when sending invoices to the device. This made use of the _prepare_edi_tax_details method, which is only available from the account_edi module. This fix adapts the function to make use of the _pepare_invoice_aggregated_taxes method (available from) the account move model instead. The references to the keys in the returned tax details dictionary have also be corrected (since the structure of the dictionary between from version 16 onwards). closes odoo/odoo#148901 X-original-commit: 4fddcc8fdb0a82938be665c81232268ae59ed37e Signed-off-by: Josse Colpaert Signed-off-by: Daniel Kosky (dako) --- addons/l10n_ke_edi_tremol/models/account_move.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_ke_edi_tremol/models/account_move.py b/addons/l10n_ke_edi_tremol/models/account_move.py index 376aab3327a..0d65b08b115 100644 --- a/addons/l10n_ke_edi_tremol/models/account_move.py +++ b/addons/l10n_ke_edi_tremol/models/account_move.py @@ -164,15 +164,15 @@ class AccountMove(models.Model): break msgs = [] - tax_details = self._prepare_edi_tax_details() + tax_details = self._prepare_invoice_aggregated_taxes() for line in self.invoice_line_ids.filtered(lambda l: l.display_type == 'product' and l.quantity and l.price_total > 0 and not discount_dict.get(l.id) >= 100): # Here we use the original discount of the line, since it the distributed discount has not been applied in the price_total price_total = 0 percentage = 0 item_code = line.tax_ids[0].l10n_ke_item_code_id - for tax in tax_details['invoice_line_tax_details'][line]['tax_details']: + 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['invoice_line_tax_details'][line]['tax_details'][tax] + 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']) percentage = tax['tax'].amount price = round(price_total / abs(line.quantity) * 100 / (100 - line.discount), 2) * currency_rate