mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
account_check_deposit: remove configuration parameters from res.company
Update documentation Don't duplicate labels between name of account.move.line and ref of account.move, now that name of account.move.line is not required any more.
This commit is contained in:
committed by
Víctor Martínez
parent
4a73e447e3
commit
1cd87a73f2
@@ -1,2 +1 @@
|
||||
from . import models
|
||||
from . import wizards
|
||||
|
||||
@@ -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",
|
||||
],
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
from . import account_check_deposit
|
||||
from . import account_move_line
|
||||
from . import res_company
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# Copyright 2012-2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Benoît GUILLOT <benoit.guillot@akretion.com>
|
||||
# @author: Chafique DELLI <chafique.delli@akretion.com>
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author: Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
|
||||
# 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)],
|
||||
)
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2015-2020 Akretion - Alexis de Lattre
|
||||
Copyright 2018-2020 Tecnativa - Pedro M. Baeza
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">res.config.settings.view.form.account_check_deposit</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='bank_cash']" position="after">
|
||||
<h2>Check Deposits</h2>
|
||||
<div class="row mt16 o_settings_container" id="account_check_deposit">
|
||||
<div
|
||||
class="col-xs-12 col-md-6 o_setting_box"
|
||||
id="account_check_deposit_offsetting_account"
|
||||
>
|
||||
<div class="o_setting_left_pane" />
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="check_deposit_offsetting_account" />
|
||||
<div class="content-group">
|
||||
<field
|
||||
name="check_deposit_offsetting_account"
|
||||
class="o_light_label mt16"
|
||||
widget="radio"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="col-xs-12 col-md-6 o_setting_box"
|
||||
attrs="{'invisible': ['|', ('has_chart_of_accounts', '=', False), ('check_deposit_offsetting_account', '!=', 'transfer_account')]}"
|
||||
id="account_check_deposit_transfer_account_id"
|
||||
>
|
||||
<div class="o_setting_left_pane" />
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="check_deposit_transfer_account_id" />
|
||||
<field
|
||||
name="check_deposit_transfer_account_id"
|
||||
class="oe_inline"
|
||||
context="{'default_reconcile': True}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1 +0,0 @@
|
||||
from . import res_config_settings
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright 2016-2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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
|
||||
)
|
||||
Reference in New Issue
Block a user