From 64b1d4b7108a95ff30ffaaa59b86276add8e7f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 10 Dec 2024 16:33:39 +0100 Subject: [PATCH 1/3] [IMP] account_reconcile_oca: Add auto-reconcile compatibility (Example: Rule to match invoices/bills) TT52146 [FIX] account_reconcile_oca: Fix test related to match_text_location fields Related to https://github.com/odoo/odoo/commit/8948b314073f258121a0f34c1848181181fd52b5 TT52146 --- .../models/account_bank_statement_line.py | 12 +++++++++++- .../tests/test_bank_account_reconcile.py | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/account_reconcile_oca/models/account_bank_statement_line.py b/account_reconcile_oca/models/account_bank_statement_line.py index 621d6ca8..304e5819 100644 --- a/account_reconcile_oca/models/account_bank_statement_line.py +++ b/account_reconcile_oca/models/account_bank_statement_line.py @@ -532,7 +532,14 @@ class AccountBankStatementLine(models.Model): res = ( self.env["account.reconcile.model"] .search( - [("rule_type", "in", ["invoice_matching", "writeoff_suggestion"])] + [ + ( + "rule_type", + "in", + ["invoice_matching", "writeoff_suggestion"], + ), + ("company_id", "=", self.company_id.id), + ] ) ._apply_rules(self, self._retrieve_partner()) ) @@ -555,6 +562,8 @@ class AccountBankStatementLine(models.Model): ) amount -= sum(line.get("amount") for line in line_data) data += line_data + if res.get("auto_reconcile"): + self.reconcile_bank_line() return self._recompute_suspense_line( data, reconcile_auxiliary_id, @@ -750,6 +759,7 @@ class AccountBankStatementLine(models.Model): models = self.env["account.reconcile.model"].search( [ ("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]), + ("company_id", "in", result.company_id.ids), ("auto_reconcile", "=", True), ] ) diff --git a/account_reconcile_oca/tests/test_bank_account_reconcile.py b/account_reconcile_oca/tests/test_bank_account_reconcile.py index 5ab7dd64..accbb332 100644 --- a/account_reconcile_oca/tests/test_bank_account_reconcile.py +++ b/account_reconcile_oca/tests/test_bank_account_reconcile.py @@ -17,6 +17,16 @@ class TestReconciliationWidget(TestAccountReconciliationCommon): def setUpClass(cls, chart_template_ref=None): super().setUpClass(chart_template_ref=chart_template_ref) cls.env = cls.env(context=cls._setup_context()) + # Auto-disable reconciliation model created automatically with + # generate_account_reconcile_model() to avoid side effects in tests + cls.invoice_matching_models = cls.env["account.reconcile.model"].search( + [ + ("rule_type", "=", "invoice_matching"), + ("auto_reconcile", "=", True), + ("company_id", "=", cls.company.id), + ] + ) + cls.invoice_matching_models.active = False cls.acc_bank_stmt_model = cls.env["account.bank.statement"] cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"] @@ -995,6 +1005,8 @@ class TestReconciliationWidget(TestAccountReconciliationCommon): } ) + self.invoice_matching_models.active = True + self.invoice_matching_models.match_text_location_label = False bank_stmt_line = self.acc_bank_stmt_line_model.create( { "name": "testLine", From 27174a0b378b59ad0701eebaf0bb77c07fbfd205 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 12 Dec 2024 11:25:05 +0100 Subject: [PATCH 2/3] [IMP] account_statement_base: add group by date TT52123 --- account_statement_base/views/account_bank_statement_line.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/account_statement_base/views/account_bank_statement_line.xml b/account_statement_base/views/account_bank_statement_line.xml index a9615fe2..11c3edb3 100644 --- a/account_statement_base/views/account_bank_statement_line.xml +++ b/account_statement_base/views/account_bank_statement_line.xml @@ -165,6 +165,11 @@ string="Transaction Type" context="{'group_by': 'transaction_type'}" /> + From 33493c3dd37eaadc7845a9cb423d302277162b86 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Wed, 16 Oct 2024 16:16:36 +0200 Subject: [PATCH 3/3] [IMP] account_reconcile_oca: Open reconcile view when press the name on journal --- account_reconcile_oca/models/account_journal.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/account_reconcile_oca/models/account_journal.py b/account_reconcile_oca/models/account_journal.py index fb0a14a4..2c317d19 100644 --- a/account_reconcile_oca/models/account_journal.py +++ b/account_reconcile_oca/models/account_journal.py @@ -34,3 +34,12 @@ class AccountJournal(models.Model): ): return False return _("Well done! Everything has been reconciled") + + def open_action(self): + self.ensure_one() + if self.type not in ["bank", "cash"]: + return super().open_action() + action = self.env["ir.actions.actions"]._for_xml_id( + "account_reconcile_oca.action_bank_statement_line_reconcile_all" + ) + return action