From b74fe1f217ff0fa14f69032cead60da1927f24ea Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Wed, 7 Aug 2024 14:43:57 -0500 Subject: [PATCH] [IMP] account_statement_base: Show action to create Statements Before this commit, when a user clicked the "New Transaction" button, an error was raised. After this commit, statement lines are displayed to create new records. --- account_statement_base/__init__.py | 1 + account_statement_base/models/__init__.py | 1 + .../models/account_journal_dashboard.py | 16 ++++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 account_statement_base/models/__init__.py create mode 100644 account_statement_base/models/account_journal_dashboard.py diff --git a/account_statement_base/__init__.py b/account_statement_base/__init__.py index e69de29b..0650744f 100644 --- a/account_statement_base/__init__.py +++ b/account_statement_base/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_statement_base/models/__init__.py b/account_statement_base/models/__init__.py new file mode 100644 index 00000000..3fb26d48 --- /dev/null +++ b/account_statement_base/models/__init__.py @@ -0,0 +1 @@ +from . import account_journal_dashboard diff --git a/account_statement_base/models/account_journal_dashboard.py b/account_statement_base/models/account_journal_dashboard.py new file mode 100644 index 00000000..d6661090 --- /dev/null +++ b/account_statement_base/models/account_journal_dashboard.py @@ -0,0 +1,16 @@ +from odoo import models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + def create_cash_statement(self): + # Totally override this action for avoiding the standard + # message saying that you need to install the enterprise + # module. We do the equivalent thing instead. + self.ensure_one() + action = self.env["ir.actions.actions"]._for_xml_id( + "account_statement_base.account_bank_statement_line_action" + ) + action["context"] = {"search_default_journal_id": self.id} + return action