diff --git a/account_reconcile_prepare_account/README.rst b/account_reconcile_prepare_account/README.rst new file mode 100644 index 00000000..12ebb74d --- /dev/null +++ b/account_reconcile_prepare_account/README.rst @@ -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 `_. +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 `_. + +Credits +======= + +Contributors +------------ + +* Holger Brunn + +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. diff --git a/account_reconcile_prepare_account/__init__.py b/account_reconcile_prepare_account/__init__.py new file mode 100644 index 00000000..cdb7d736 --- /dev/null +++ b/account_reconcile_prepare_account/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +from . import models diff --git a/account_reconcile_prepare_account/__openerp__.py b/account_reconcile_prepare_account/__openerp__.py new file mode 100644 index 00000000..902ff73c --- /dev/null +++ b/account_reconcile_prepare_account/__openerp__.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +{ + "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, +} diff --git a/account_reconcile_prepare_account/models/__init__.py b/account_reconcile_prepare_account/models/__init__.py new file mode 100644 index 00000000..33afdc17 --- /dev/null +++ b/account_reconcile_prepare_account/models/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +from . import account_bank_statement_line diff --git a/account_reconcile_prepare_account/models/account_bank_statement_line.py b/account_reconcile_prepare_account/models/account_bank_statement_line.py new file mode 100644 index 00000000..0d2886b5 --- /dev/null +++ b/account_reconcile_prepare_account/models/account_bank_statement_line.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This module copyright (C) 2015 Therp BV (). +# +# 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 . +# +############################################################################## +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 diff --git a/account_reconcile_prepare_account/static/description/icon.png b/account_reconcile_prepare_account/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_reconcile_prepare_account/static/description/icon.png differ diff --git a/account_reconcile_prepare_account/static/src/js/account_reconcile_prepare_account.js b/account_reconcile_prepare_account/static/src/js/account_reconcile_prepare_account.js new file mode 100644 index 00000000..a52229c4 --- /dev/null +++ b/account_reconcile_prepare_account/static/src/js/account_reconcile_prepare_account.js @@ -0,0 +1,32 @@ +//-*- coding: utf-8 -*- +//############################################################################ +// +// This module copyright (C) 2015 Therp BV . +// +// 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 . +// +//############################################################################ + +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; + }, + }); +} diff --git a/account_reconcile_prepare_account/views/account_bank_statement.xml b/account_reconcile_prepare_account/views/account_bank_statement.xml new file mode 100644 index 00000000..2838a617 --- /dev/null +++ b/account_reconcile_prepare_account/views/account_bank_statement.xml @@ -0,0 +1,25 @@ + + + + + account.bank.statement + + + + + + + + + + account.bank.statement + + + + + + + + + + diff --git a/account_reconcile_prepare_account/views/templates.xml b/account_reconcile_prepare_account/views/templates.xml new file mode 100644 index 00000000..5beca23d --- /dev/null +++ b/account_reconcile_prepare_account/views/templates.xml @@ -0,0 +1,10 @@ + + + + + +