[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 <jco@odoo.com> Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user