[ADD] account_reconcile_prepare_account

This commit is contained in:
Holger Brunn
2015-09-09 19:28:24 +02:00
parent 4d92143e8e
commit b1f7617ff8
9 changed files with 265 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
======================================
Prepare accounts before reconciliation
======================================
This module supoprts a workflow for bank statements where one person with few
permissions already assigns accounts (analytic and non-analytic) to bank
transactions, so that another person only needs to review the assignment,
select the correct moves (filtered by the assigned partner and account), and
then confirm the reconciliation.
Those preassigned accounts are also used as default values for newly created
move lines during reconciliation.
Usage
=====
Select accounts on the bank statement form, and offered moves for
reconciliation will be filtered accordingly.
* go to ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/98/8.0
For further information, please visit:
* https://www.odoo.com/forum/help-1
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-reconcile/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/bank-statement-reconcile/issues/new?body=module:%20account_reconcile_prepare_account%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import models

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Prepare accounts before reconciliation",
"version": "8.0.1.0.0",
"author": "Therp BV,Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Banking addons",
"summary": "Assign bank transactions to accounts before reconciliation",
"depends": [
'account_bank_statement_import',
],
"data": [
"views/account_bank_statement.xml",
"views/templates.xml",
],
"installable": True,
}

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import account_bank_statement_line

View File

@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, api, fields
from openerp.osv import expression
class AccountBankStatementLine(models.Model):
_inherit = 'account.bank.statement.line'
prepared_account_id = fields.Many2one(
'account.account', string='Account')
prepared_analytic_account_id = fields.Many2one(
'account.analytic.account', string='Analytic account')
@api.model
def _domain_move_lines_for_reconciliation(
self, st_line, excluded_ids=None, str=False,
additional_domain=None):
if st_line.prepared_account_id:
additional_domain = expression.AND([
expression.normalize_domain(additional_domain)
if additional_domain else [],
[('account_id', '=', st_line.prepared_account_id.id)],
])
if st_line.prepared_analytic_account_id:
additional_domain = expression.AND([
expression.normalize_domain(additional_domain)
if additional_domain else [],
[('analytic_account_id', '=',
st_line.prepared_analytic_account_id.id)],
])
return super(AccountBankStatementLine, self)\
._domain_move_lines_for_reconciliation(
st_line, excluded_ids=excluded_ids, str=str,
additional_domain=additional_domain)
@api.model
def get_statement_line_for_reconciliation(self, st_line):
vals = super(AccountBankStatementLine, self)\
.get_statement_line_for_reconciliation(st_line)
if st_line.prepared_account_id:
vals['prepared_account_id'] = st_line.prepared_account_id.id
if st_line.prepared_analytic_account_id:
vals['prepared_analytic_account_id'] =\
st_line.prepared_analytic_account_id.id
return vals

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,32 @@
//-*- coding: utf-8 -*-
//############################################################################
//
// This module copyright (C) 2015 Therp BV <http://therp.nl>.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//############################################################################
openerp.account_reconcile_prepare_account = function(instance)
{
instance.web.account.bankStatementReconciliationLine.include({
initializeCreateForm: function()
{
var result = this._super.apply(this, arguments);
this.account_id_field.set('value', this.st_line.prepared_account_id);
this.analytic_account_id_field.set('value', this.st_line.prepared_analytic_account_id);
return result;
},
});
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_bank_statement_form" model="ir.ui.view">
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']//field[@name='partner_id']" position="after">
<field name="prepared_account_id" attrs="{'readonly': [('journal_entry_id', '!=', False)]}" />
<field name="prepared_analytic_account_id" attrs="{'readonly': [('journal_entry_id', '!=', False)]}" />
</xpath>
</field>
</record>
<record id="view_bank_statement_form2" model="ir.ui.view">
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form2" />
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']//field[@name='partner_id']" position="after">
<field name="prepared_account_id" />
<field name="prepared_analytic_account_id" />
</xpath>
</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend" name="account_reconcile_prepare_account assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/account_reconcile_prepare_account/static/src/js/account_reconcile_prepare_account.js"></script>
</xpath>
</template>
</data>
</openerp>