From 4b0eb48851214df4826b2f039f845f346b031435 Mon Sep 17 00:00:00 2001 From: Katherine Zaoral Date: Mon, 7 Jun 2021 05:56:05 -0300 Subject: [PATCH] [FIX] l10n_ar_account_tax_settlement: proper compute monto retenido/perc --- .../models/account_journal.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/l10n_ar_account_tax_settlement/models/account_journal.py b/l10n_ar_account_tax_settlement/models/account_journal.py index 07246acb..a0fadcea 100644 --- a/l10n_ar_account_tax_settlement/models/account_journal.py +++ b/l10n_ar_account_tax_settlement/models/account_journal.py @@ -1,10 +1,8 @@ from odoo import models, fields, api, _ from odoo.exceptions import ValidationError # from odoo.tools.misc import formatLang -from datetime import datetime # from odoo.tools import DEFAULT_SERVER_DATE_FORMAT import re -import math # from odoo.exceptions import ValidationError @@ -25,11 +23,6 @@ def format_amount(amount, padding=15, decimals=2, sep=""): return res -def round_half_up(n, decimals=0): - multiplier = 10 ** decimals - return math.floor(n*multiplier + 0.5) / multiplier - - def get_line_tax_base(move_line): return sum(move_line.move_id.line_ids.filtered( lambda x: move_line.tax_line_id in x.tax_ids).mapped( @@ -870,8 +863,7 @@ def iibb_aplicado_sircar_files_values(self, move_lines): alicuot_line.alicuota_retencion, 6, 2, '.')) # 9 Monto retenido - # TODO this need to be changed when we properly compute the retentions amounts and use line.balance again - content.append(format_amount(round_half_up(payment.withholdable_base_amount * (alicuot_line.alicuota_retencion / 100.0), 2), 12, 2, '.')) + content.append(format_amount(-line.balance, 12, 2, '.')) # 10 Tipo de Régimen de Percepción # (código correspondiente según tabla definida por la jurisdicción) @@ -964,8 +956,7 @@ def iibb_aplicado_sircar_files_values(self, move_lines): alicuot_line.alicuota_percepcion, 6, 2, '.')) # 9 Monto percibido - # TODO this need to be changed when we properly compute the perception amounts and use line.balance again - content.append(format_amount(round_half_up(-get_line_tax_base(line) * (alicuot_line.alicuota_percepcion / 100.0), 2), 12, 2, '.')) + content.append(format_amount(-line.balance, 12, 2, '.')) # 10 Tipo de Régimen de Percepción # (código correspondiente según tabla definida por la jurisdicción)