diff --git a/account_advanced_reconcile_bank_statement/__init__.py b/account_advanced_reconcile_bank_statement/__init__.py new file mode 100644 index 00000000..e19ad65a --- /dev/null +++ b/account_advanced_reconcile_bank_statement/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele. Copyright Camptocamp SA +# +# 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 easy_reconcile +from . import base_advanced_reconciliation +from . import advanced_reconciliation diff --git a/account_advanced_reconcile_bank_statement/__openerp__.py b/account_advanced_reconcile_bank_statement/__openerp__.py new file mode 100644 index 00000000..fc5ef68b --- /dev/null +++ b/account_advanced_reconcile_bank_statement/__openerp__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Matthieu Dietrich. Copyright Camptocamp SA +# +# 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': 'Advanced Reconcile Bank Statement', + 'description': """ +Advanced reconciliation method for the module account_advanced_reconcile +======================================================================== +Reconcile rules with bank statement name. + +This will reconcile multiple credit move lines (bank statements) with +all the lines from a specific bank statement, debit or credit (to also +reconcile the commission with credit card imports). + +""", + 'version': '1.0.0', + 'author': 'Camptocamp', + 'category': 'Finance', + 'website': 'http://www.camptocamp.com', + 'depends': ['account_advanced_reconcile'], + 'data': ['easy_reconcile_view.xml'], + 'demo': [], + 'test': [], # To be ported or migrate to unit tests or scenarios + 'auto_install': False, + 'installable': True, + 'images': [] +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_advanced_reconcile_bank_statement/advanced_reconciliation.py b/account_advanced_reconcile_bank_statement/advanced_reconciliation.py new file mode 100644 index 00000000..f85369dc --- /dev/null +++ b/account_advanced_reconcile_bank_statement/advanced_reconciliation.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Matthieu Dietrich. Copyright Camptocamp SA +# +# 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.osv import orm + + +class easy_reconcile_advanced_bank_statement(orm.TransientModel): + + _name = 'easy.reconcile.advanced.bank_statement' + _inherit = 'easy.reconcile.advanced' + + def _skip_line(self, cr, uid, rec, move_line, context=None): + """ + When True is returned on some conditions, the credit move line + will be skipped for reconciliation. Can be inherited to + skip on some conditions. ie: ref or partner_id is empty. + """ + return not (move_line.get('ref') and + move_line.get('partner_id')) + + def _matchers(self, cr, uid, rec, move_line, context=None): + return (('partner_id', move_line['partner_id']), + ('ref', move_line['ref'].lower().strip())) + + def _opposite_matchers(self, cr, uid, rec, move_line, context=None): + yield ('partner_id', move_line['partner_id']) + if move_line['statement_id']: + cr.execute("""SELECT name FROM account_bank_statement + WHERE id = %s""", (move_line['statement_id'],)) + statement_name = cr.fetchone()[0] + yield ('ref', statement_name.lower().strip()) + else: + yield ('ref', '') + + # Re-defined for this particular rule; since the commission line is a + # credit line inside of the target statement, it should also be considered + # as an opposite to be reconciled. + def _action_rec(self, cr, uid, rec, context=None): + credit_lines = self._query_credit(cr, uid, rec, context=context) + debit_lines = self._query_debit(cr, uid, rec, context=context) + return self._rec_auto_lines_advanced( + cr, uid, rec, credit_lines, credit_lines + debit_lines, + context=context) diff --git a/account_advanced_reconcile_bank_statement/base_advanced_reconciliation.py b/account_advanced_reconcile_bank_statement/base_advanced_reconciliation.py new file mode 100644 index 00000000..afcece18 --- /dev/null +++ b/account_advanced_reconcile_bank_statement/base_advanced_reconciliation.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Matthieu Dietrich +# Copyright 2014 Camptocamp SA +# +# 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 itertools import product +from openerp.osv import orm + + +class easy_reconcile_advanced(orm.AbstractModel): + + _inherit = 'easy.reconcile.advanced' + + def _base_columns(self, rec): + """ Mandatory columns for move lines queries + An extra column aliased as ``key`` should be defined + in each query.""" + aml_cols = ( + 'id', + 'debit', + 'credit', + 'date', + 'period_id', + 'ref', + 'name', + 'partner_id', + 'account_id', + 'move_id', + 'statement_id') + return ["account_move_line.%s" % col for col in aml_cols] diff --git a/account_advanced_reconcile_bank_statement/easy_reconcile.py b/account_advanced_reconcile_bank_statement/easy_reconcile.py new file mode 100644 index 00000000..bf714bcd --- /dev/null +++ b/account_advanced_reconcile_bank_statement/easy_reconcile.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Romain Deheele +# Copyright 2013 Camptocamp SA +# +# 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.osv import orm + + +class account_easy_reconcile_method(orm.Model): + + _inherit = 'account.easy.reconcile.method' + + def _get_all_rec_method(self, cr, uid, context=None): + methods = super(account_easy_reconcile_method, self).\ + _get_all_rec_method(cr, uid, context=context) + methods += [ + ('easy.reconcile.advanced.bank_statement', + 'Advanced. Partner and Bank Statement'), + ] + return methods + diff --git a/account_advanced_reconcile_bank_statement/easy_reconcile_view.xml b/account_advanced_reconcile_bank_statement/easy_reconcile_view.xml new file mode 100644 index 00000000..72c0ad68 --- /dev/null +++ b/account_advanced_reconcile_bank_statement/easy_reconcile_view.xml @@ -0,0 +1,19 @@ + + + + + account.easy.reconcile.form + account.easy.reconcile + + + + + + + + + + + diff --git a/account_advanced_reconcile_bank_statement/i18n/account_advanced_reconcile_bank_statement.po b/account_advanced_reconcile_bank_statement/i18n/account_advanced_reconcile_bank_statement.po new file mode 100644 index 00000000..5ede7195 --- /dev/null +++ b/account_advanced_reconcile_bank_statement/i18n/account_advanced_reconcile_bank_statement.po @@ -0,0 +1,107 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_advanced_reconcile_bank_statement +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-05-27 08:36+0000\n" +"PO-Revision-Date: 2014-05-27 08:36+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,filter:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_filter +msgid "Filter" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,account_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_account_id +msgid "Account" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,partner_ids:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_partner_ids +msgid "Restrict on partners" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: code:_description:0 +#: model:ir.model,name:account_advanced_reconcile_bank_statement.model_easy_reconcile_advanced_bank_statement +#, python-format +msgid "easy.reconcile.advanced.bank_statement" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: view:account.easy.reconcile:0 +msgid "Match multiple debit vs multiple credit entries. Allow partial reconciliation. The lines should have the partner, the credit entry reference is matched vs the debit entry bank statement name." +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,journal_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_journal_id +msgid "Journal" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,account_profit_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_account_profit_id +msgid "Account Profit" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,analytic_account_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_analytic_account_id +msgid "Analytic Account" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: code:_description:0 +#: model:ir.model,name:account_advanced_reconcile_bank_statement.model_account_easy_reconcile_method +#, python-format +msgid "reconcile method for account_easy_reconcile" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,date_base_on:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_date_base_on +msgid "Date of reconciliation" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: help:easy.reconcile.advanced.bank_statement,analytic_account_id:0 +msgid "Analytic account for the write-off" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: view:account.easy.reconcile:0 +msgid "Advanced. Partner and Bank Statement" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: code:_description:0 +#: model:ir.model,name:account_advanced_reconcile_bank_statement.model_easy_reconcile_advanced +#, python-format +msgid "easy.reconcile.advanced" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,account_lost_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_account_lost_id +msgid "Account Lost" +msgstr "" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,write_off:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_write_off +msgid "Write off allowed" +msgstr "" + diff --git a/account_advanced_reconcile_bank_statement/i18n/fr.po b/account_advanced_reconcile_bank_statement/i18n/fr.po new file mode 100644 index 00000000..63124f07 --- /dev/null +++ b/account_advanced_reconcile_bank_statement/i18n/fr.po @@ -0,0 +1,103 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_advanced_reconcile_bank_statement +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-05-27 08:36+0000\n" +"PO-Revision-Date: 2014-05-27 08:36+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,filter:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_filter +msgid "Filter" +msgstr "Filtre" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,account_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_account_id +msgid "Account" +msgstr "Compte" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,partner_ids:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_partner_ids +msgid "Restrict on partners" +msgstr "Restriction sur les partenaires" + +#. module: account_advanced_reconcile_bank_statement +#: code:_description:0 +#: model:ir.model,name:account_advanced_reconcile_bank_statement.model_easy_reconcile_advanced_bank_statement +#, python-format +msgid "easy.reconcile.advanced.bank_statement" +msgstr "easy.reconcile.advanced.bank_statement" + +#. module: account_advanced_reconcile_bank_statement +#: view:account.easy.reconcile:0 +msgid "" +"Match multiple debit vs multiple credit entries. Allow partial " +"reconciliation. The lines should have the partner, the credit entry " +"reference is matched vs the debit entry bank statement name." +msgstr "" +"Le lettrage peut s'effectuer sur plusieurs écritures de débit et crédit. Le " +"lettrage partiel est autorisé. Les écritures doivent avoir le même " +"partenaire et la référence sur les écritures de crédit doit se retrouver +"dans le nom du relevé bancaire des écritures de débit." + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,journal_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_journal_id +msgid "Journal" +msgstr "Journal" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,account_profit_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_account_profit_id +msgid "Account Profit" +msgstr "Compte de produit" + +#. module: account_advanced_reconcile_bank_statement +#: code:_description:0 +#: model:ir.model,name:account_advanced_reconcile_bank_statement.model_account_easy_reconcile_method +#, python-format +msgid "reconcile method for account_easy_reconcile" +msgstr "Méthode de lettrage pour le module account_easy_reconcile" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,date_base_on:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_date_base_on +msgid "Date of reconciliation" +msgstr "Date de lettrage" + +#. module: account_advanced_reconcile_bank_statement +#: view:account.easy.reconcile:0 +msgid "Advanced. Partner and Bank Statement" +msgstr "Avancé. Partenaire et Relevé Bancaire" + +#. module: account_advanced_reconcile_bank_statement +#: code:_description:0 +#: model:ir.model,name:account_advanced_reconcile_bank_statement.model_easy_reconcile_advanced +#, python-format +msgid "easy.reconcile.advanced" +msgstr "easy.reconcile.advanced" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,account_lost_id:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_account_lost_id +msgid "Account Lost" +msgstr "Compte de charge" + +#. module: account_advanced_reconcile_bank_statement +#: field:easy.reconcile.advanced.bank_statement,write_off:0 +#: model:ir.model.fields,field_description:account_advanced_reconcile_bank_statement.field_easy_reconcile_advanced_bank_statement_write_off +msgid "Write off allowed" +msgstr "Ecart autorisé" +