From 349aeb62203f5e20144f511e1080fe6b0bc4d298 Mon Sep 17 00:00:00 2001 From: ricardoMC Date: Fri, 19 Sep 2025 19:03:43 -0400 Subject: [PATCH] [IMP] account_payment_order: add smart button to access related payments This commit adds a smart button in the payment order form view to access the related payments easily. It also provides an action to display those payments and a counter field. This improvement facilitates navigation and batch payment creation directly from the payment order. --- .../models/account_payment_order.py | 13 +++++++++++++ .../views/account_payment_order.xml | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py index 9d1475e1659..197ae5bb22c 100644 --- a/account_payment_order/models/account_payment_order.py +++ b/account_payment_order/models/account_payment_order.py @@ -451,3 +451,16 @@ def action_move_journal_line(self): ctx.update({"search_default_misc_filter": 0}) action["context"] = ctx return action + + def action_view_payments(self): + self.ensure_one() + action = self.env["ir.actions.actions"]._for_xml_id( + "account.action_account_payments" + ) + action.update( + { + "domain": [("payment_order_id", "=", self.id)], + "context": {"default_payment_order_id": self.id}, + } + ) + return action diff --git a/account_payment_order/views/account_payment_order.xml b/account_payment_order/views/account_payment_order.xml index d8e440e5942..438bc803abe 100644 --- a/account_payment_order/views/account_payment_order.xml +++ b/account_payment_order/views/account_payment_order.xml @@ -72,6 +72,18 @@ widget="statinfo" /> +