Skip to content

Commit 5eedb1c

Browse files
jjscarafiacav-adhoc
authored andcommitted
[FIX] account_payment_pro: exchange_diff_move_ids computation for main payments
Also remove unnecessary dependency on move_id.line_ids Es el standard que venimos hablando para campos donde no es necesario que actualicen en UI y estos depends pueden traer efectos colaterales de performance closes #1015 Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
1 parent 35f6265 commit 5eedb1c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

account_payment_pro/models/account_payment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ def _compute_matched_move_line_ids(self):
773773

774774
(self - stored_payments).matched_move_line_ids = False
775775

776-
@api.depends("move_id.line_ids")
777776
def _compute_exchange_diff_move_ids(self):
778777
"""Recolecta todos los asientos de diferencia de cambio vinculados a este pago
779778
via account.partial.reconcile.exchange_move_id.
@@ -797,11 +796,14 @@ def _compute_exchange_diff_move_ids(self):
797796
def action_open_exchange_diff_moves(self):
798797
"""Abre los asientos de diferencia de cambio relacionados con este pago."""
799798
self.ensure_one()
799+
list_view_id = self.env.ref("account.view_move_tree").id
800+
form_view_id = self.env.ref("account.view_move_form").id
800801
return {
801802
"type": "ir.actions.act_window",
802803
"name": _("Exchange Differences"),
803804
"res_model": "account.move",
804805
"view_mode": "list,form",
806+
"views": [(list_view_id, "list"), (form_view_id, "form")],
805807
"domain": [("id", "in", self.exchange_diff_move_ids.ids)],
806808
}
807809

l10n_ar_payment_bundle/models/account_payment.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,11 @@ def _compute_matched_move_line_ids(self):
380380
for rec in self.filtered("is_main_payment"):
381381
rec.matched_move_line_ids |= rec.link_payment_ids.mapped("matched_move_line_ids")
382382

383+
def _compute_exchange_diff_move_ids(self):
384+
super()._compute_exchange_diff_move_ids()
385+
for rec in self.filtered("is_main_payment"):
386+
rec.exchange_diff_move_ids |= rec.link_payment_ids.mapped("exchange_diff_move_ids")
387+
rec.exchange_diff_move_count = len(rec.exchange_diff_move_ids)
388+
383389
def _get_mached_payment(self):
384390
return super()._get_mached_payment() + self.link_payment_ids.ids

0 commit comments

Comments
 (0)