Skip to content

Commit

Permalink
[FIX] precompute _compute_selected_debt
Browse files Browse the repository at this point in the history
  • Loading branch information
maq-adhoc committed Apr 22, 2024
1 parent 4572aa1 commit 2090230
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions account_payment_pro/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ 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,
)
matched_move_line_ids = fields.Many2many(
'account.move.line',
Expand Down Expand Up @@ -399,7 +399,7 @@ def _compute_payment_difference(self):
for rec in self:
rec.payment_difference = rec._get_payment_difference()

@api.depends('to_pay_move_line_ids.amount_residual')
@api.depends('to_pay_move_line_ids', 'to_pay_move_line_ids.amount_residual')
def _compute_selected_debt(self):
for rec in self:
# factor = 1
Expand All @@ -425,11 +425,13 @@ 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:
rec.add_all()
if rec.partner_id != rec._origin.partner_id or rec.partner_type != rec._origin.partner_type or \
rec.company_id != rec._origin.company_id:
rec.add_all()

def _get_to_pay_move_lines_domain(self):
self.ensure_one()
Expand Down

0 comments on commit 2090230

Please sign in to comment.