From 60f3c6990703ce00a8215b9103ce7b46eb836e20 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Sun, 21 Apr 2024 23:55:05 +0200 Subject: [PATCH] [IMP] account_reconcile_oca: Allow to define the statement directly --- .../models/account_bank_statement.py | 1 - .../models/account_bank_statement_line.py | 22 +++++++++++++++++++ .../static/src/scss/reconcile.scss | 14 ++++++++++++ .../views/account_bank_statement.xml | 1 + .../views/account_bank_statement_line.xml | 14 ++++++++++++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/account_reconcile_oca/models/account_bank_statement.py b/account_reconcile_oca/models/account_bank_statement.py index 52a64a2f..19b9bec1 100644 --- a/account_reconcile_oca/models/account_bank_statement.py +++ b/account_reconcile_oca/models/account_bank_statement.py @@ -11,6 +11,5 @@ class AccountBankStatement(models.Model): action = self.env["ir.actions.act_window"]._for_xml_id( "account_reconcile_oca.account_bank_statement_action_edit" ) - print(action) action["res_id"] = self.id return action diff --git a/account_reconcile_oca/models/account_bank_statement_line.py b/account_reconcile_oca/models/account_bank_statement_line.py index b5fab233..36971169 100644 --- a/account_reconcile_oca/models/account_bank_statement_line.py +++ b/account_reconcile_oca/models/account_bank_statement_line.py @@ -769,3 +769,25 @@ class AccountBankStatementLine(models.Model): if vals["partner_id"] is False and self.partner_name: vals["partner_id"] = (False, self.partner_name) return vals + + def add_statement(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "account_reconcile_oca.account_bank_statement_action_edit" + ) + previous_line_with_statement = self.env["account.bank.statement.line"].search( + [ + ("internal_index", "<", self.internal_index), + ("journal_id", "=", self.journal_id.id), + ("state", "=", "posted"), + ("statement_id", "!=", self.statement_id.id), + ("statement_id", "!=", False), + ], + limit=1, + ) + action["context"] = { + "default_journal_id": self.journal_id.id, + "default_balance_start": previous_line_with_statement.statement_id.balance_end_real, + "split_line_id": self.id, + } + return action diff --git a/account_reconcile_oca/static/src/scss/reconcile.scss b/account_reconcile_oca/static/src/scss/reconcile.scss index f8fa60fe..9a574985 100644 --- a/account_reconcile_oca/static/src/scss/reconcile.scss +++ b/account_reconcile_oca/static/src/scss/reconcile.scss @@ -6,9 +6,23 @@ flex-flow: row wrap; height: 100%; .o_kanban_renderer.o_kanban_ungrouped .o_kanban_record { + &:hover { + .o_reconcile_create_statement { + opacity: 100; + } + } margin: 0 0 0; min-width: fit-content; width: 100%; + .o_reconcile_create_statement { + position: absolute; + height: 4px; + margin: 0; + padding: 2px 0 0 0; + border: 0; + top: -14px; + opacity: 0; + } > div { border-right: thick solid rgba(0, 0, 0, 0); } diff --git a/account_reconcile_oca/views/account_bank_statement.xml b/account_reconcile_oca/views/account_bank_statement.xml index d081b50b..ac615d7f 100644 --- a/account_reconcile_oca/views/account_bank_statement.xml +++ b/account_reconcile_oca/views/account_bank_statement.xml @@ -24,6 +24,7 @@ + diff --git a/account_reconcile_oca/views/account_bank_statement_line.xml b/account_reconcile_oca/views/account_bank_statement_line.xml index 95f8263c..fc8d16b8 100644 --- a/account_reconcile_oca/views/account_bank_statement_line.xml +++ b/account_reconcile_oca/views/account_bank_statement_line.xml @@ -17,6 +17,20 @@ +