diff --git a/account_check_deposit/__init__.py b/account_check_deposit/__init__.py index aee8895e7..0650744f6 100644 --- a/account_check_deposit/__init__.py +++ b/account_check_deposit/__init__.py @@ -1,2 +1 @@ from . import models -from . import wizards diff --git a/account_check_deposit/__manifest__.py b/account_check_deposit/__manifest__.py index 68f56835b..ba822831a 100644 --- a/account_check_deposit/__manifest__.py +++ b/account_check_deposit/__manifest__.py @@ -21,7 +21,6 @@ "data/sequence.xml", "views/account_check_deposit_view.xml", "views/account_move_line_view.xml", - "views/res_config_settings_views.xml", "report/report.xml", "report/report_checkdeposit.xml", ], diff --git a/account_check_deposit/models/__init__.py b/account_check_deposit/models/__init__.py index 48a39cbc8..f2be37c53 100644 --- a/account_check_deposit/models/__init__.py +++ b/account_check_deposit/models/__init__.py @@ -1,3 +1,2 @@ from . import account_check_deposit from . import account_move_line -from . import res_company diff --git a/account_check_deposit/models/account_check_deposit.py b/account_check_deposit/models/account_check_deposit.py index dfdd333dd..20bcb57eb 100644 --- a/account_check_deposit/models/account_check_deposit.py +++ b/account_check_deposit/models/account_check_deposit.py @@ -194,12 +194,8 @@ class AccountCheckDeposit(models.Model): def _prepare_account_move_vals(self): self.ensure_one() - if self.company_id.check_deposit_offsetting_account == "bank_account": - journal_id = self.bank_journal_id.id - else: - journal_id = self.journal_id.id move_vals = { - "journal_id": journal_id, + "journal_id": self.journal_id.id, "date": self.deposit_date, "ref": _("Check Deposit %s") % self.name, } @@ -209,7 +205,7 @@ class AccountCheckDeposit(models.Model): def _prepare_move_line_vals(self, line): assert line.debit > 0, "Debit must have a value" return { - "name": _("Check Deposit - Ref. Check %s") % line.ref, + "name": _("Check Ref. %s") % line.ref, "credit": line.debit, "debit": 0.0, "account_id": line.account_id.id, @@ -220,36 +216,15 @@ class AccountCheckDeposit(models.Model): def _prepare_counterpart_move_lines_vals(self, total_debit, total_amount_currency): self.ensure_one() - company = self.company_id - if not company.check_deposit_offsetting_account: + if not self.bank_journal_id.payment_debit_account_id: raise UserError( - _( - "You must configure the 'Check Deposit Offsetting Account' " - "on the Accounting Settings page" - ) + _("Missing 'Outstanding Receipts Account' on the bank journal '%s'.") + % self.bank_journal_id.display_name ) - if company.check_deposit_offsetting_account == "bank_account": - if not self.bank_journal_id.default_account_id: - raise UserError( - _("Missing 'Default Debit Account' on bank journal '%s'") - % self.bank_journal_id.name - ) - account_id = self.bank_journal_id.default_account_id.id - elif company.check_deposit_offsetting_account == "transfer_account": - if not company.check_deposit_transfer_account_id: - raise UserError( - _( - "Missing 'Check Deposit Offsetting Account' on the " - "company '%s'." - ) - % company.name - ) - account_id = company.check_deposit_transfer_account_id.id return { - "name": _("Check Deposit %s") % self.name, "debit": total_debit, "credit": 0.0, - "account_id": account_id, + "account_id": self.bank_journal_id.payment_debit_account_id.id, "partner_id": False, "currency_id": self.currency_id.id or False, "amount_currency": total_amount_currency, diff --git a/account_check_deposit/models/res_company.py b/account_check_deposit/models/res_company.py deleted file mode 100644 index d72255667..000000000 --- a/account_check_deposit/models/res_company.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2012-2020 Akretion France (http://www.akretion.com/) -# @author: BenoƮt GUILLOT -# @author: Chafique DELLI -# @author: Alexis de Lattre -# @author: Mourad EL HADJ MIMOUNE -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import fields, models - - -class ResCompany(models.Model): - _inherit = "res.company" - - check_deposit_offsetting_account = fields.Selection( - selection=[ - ("bank_account", "Bank Account"), - ("transfer_account", "Transfer Account"), - ], - string="Check Deposit Offsetting Account", - default="bank_account", - ) - check_deposit_transfer_account_id = fields.Many2one( - comodel_name="account.account", - string="Transfer Account for Check Deposits", - ondelete="restrict", - copy=False, - domain=[("reconcile", "=", True), ("deprecated", "=", False)], - ) diff --git a/account_check_deposit/readme/CONFIGURE.rst b/account_check_deposit/readme/CONFIGURE.rst index a9e38033a..8b2729f8b 100644 --- a/account_check_deposit/readme/CONFIGURE.rst +++ b/account_check_deposit/readme/CONFIGURE.rst @@ -6,16 +6,11 @@ journal: * Short Code: CHK (or any code you want) * Outstanding Receipts Account: select an account for checks received +Note that, on this *Checks Received* journal, the bank account and suspense account will not be used, so don't worry about these parameters. + This bank journal will be available as a payment method in Odoo. The account you configured as *Outstanding Receipts Account* is the account via which the amounts of checks will transit between the reception of a check from a customer and the validation of the check deposit in Odoo. -On the Settings page of the Accounting, you should configure the -*Check Deposit Offsetting Account*: - -* if you select *Bank Account*, the counter-part of the account move related to - the check deposit will be the default account of the bank account - selected on the check deposit. -* if you select *Transfer Account*, you will have to select a specific account - that will be used as transfer account for check deposits. +When you validate the check deposit in Odoo, it will generate a new journal entry that will move the amounts from the *Outstanding Receipts Account* of the checks received journal to the *Outstanding Receipts Account* of the bank journal related to the check deposit. It will also reconcile in the *Outstanding Receipts Account* of the checks received journal. diff --git a/account_check_deposit/readme/USAGE.rst b/account_check_deposit/readme/USAGE.rst index 9298b04d0..f8f516f9b 100644 --- a/account_check_deposit/readme/USAGE.rst +++ b/account_check_deposit/readme/USAGE.rst @@ -1,6 +1,6 @@ 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 -*Check Received* journal as *Journal*. +*Checks Received* journal as *Journal*. When you want to deposit checks to the bank, go to the menu *Invoicing > Accounting > Miscellaneous > Check Deposit*, create a new check deposit and set the diff --git a/account_check_deposit/views/res_config_settings_views.xml b/account_check_deposit/views/res_config_settings_views.xml deleted file mode 100644 index 8609631bc..000000000 --- a/account_check_deposit/views/res_config_settings_views.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - res.config.settings.view.form.account_check_deposit - res.config.settings - - - -

Check Deposits

-
-
-
-
-
-
-
-
-
-
-
-
- - - - diff --git a/account_check_deposit/wizards/__init__.py b/account_check_deposit/wizards/__init__.py deleted file mode 100644 index 0deb68c46..000000000 --- a/account_check_deposit/wizards/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import res_config_settings diff --git a/account_check_deposit/wizards/res_config_settings.py b/account_check_deposit/wizards/res_config_settings.py deleted file mode 100644 index 7cd4a5044..000000000 --- a/account_check_deposit/wizards/res_config_settings.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2016-2020 Akretion France (http://www.akretion.com/) -# @author: Alexis de Lattre -# Copyright 2018-2020 Tecnativa - Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import fields, models - - -class ResConfigSettings(models.TransientModel): - _inherit = "res.config.settings" - - check_deposit_offsetting_account = fields.Selection( - related="company_id.check_deposit_offsetting_account", readonly=False - ) - check_deposit_transfer_account_id = fields.Many2one( - related="company_id.check_deposit_transfer_account_id", readonly=False - )