Skip to content

Commit

Permalink
[FIX] Not use _origin in _compute_selected_debt
Browse files Browse the repository at this point in the history
  • Loading branch information
maq-adhoc committed Apr 20, 2024
1 parent 4572aa1 commit 641ce66
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions account_payment_pro/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class AccountPayment(models.Model):
help='This lines are the ones the user has selected to be paid.',
copy=False,
readonly=False,
check_company=True
check_company=True,
precompute=True,
)
matched_move_line_ids = fields.Many2many(
'account.move.line',
Expand Down Expand Up @@ -403,7 +404,8 @@ def _compute_payment_difference(self):
def _compute_selected_debt(self):
for rec in self:
# factor = 1
rec.selected_debt = sum(rec.to_pay_move_line_ids._origin.mapped('amount_residual')) * (-1.0 if rec.partner_type == 'supplier' else 1.0)
# rec.selected_debt = sum(rec.to_pay_move_line_ids._origin.mapped('amount_residual')) * (-1.0 if rec.partner_type == 'supplier' else 1.0)
rec.selected_debt = sum(rec.to_pay_move_line_ids.mapped('amount_residual')) * (-1.0 if rec.partner_type == 'supplier' else 1.0)
# TODO error en la creacion de un payment desde el menu?
# if rec.payment_type == 'outbound' and rec.partner_type == 'customer' or \
# rec.payment_type == 'inbound' and rec.partner_type == 'supplier':
Expand All @@ -425,7 +427,7 @@ def _inverse_to_pay_amount(self):
def _compute_to_pay_move_lines(self):
# TODO deberiamos ver que se recomputen solo si la deuda que esta seleccionada NO es de este
# partner, compania o partner_type
# # if payment group is being created from a payment we dont want to compute to_pay_move_lines
# # if payment group is being created from a payment we dont want to compute to_pay_move_lines
# if self._context.get('created_automatically'):
# return
for rec in self:
Expand Down

0 comments on commit 641ce66

Please sign in to comment.