Skip to content

Commit

Permalink
[FIX] l10n_ar_account_tax_settlement: proper compute monto retenido/perc
Browse files Browse the repository at this point in the history
  • Loading branch information
zaoral authored and jjscarafia committed Jun 7, 2021
1 parent 76c1506 commit 4b0eb48
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions 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

Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4b0eb48

Please sign in to comment.