Skip to content

Commit

Permalink
[IMP] Soporte para retenciones en pagos con 0
Browse files Browse the repository at this point in the history
  • Loading branch information
maq-adhoc committed Mar 5, 2024
1 parent d138dd3 commit e99c943
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions l10n_ar_withholding_ux/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def _get_trigger_fields_to_synchronize(self):
def _prepare_move_line_default_vals(self, write_off_line_vals=None):
res = super()._prepare_move_line_default_vals(write_off_line_vals)
res += self._prepare_witholding_write_off_vals()

wth_amount = sum(self.l10n_ar_withholding_line_ids.mapped('amount'))
# TODO: EVALUAR
# si cambio el valor de la cuenta de liquides quitando las retenciones el campo amount representa el monto que cancelo de la deuda
Expand All @@ -118,10 +119,10 @@ def _prepare_move_line_default_vals(self, write_off_line_vals=None):
account_id = self.env['account.account'].browse(line['account_id'])
# if line['account_id'] in liquidity_accounts:
if account_id.account_type in valid_account_types:
if line['credit']:
if self.payment_type == 'inbound':
line['credit'] += wth_amount
line['amount_currency'] -= wth_amount
elif line['debit']:
elif self.payment_type == 'outbound':
line['debit'] += wth_amount
line['amount_currency'] += wth_amount
return res
Expand Down

0 comments on commit e99c943

Please sign in to comment.