From a3c79144100a25f1f4d1b3238cbb9f6bf52a02a3 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 25 Nov 2024 17:09:18 +0100 Subject: [PATCH] [IMP] account_reconcile_oca: reconcile lines from statement UX: override the statement lines button action so we can reconcile directly from the statement itself. TT51834 --- .../models/account_bank_statement.py | 15 +++++++++++++++ .../views/account_bank_statement.xml | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/account_reconcile_oca/models/account_bank_statement.py b/account_reconcile_oca/models/account_bank_statement.py index 19b9bec166..8ad1c39428 100644 --- a/account_reconcile_oca/models/account_bank_statement.py +++ b/account_reconcile_oca/models/account_bank_statement.py @@ -1,6 +1,7 @@ # Copyright 2024 Dixmit # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import models +from odoo.tools.safe_eval import safe_eval class AccountBankStatement(models.Model): @@ -13,3 +14,17 @@ def action_open_statement(self): ) action["res_id"] = self.id return action + + def action_open_statement_lines(self): + """Open in reconciling view directly""" + self.ensure_one() + if not self: + return {} + action = self.env["ir.actions.act_window"]._for_xml_id( + "account_reconcile_oca.action_bank_statement_line_reconcile" + ) + action["domain"] = [("statement_id", "=", self.id)] + action["context"] = safe_eval( + action["context"], locals_dict={"active_id": self._context.get("active_id")} + ) + return action diff --git a/account_reconcile_oca/views/account_bank_statement.xml b/account_reconcile_oca/views/account_bank_statement.xml index c3e1e0d064..615ed9bd48 100644 --- a/account_reconcile_oca/views/account_bank_statement.xml +++ b/account_reconcile_oca/views/account_bank_statement.xml @@ -31,7 +31,22 @@ - + + account.bank.statement + + + + object + action_open_statement_lines + + + Edit Bank Statement account.bank.statement