mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Port account_check_deposit to v10
Add option to have the counter-part of the deposit move directly to the bank account Use account.config.settings page
This commit is contained in:
@@ -18,30 +18,29 @@ Configuration
|
||||
|
||||
A journal named *Check Received* is automatically created. It will be available as a payment method in Odoo. On this journal, you must configure the *Default Debit Account* and *Defaut Credit Account* ; this 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 company form view, you should configure the *Account for Check Deposits* ; this is the account via which the amounts of checks will transit between the validation of the check deposit in Odoo and the credit on the bank account.
|
||||
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 debit 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.
|
||||
|
||||
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 *Check Received* journal as *Payment Method*.
|
||||
|
||||
When you want to deposit checks to the bank, go to the menu *Accounting > Bank and Cash > Check Deposit*, create a new check deposit and set the journal *Checks Received* and select the bank account on which you want to credit the checks. Then click on *Add an item* to select the checks you want to deposit at the bank. Eventually, validate the deposit and print the report (you probably want to customize this report).
|
||||
When you want to deposit checks to the bank, go to the menu *Accounting > Adviser > Check Deposit*, create a new check deposit and set the journal *Checks Received* and select the bank account on which you want to credit the checks. Then click on *Add an item* to select the checks you want to deposit at the bank. Eventually, validate the deposit and print the report (you probably want to customize this report).
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/92/8.0
|
||||
|
||||
For further information, please visit:
|
||||
|
||||
* https://www.odoo.com/forum/help-1
|
||||
:target: https://runbot.odoo-community.org/runbot/92/10.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
|
||||
`here <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_check_deposit%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/account-financial-tools/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
@@ -57,9 +56,9 @@ Contributors
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: http://odoo-community.org/logo.png
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: http://odoo-community.org
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
@@ -67,4 +66,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# account_check_deposit for Odoo
|
||||
# Copyright (C) 2012-2015 Akretion (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>
|
||||
#
|
||||
# © 2012-2015 Akretion (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>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
{
|
||||
'name': 'Account Check Deposit',
|
||||
'version': '8.0.0.1.0',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Accounting & Finance',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Manage deposit of checks to the bank',
|
||||
@@ -26,7 +20,7 @@
|
||||
'views/account_deposit_view.xml',
|
||||
'views/account_move_line_view.xml',
|
||||
'data/account_deposit_sequence.xml',
|
||||
'views/company_view.xml',
|
||||
'views/account_config_settings.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'security/check_deposit_security.xml',
|
||||
'data/account_data.xml',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import company
|
||||
from . import account_config_settings
|
||||
from . import account_deposit
|
||||
|
||||
14
account_check_deposit/models/account_config_settings.py
Normal file
14
account_check_deposit/models/account_config_settings.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountConfigSettings(models.TransientModel):
|
||||
_inherit = 'account.config.settings'
|
||||
|
||||
check_deposit_offsetting_account = fields.Selection(
|
||||
related='company_id.check_deposit_offsetting_account')
|
||||
check_deposit_transfer_account_id = fields.Many2one(
|
||||
related='company_id.check_deposit_transfer_account_id')
|
||||
@@ -1,21 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# account_check_deposit for Odoo
|
||||
# Copyright (C) 2012-2016 Akretion (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>
|
||||
#
|
||||
# © 2012-2016 Akretion (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 openerp import models, fields, api, _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from openerp.exceptions import ValidationError
|
||||
from openerp.exceptions import Warning as UserError
|
||||
from odoo import models, fields, api, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
|
||||
class AccountCheckDeposit(models.Model):
|
||||
@@ -61,7 +54,8 @@ class AccountCheckDeposit(models.Model):
|
||||
states={'done': [('readonly', '=', True)]},
|
||||
default=fields.Date.context_today)
|
||||
journal_id = fields.Many2one(
|
||||
'account.journal', string='Journal', domain=[('type', '=', 'bank')],
|
||||
'account.journal', string='Journal',
|
||||
domain=[('type', '=', 'bank'), ('bank_account_id', '=', False)],
|
||||
required=True, states={'done': [('readonly', '=', True)]})
|
||||
journal_default_account_id = fields.Many2one(
|
||||
'account.account', related='journal_id.default_debit_account_id',
|
||||
@@ -79,9 +73,10 @@ class AccountCheckDeposit(models.Model):
|
||||
], string='Status', default='draft', readonly=True)
|
||||
move_id = fields.Many2one(
|
||||
'account.move', string='Journal Entry', readonly=True)
|
||||
partner_bank_id = fields.Many2one(
|
||||
'res.partner.bank', string='Bank Account', required=True,
|
||||
domain="[('company_id', '=', company_id)]",
|
||||
bank_journal_id = fields.Many2one(
|
||||
'account.journal', string='Bank Account', required=True,
|
||||
domain="[('company_id', '=', company_id), ('type', '=', 'bank'), "
|
||||
"('bank_account_id', '!=', False)]",
|
||||
states={'done': [('readonly', '=', True)]})
|
||||
line_ids = fields.One2many(
|
||||
'account.move.line', related='move_id.line_ids',
|
||||
@@ -185,11 +180,28 @@ class AccountCheckDeposit(models.Model):
|
||||
@api.model
|
||||
def _prepare_counterpart_move_lines_vals(
|
||||
self, deposit, total_debit, total_amount_currency):
|
||||
company = deposit.company_id
|
||||
if not company.check_deposit_offsetting_account:
|
||||
raise UserError(_(
|
||||
"You must configure the 'Check Deposit Offsetting Account' "
|
||||
"on the Accounting Settings page"))
|
||||
if company.check_deposit_offsetting_account == 'bank_account':
|
||||
if not deposit.bank_journal_id.default_debit_account_id:
|
||||
raise UserError(_(
|
||||
"Missing 'Default Debit Account' on bank journal '%s'")
|
||||
% deposit.bank_journal_id.name)
|
||||
account_id = deposit.bank_journal_id.default_debit_account_id.id
|
||||
elif company.check_deposit_offsetting_account == 'transfer_account':
|
||||
if not company.check_deposit_transfer_account_id:
|
||||
raise UserError(_(
|
||||
"Missing 'Account for Check Deposits' on the "
|
||||
"company '%s'.") % company.name)
|
||||
account_id = company.check_deposit_transfer_account_id.id
|
||||
return {
|
||||
'name': _('Check Deposit %s') % deposit.name,
|
||||
'debit': total_debit,
|
||||
'credit': 0.0,
|
||||
'account_id': deposit.company_id.check_deposit_account_id.id,
|
||||
'account_id': account_id,
|
||||
'partner_id': False,
|
||||
'currency_id': deposit.currency_none_same_company_id.id or False,
|
||||
'amount_currency': total_amount_currency,
|
||||
@@ -215,11 +227,6 @@ class AccountCheckDeposit(models.Model):
|
||||
to_reconcile_lines.append(line + move_line)
|
||||
|
||||
# Create counter-part
|
||||
if not deposit.company_id.check_deposit_account_id:
|
||||
raise UserError(
|
||||
_("Missing Account for Check Deposits on the "
|
||||
"company '%s'.") % deposit.company_id.name)
|
||||
|
||||
counter_vals = self._prepare_counterpart_move_lines_vals(
|
||||
deposit, total_debit, total_amount_currency)
|
||||
counter_vals['move_id'] = move.id
|
||||
@@ -235,12 +242,14 @@ class AccountCheckDeposit(models.Model):
|
||||
@api.onchange('company_id')
|
||||
def onchange_company_id(self):
|
||||
if self.company_id:
|
||||
partner_banks = self.env['res.partner.bank'].search(
|
||||
[('company_id', '=', self.company_id.id)])
|
||||
if len(partner_banks) == 1:
|
||||
self.partner_bank_id = partner_banks[0]
|
||||
bank_journals = self.env['account.journal'].search([
|
||||
('company_id', '=', self.company_id.id),
|
||||
('type', '=', 'bank'),
|
||||
('bank_account_id', '!=', False)])
|
||||
if len(bank_journals) == 1:
|
||||
self.bank_journal_id = bank_journals[0]
|
||||
else:
|
||||
self.partner_bank_id = False
|
||||
self.bank_journal_id = False
|
||||
|
||||
@api.onchange('journal_id')
|
||||
def onchange_journal_id(self):
|
||||
@@ -256,11 +265,3 @@ class AccountMoveLine(models.Model):
|
||||
|
||||
check_deposit_id = fields.Many2one(
|
||||
'account.check.deposit', string='Check Deposit', copy=False)
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
check_deposit_account_id = fields.Many2one(
|
||||
'account.account', string='Account for Check Deposits', copy=False,
|
||||
domain=[('reconcile', '=', True)])
|
||||
|
||||
22
account_check_deposit/models/company.py
Normal file
22
account_check_deposit/models/company.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2012-2016 Akretion (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 models, fields
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
check_deposit_offsetting_account = fields.Selection([
|
||||
('bank_account', 'Bank Account'),
|
||||
('transfer_account', 'Transfer Account'),
|
||||
], string='Check Deposit Offsetting Account', default='bank_account')
|
||||
check_deposit_transfer_account_id = fields.Many2one(
|
||||
'account.account', string='Transfer Account for Check Deposits',
|
||||
ondelete='restrict', copy=False,
|
||||
domain=[('reconcile', '=', True), ('deprecated', '=', False)])
|
||||
@@ -20,15 +20,15 @@
|
||||
<h1>Check Deposit n°<span t-field="o.name"/></h1>
|
||||
|
||||
<h3>Bank:</h3>
|
||||
<p><span t-field="o.partner_bank_id.bank.name"/><br/>
|
||||
<span t-field="o.partner_bank_id.bank.street"/><br/>
|
||||
<span t-field="o.partner_bank_id.bank.zip"/> <span t-field="o.partner_bank_id.bank.city"/></p>
|
||||
<p><span t-field="o.bank_journal_id.bank_account_id.bank_id.name"/><br/>
|
||||
<span t-field="o.bank_journal_id.bank_account_id.bank_id.street"/><br/>
|
||||
<span t-field="o.bank_journal_id.bank_account_id.bank_id.zip"/> <span t-field="o.bank_journal_id.bank_account_id.bank_id.city"/></p>
|
||||
|
||||
<h3>Beneficiary:</h3>
|
||||
<div t-field="o.company_id.partner_id"
|
||||
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
|
||||
|
||||
<p><b>Bank Account Number to Credit:</b> <span t-field="o.partner_bank_id.acc_number"/></p>
|
||||
<p><b>Bank Account Number to Credit:</b> <span t-field="o.bank_journal_id.bank_account_id.acc_number"/></p>
|
||||
|
||||
<p><b>Check Currency:</b> <span t-field="o.currency_id.name"/></p>
|
||||
|
||||
|
||||
28
account_check_deposit/views/account_config_settings.xml
Normal file
28
account_check_deposit/views/account_config_settings.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
<record id="view_account_config_settings" model="ir.ui.view">
|
||||
<field name="name">currency_rate_update.account_config_settings.form</field>
|
||||
<field name="model">account.config.settings</field>
|
||||
<field name="inherit_id" ref="account.view_account_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="bank_options" position="inside">
|
||||
<div name="check_deposit_option">
|
||||
<label for="check_deposit_offsetting_account"/>
|
||||
<field name="check_deposit_offsetting_account" class="oe_inline"/>
|
||||
</div>
|
||||
<div name="check_deposit_transfer"
|
||||
attrs="{'invisible': ['|', ('has_chart_of_accounts', '=', False), ('check_deposit_offsetting_account', '!=', 'transfer_account')]}">
|
||||
<label for="check_deposit_transfer_account_id"/>
|
||||
<field name="check_deposit_transfer_account_id" class="oe_inline"
|
||||
context="{'default_reconcile': True}"/>
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -39,7 +39,7 @@
|
||||
invisible="1"/>
|
||||
<field name="currency_id"
|
||||
groups="base.group_multi_currency"/>
|
||||
<field name="partner_bank_id"/>
|
||||
<field name="bank_journal_id" widget="selection"/>
|
||||
</group>
|
||||
<group name="right">
|
||||
<field name="company_id"
|
||||
@@ -92,7 +92,7 @@
|
||||
<field name="name"/>
|
||||
<field name="deposit_date"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="partner_bank_id"/>
|
||||
<field name="bank_journal_id"/>
|
||||
<field name="check_count"/>
|
||||
<field name="total_amount"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2014-2015 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_company_form" model="ir.ui.view">
|
||||
<field name="name">check.deposit.company.form</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form" />
|
||||
<field name="arch" type="xml">
|
||||
<group name="account_grp" position="inside">
|
||||
<field name="check_deposit_account_id" />
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user