← Back to team overview

banking-addons-team team mailing list archive

lp:~camptocamp/banking-addons/bank-statement-reconcile-70-transaction_ref into lp:banking-addons/bank-statement-reconcile-70

 

Romain Deheele - Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-transaction_ref into lp:banking-addons/bank-statement-reconcile-70.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-transaction_ref/+merge/179891

Hello,

This commit adds account_advanced_reconcile_transaction_ref addon.

Based on account_advanced_reconcile addon,
this addon :
- creates a new field : transaction_ref (This field at level of account.move.line is needed to manage ref for multi-payments)
- adds a reconcile rule based on this new field
- inherits _prepare_move_line_vals (account.bank.statement) to push imported ref on new transaction_ref field.

Romain
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-transaction_ref/+merge/179891
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-70-transaction_ref into lp:banking-addons/bank-statement-reconcile-70.
=== added directory 'account_advanced_reconcile_transaction_ref'
=== added file 'account_advanced_reconcile_transaction_ref/__init__.py'
--- account_advanced_reconcile_transaction_ref/__init__.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/__init__.py	2013-08-13 10:17:12 +0000
@@ -0,0 +1,24 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from . import account
+from . import easy_reconcile
+from . import base_advanced_reconciliation
+from . import advanced_reconciliation

=== added file 'account_advanced_reconcile_transaction_ref/__openerp__.py'
--- account_advanced_reconcile_transaction_ref/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/__openerp__.py	2013-08-13 10:17:12 +0000
@@ -0,0 +1,40 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{'name': 'Advanced Reconcile Transaction Ref',
+ 'description':  """
+Advanced reconciliation method for the module account_easy_reconcile
+=================================================
+Reconcile rules with transaction_ref
+
+""",
+ 'version': '1.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:

=== added file 'account_advanced_reconcile_transaction_ref/account.py'
--- account_advanced_reconcile_transaction_ref/account.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/account.py	2013-08-13 10:17:12 +0000
@@ -0,0 +1,54 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv.orm import Model, fields
+
+class AccountMoveLine(Model):
+    """
+    Inherit account.move.line class in order to add transaction_ref field
+    """
+    _inherit = "account.move.line"
+    _columns = {
+        'transaction_ref':fields.char('Transaction Ref.', size=128),
+    }
+    
+class AccountBankSatement(Model):
+    """
+    Inherit account.bank.statement class in order to set transaction_ref info on account.move.line
+    """
+    _inherit = "account.bank.statement"   
+   
+    def _prepare_move_line_vals(
+            self, cr, uid, st_line, move_id, debit, credit, currency_id=False,
+            amount_currency=False, account_id=False, analytic_id=False,
+            partner_id=False, context=None):
+
+        if context is None:
+            context = {}
+        res = super(AccountBankSatement, self)._prepare_move_line_vals(
+                cr, uid, st_line, move_id, debit, credit,
+                currency_id=currency_id,
+                amount_currency=amount_currency,
+                account_id=account_id,
+                analytic_id=analytic_id,
+                partner_id=partner_id, context=context)
+        res.update({'transaction_ref': st_line.ref})
+        return res

=== added file 'account_advanced_reconcile_transaction_ref/advanced_reconciliation.py'
--- account_advanced_reconcile_transaction_ref/advanced_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/advanced_reconciliation.py	2013-08-13 10:17:12 +0000
@@ -0,0 +1,44 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import orm
+ 
+
+class easy_reconcile_advanced_transaction_ref(orm.TransientModel):
+
+    _name = 'easy.reconcile.advanced.transaction_ref'
+    _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['transaction_ref'].lower().strip()))
+  
+    def _opposite_matchers(self, cr, uid, rec, move_line, context=None):
+        yield ('partner_id', move_line['partner_id'])
+        yield ('ref', move_line['transaction_ref'] or ''.lower().strip())       
+

=== added file 'account_advanced_reconcile_transaction_ref/base_advanced_reconciliation.py'
--- account_advanced_reconcile_transaction_ref/base_advanced_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/base_advanced_reconciliation.py	2013-08-13 10:17:12 +0000
@@ -0,0 +1,46 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+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',
+            'transaction_ref')
+        return ["account_move_line.%s" % col for col in aml_cols]    

=== added file 'account_advanced_reconcile_transaction_ref/easy_reconcile.py'
--- account_advanced_reconcile_transaction_ref/easy_reconcile.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/easy_reconcile.py	2013-08-13 10:17:12 +0000
@@ -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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+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.transaction_ref',
+             'Advanced. Partner and Transaction Ref.'),
+        ]
+        return methods
+ 

=== added file 'account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml'
--- account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml	2013-08-13 10:17:12 +0000
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="0">
+      <record id="view_easy_reconcile_form" model="ir.ui.view">
+          <field name="name">account.easy.reconcile.form</field>
+          <field name="model">account.easy.reconcile</field>
+          <field name="inherit_id" ref="account_easy_reconcile.account_easy_reconcile_form"/>
+          <field name="arch" type="xml">
+              <page name="information" position="inside">
+                <group colspan="2" col="2">
+                    <separator colspan="4" string="Advanced. Partner and Transaction Ref"/>
+                    <label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation.
+The lines should have the partner, the credit entry transaction ref. is matched vs the debit entry transaction ref. or name." colspan="4"/>
+                </group>
+              </page>
+          </field>
+      </record>
+    </data>
+</openerp> 

=== added directory 'account_advanced_reconcile_transaction_ref/i18n'
=== added file 'account_advanced_reconcile_transaction_ref/i18n/fr.po'
--- account_advanced_reconcile_transaction_ref/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/i18n/fr.po	2013-08-13 10:17:12 +0000
@@ -0,0 +1,97 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_advanced_reconcile_transaction_ref
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-08-13 09:37+0000\n"
+"PO-Revision-Date: 2013-08-13 09:37+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_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,partner_ids:0
+msgid "Restrict on partners"
+msgstr "Restriction sur les partenaires"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,account_id:0
+msgid "Account"
+msgstr "Compte"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: view:account.easy.reconcile:0
+msgid "Advanced. Partner and Transaction Ref"
+msgstr "Avancé. Partenaire et Référence de transaction"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: 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 transaction ref. is matched vs the debit entry transaction ref. or 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 même référence de transaction sur les écritures de crédit doit se retrouver dans la référence de transaction ou la description sur les écritures de débit."
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_easy_reconcile_advanced_transaction_ref
+msgid "easy.reconcile.advanced.transaction_ref"
+msgstr "easy.reconcile.advanced.transaction_ref"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:account.move.line,transaction_ref:0
+msgid "Transaction Ref."
+msgstr "Réf. de transaction"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,journal_id:0
+msgid "Journal"
+msgstr "Journal"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,account_profit_id:0
+msgid "Account Profit"
+msgstr "Compte de produit"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_account_bank_statement
+msgid "Bank Statement"
+msgstr "Relevé bancaire"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,filter:0
+msgid "Filter"
+msgstr "Filtre"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_account_easy_reconcile_method
+msgid "reconcile method for account_easy_reconcile"
+msgstr "Méthode de lettrage pour le module account_easy_reconcile"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,date_base_on:0
+msgid "Date of reconciliation"
+msgstr "Date de lettrage"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_account_move_line
+msgid "Journal Items"
+msgstr "Écritures comptables"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_easy_reconcile_advanced
+msgid "easy.reconcile.advanced"
+msgstr "easy.reconcile.advanced"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,account_lost_id:0
+msgid "Account Lost"
+msgstr "Compte de charge"
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,write_off:0
+msgid "Write off allowed"
+msgstr "Ecart autorisé"
+


Follow ups