From 55af165df9813385a03d0d844ff65d26b90b2b22 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 5 Dec 2024 23:58:45 +0100 Subject: [PATCH] [MIG] account_check_deposit from v17 to v18 --- account_check_deposit/README.rst | 4 +- .../models/account_check_deposit.py | 14 +++++-- account_check_deposit/readme/USAGE.md | 2 +- .../static/description/index.html | 4 +- .../views/account_check_deposit_view.xml | 40 +++++++------------ 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/account_check_deposit/README.rst b/account_check_deposit/README.rst index 9ac55044116..fc046bcdde8 100644 --- a/account_check_deposit/README.rst +++ b/account_check_deposit/README.rst @@ -73,8 +73,8 @@ Usage ===== When you receive a check that pays a customer invoice, you can go to -that invoice and click on the button *Register Payment* and select the -*Checks Received* journal as *Journal*. +that invoice and click on the button *Pay* and select the *Checks +Received* journal as *Journal*. When you want to deposit checks to the bank, go to the menu *Invoicing > Customers > Checks Deposits*, create a new check deposit and set the diff --git a/account_check_deposit/models/account_check_deposit.py b/account_check_deposit/models/account_check_deposit.py index 0e7b2fbcf6e..d006a90b5da 100644 --- a/account_check_deposit/models/account_check_deposit.py +++ b/account_check_deposit/models/account_check_deposit.py @@ -247,13 +247,19 @@ def _prepare_move_vals(self): if line.payment_method_id.code == "manual" and line.payment_account_id: counterpart_account_id = line.payment_account_id.id break + # inspired by _get_outstanding_account() on account.payment if not counterpart_account_id: - counterpart_account_id = ( - self.company_id.account_journal_payment_debit_account_id.id - ) + chart_template = self.with_context( + allowed_company_ids=self.company_id.root_id.ids + ).env["account.chart.template"] + counterpart_account_id = chart_template.ref( + "account_journal_payment_debit_account_id", raise_if_not_found=False + ).id + if not counterpart_account_id: + counterpart_account_id = self.company_id.transfer_account_id.id if not counterpart_account_id: raise UserError( - _("Missing 'Outstanding Receipts Account' on the company '%s'.") + _("Missing 'Internal Transfer' account on the company '%s'.") % self.company_id.display_name ) diff --git a/account_check_deposit/readme/USAGE.md b/account_check_deposit/readme/USAGE.md index f47ef5b93cd..b0d27f6aa73 100644 --- a/account_check_deposit/readme/USAGE.md +++ b/account_check_deposit/readme/USAGE.md @@ -1,5 +1,5 @@ When you receive a check that pays a customer invoice, you can go to -that invoice and click on the button *Register Payment* and select the +that invoice and click on the button *Pay* and select the *Checks Received* journal as *Journal*. When you want to deposit checks to the bank, go to the menu *Invoicing diff --git a/account_check_deposit/static/description/index.html b/account_check_deposit/static/description/index.html index 0786b62af91..544964d49a8 100644 --- a/account_check_deposit/static/description/index.html +++ b/account_check_deposit/static/description/index.html @@ -419,8 +419,8 @@

Configuration

Usage

When you receive a check that pays a customer invoice, you can go to -that invoice and click on the button Register Payment and select the -Checks Received journal as Journal.

+that invoice and click on the button Pay and select the Checks +Received journal as Journal.

When you want to deposit checks to the bank, go to the menu Invoicing > Customers > Checks Deposits, create a new check deposit and set the journal Checks Received and select the bank account on which you want diff --git a/account_check_deposit/views/account_check_deposit_view.xml b/account_check_deposit/views/account_check_deposit_view.xml index d6cfe00bcb2..0275bce4502 100644 --- a/account_check_deposit/views/account_check_deposit_view.xml +++ b/account_check_deposit/views/account_check_deposit_view.xml @@ -108,7 +108,7 @@ context="{'currency': currency_id, 'journal_id': journal_id}" > - + @@ -123,37 +123,32 @@ sum="1" optional="hide" /> - - - - + + + + -

- - - -
+ - account.check.deposit.tree + account.check.deposit.list account.check.deposit - + - + - + - + @@ -192,11 +187,6 @@ string="Deposit Date" context="{'group_by': 'deposit_date'}" /> - Checks Deposits account.check.deposit - tree,form,pivot + list,form,pivot