← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-account_easy_reconcile-analytic-account into lp:banking-addons

 

Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-account_easy_reconcile-analytic-account into lp:banking-addons.

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

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-account_easy_reconcile-analytic-account/+merge/213006

Allow to set an analytic account on write-off entries created during reconciliations.
-- 
The attached diff has been truncated due to its size.
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-account_easy_reconcile-analytic-account/+merge/213006
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-account_easy_reconcile-analytic-account into lp:banking-addons.
=== added directory 'account_advanced_reconcile'
=== added file 'account_advanced_reconcile/__init__.py'
--- account_advanced_reconcile/__init__.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2012 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/>.
+#
+##############################################################################
+
+import easy_reconcile
+import base_advanced_reconciliation
+import advanced_reconciliation

=== added file 'account_advanced_reconcile/__openerp__.py'
--- account_advanced_reconcile/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2012 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",
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': ['account_easy_reconcile',
+             ],
+ 'description': """
+Advanced reconciliation methods for the module account_easy_reconcile.
+
+In addition to the features implemented in account_easy_reconcile, which are:
+ - reconciliation facilities for big volume of transactions
+ - setup different profiles of reconciliation by account
+ - each profile can use many methods of reconciliation
+ - this module is also a base to create others reconciliation methods
+    which can plug in the profiles
+ - a profile a reconciliation can be run manually or by a cron
+ - monitoring of reconcilation runs with an history
+
+It implements a basis to created advanced reconciliation methods in a few lines
+of code.
+
+Typically, such a method can be:
+ - Reconcile Journal items if the partner and the ref are equal
+ - Reconcile Journal items if the partner is equal and the ref
+   is the same than ref or name
+ - Reconcile Journal items if the partner is equal and the ref
+   match with a pattern
+
+And they allows:
+ - Reconciliations with multiple credit / multiple debit lines
+ - Partial reconciliations
+ - Write-off amount as well
+
+A method is already implemented in this module, it matches on items:
+ - Partner
+ - Ref on credit move lines should be case insensitive equals to the ref or
+   the name of the debit move line
+
+The base class to find the reconciliations is built to be as efficient as
+possible.
+
+So basically, if you have an invoice with 3 payments (one per month), the first
+month, it will partial reconcile the debit move line with the first payment, the second
+month, it will partial reconcile the debit move line with 2 first payments,
+the third month, it will make the full reconciliation.
+
+This module is perfectly adapted for E-Commerce business where a big volume of
+move lines and so, reconciliations, are involved and payments often come from
+many offices.
+
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'data': ['easy_reconcile_view.xml'],
+ 'test': [],
+ 'images': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True,
+}

=== added file 'account_advanced_reconcile/advanced_reconciliation.py'
--- account_advanced_reconcile/advanced_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/advanced_reconciliation.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2012 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_ref(orm.TransientModel):
+
+    _name = 'easy.reconcile.advanced.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 the values used as matchers to find the opposite lines
+
+        All the matcher keys in the dict must have their equivalent in
+        the `_opposite_matchers`.
+
+        The values of each matcher key will be searched in the
+        one returned by the `_opposite_matchers`
+
+        Must be inherited to implement the matchers for one method
+
+        For instance, it can return:
+        return ('ref', move_line['rec'])
+
+        or
+        return (('partner_id', move_line['partner_id']),
+                ('ref', "prefix_%s" % move_line['rec']))
+
+        All the matchers have to be found in the opposite lines
+        to consider them as "opposite"
+
+        The matchers will be evaluated in the same order as declared
+        vs the the opposite matchers, so you can gain performance by
+        declaring first the partners with the less computation.
+
+        All matchers should match with their opposite to be considered
+        as "matching".
+        So with the previous example, partner_id and ref have to be
+        equals on the opposite line matchers.
+
+        :return: tuple of tuples (key, value) where the keys are
+            the matchers keys
+            (must be the same than `_opposite_matchers` returns,
+            and their values to match in the opposite lines.
+            A matching key can have multiples values.
+        """
+        return (('partner_id', move_line['partner_id']),
+                ('ref', move_line['ref'].lower().strip()))
+
+    def _opposite_matchers(self, cr, uid, rec, move_line, context=None):
+        """
+        Return the values of the opposite line used as matchers
+        so the line is matched
+
+        Must be inherited to implement the matchers for one method
+        It can be inherited to apply some formatting of fields
+        (strip(), lower() and so on)
+
+        This method is the counterpart of the `_matchers()` method.
+
+        Each matcher has to yield its value respecting the order
+        of the `_matchers()`.
+
+        When a matcher does not correspond, the next matchers won't
+        be evaluated so the ones which need the less computation
+        have to be executed first.
+
+        If the `_matchers()` returns:
+        (('partner_id', move_line['partner_id']),
+         ('ref', move_line['ref']))
+
+        Here, you should yield :
+        yield ('partner_id', move_line['partner_id'])
+        yield ('ref', move_line['ref'])
+
+        Note that a matcher can contain multiple values, as instance,
+        if for a move line, you want to search from its `ref` in the
+        `ref` or `name` fields of the opposite move lines, you have to
+        yield ('partner_id', move_line['partner_id'])
+        yield ('ref', (move_line['ref'], move_line['name'])
+
+        An OR is used between the values for the same key.
+        An AND is used between the differents keys.
+
+        :param dict move_line: values of the move_line
+        :yield: matchers as tuple ('matcher key', value(s))
+        """
+        yield ('partner_id', move_line['partner_id'])
+        yield ('ref', ((move_line['ref'] or '').lower().strip(),
+                       move_line['name'].lower().strip()))

=== added file 'account_advanced_reconcile/base_advanced_reconciliation.py'
--- account_advanced_reconcile/base_advanced_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/base_advanced_reconciliation.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,272 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2012 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):
+
+    _name = 'easy.reconcile.advanced'
+    _inherit = 'easy.reconcile.base'
+
+    def _query_debit(self, cr, uid, rec, context=None):
+        """Select all move (debit>0) as candidate. """
+        select = self._select(rec)
+        sql_from = self._from(rec)
+        where, params = self._where(rec)
+        where += " AND account_move_line.debit > 0 "
+
+        where2, params2 = self._get_filter(cr, uid, rec, context=context)
+
+        query = ' '.join((select, sql_from, where, where2))
+
+        cr.execute(query, params + params2)
+        return cr.dictfetchall()
+
+    def _query_credit(self, cr, uid, rec, context=None):
+        """Select all move (credit>0) as candidate. """
+        select = self._select(rec)
+        sql_from = self._from(rec)
+        where, params = self._where(rec)
+        where += " AND account_move_line.credit > 0 "
+
+        where2, params2 = self._get_filter(cr, uid, rec, context=context)
+
+        query = ' '.join((select, sql_from, where, where2))
+
+        cr.execute(query, params + params2)
+        return cr.dictfetchall()
+
+    def _matchers(self, cr, uid, rec, move_line, context=None):
+        """
+        Return the values used as matchers to find the opposite lines
+
+        All the matcher keys in the dict must have their equivalent in
+        the `_opposite_matchers`.
+
+        The values of each matcher key will be searched in the
+        one returned by the `_opposite_matchers`
+
+        Must be inherited to implement the matchers for one method
+
+        As instance, it can return:
+        return ('ref', move_line['rec'])
+
+        or
+        return (('partner_id', move_line['partner_id']),
+                ('ref', "prefix_%s" % move_line['rec']))
+
+        All the matchers have to be found in the opposite lines
+        to consider them as "opposite"
+
+        The matchers will be evaluated in the same order as declared
+        vs the the opposite matchers, so you can gain performance by
+        declaring first the partners with the less computation.
+
+        All matchers should match with their opposite to be considered
+        as "matching".
+        So with the previous example, partner_id and ref have to be
+        equals on the opposite line matchers.
+
+        :return: tuple of tuples (key, value) where the keys are
+            the matchers keys
+            (must be the same than `_opposite_matchers` returns,
+            and their values to match in the opposite lines.
+            A matching key can have multiples values.
+        """
+        raise NotImplementedError
+
+    def _opposite_matchers(self, cr, uid, rec, move_line, context=None):
+        """
+        Return the values of the opposite line used as matchers
+        so the line is matched
+
+        Must be inherited to implement the matchers for one method
+        It can be inherited to apply some formatting of fields
+        (strip(), lower() and so on)
+
+        This method is the counterpart of the `_matchers()` method.
+
+        Each matcher has to yield its value respecting the order
+        of the `_matchers()`.
+
+        When a matcher does not correspond, the next matchers won't
+        be evaluated so the ones which need the less computation
+        have to be executed first.
+
+        If the `_matchers()` returns:
+        (('partner_id', move_line['partner_id']),
+         ('ref', move_line['ref']))
+
+        Here, you should yield :
+        yield ('partner_id', move_line['partner_id'])
+        yield ('ref', move_line['ref'])
+
+        Note that a matcher can contain multiple values, as instance,
+        if for a move line, you want to search from its `ref` in the
+        `ref` or `name` fields of the opposite move lines, you have to
+        yield ('partner_id', move_line['partner_id'])
+        yield ('ref', (move_line['ref'], move_line['name'])
+
+        An OR is used between the values for the same key.
+        An AND is used between the differents keys.
+
+        :param dict move_line: values of the move_line
+        :yield: matchers as tuple ('matcher key', value(s))
+        """
+        raise NotImplementedError
+
+    @staticmethod
+    def _compare_values(key, value, opposite_value):
+        """Can be inherited to modify the equality condition
+        specifically according to the matcher key (maybe using
+        a like operator instead of equality on 'ref' as instance)
+        """
+        # consider that empty vals are not valid matchers
+        # it can still be inherited for some special cases
+        # where it would be allowed
+        if not (value and opposite_value):
+            return False
+
+        if value == opposite_value:
+            return True
+        return False
+
+    @staticmethod
+    def _compare_matcher_values(key, values, opposite_values):
+        """ Compare every values from a matcher vs an opposite matcher
+        and return True if it matches
+        """
+        for value, ovalue in product(values, opposite_values):
+            # we do not need to compare all values, if one matches
+            # we are done
+            if easy_reconcile_advanced._compare_values(key, value, ovalue):
+                return True
+        return False
+
+    @staticmethod
+    def _compare_matchers(matcher, opposite_matcher):
+        """
+        Prepare and check the matchers to compare
+        """
+        mkey, mvalue = matcher
+        omkey, omvalue = opposite_matcher
+        assert mkey == omkey, ("A matcher %s is compared with a matcher %s, "
+                " the _matchers and _opposite_matchers are probably wrong" %
+                (mkey, omkey))
+        if not isinstance(mvalue, (list, tuple)):
+            mvalue = mvalue,
+        if not isinstance(omvalue, (list, tuple)):
+            omvalue = omvalue,
+        return easy_reconcile_advanced._compare_matcher_values(mkey, mvalue, omvalue)
+
+    def _compare_opposite(self, cr, uid, rec, move_line, opposite_move_line,
+                          matchers, context=None):
+        """ Iterate over the matchers of the move lines vs opposite move lines
+        and if they all match, return True.
+
+        If all the matchers match for a move line and an opposite move line,
+        they are candidate for a reconciliation.
+        """
+        opp_matchers = self._opposite_matchers(cr, uid, rec, opposite_move_line,
+                context=context)
+        for matcher in matchers:
+            try:
+                opp_matcher = opp_matchers.next()
+            except StopIteration:
+                # if you fall here, you probably missed to put a `yield`
+                # in `_opposite_matchers()`
+                raise ValueError("Missing _opposite_matcher: %s" % matcher[0])
+
+            if not self._compare_matchers(matcher, opp_matcher):
+                # if any of the matcher fails, the opposite line
+                # is not a valid counterpart
+                # directly returns so the next yield of _opposite_matchers
+                # are not evaluated
+                return False
+
+        return True
+
+    def _search_opposites(self, cr, uid, rec, move_line, opposite_move_lines, context=None):
+        """
+        Search the opposite move lines for a move line
+
+        :param dict move_line: the move line for which we search opposites
+        :param list opposite_move_lines: list of dict of move lines values, the move
+            lines we want to search for
+        :return: list of matching lines
+        """
+        matchers = self._matchers(cr, uid, rec, move_line, context=context)
+        return [op for op in opposite_move_lines if
+                self._compare_opposite(
+                    cr, uid, rec, move_line, op, matchers, context=context)]
+
+    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, debit_lines, context=context)
+
+    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 False
+
+    def _rec_auto_lines_advanced(self, cr, uid, rec, credit_lines, debit_lines, context=None):
+        """ Advanced reconciliation main loop """
+        reconciled_ids = []
+        partial_reconciled_ids = []
+        reconcile_groups = []
+
+        for credit_line in credit_lines:
+            if self._skip_line(cr, uid, rec, credit_line, context=context):
+                continue
+
+            opposite_lines = self._search_opposites(
+                cr, uid, rec, credit_line, debit_lines, context=context)
+
+            if not opposite_lines:
+                continue
+
+            opposite_ids = [l['id'] for l in opposite_lines]
+            line_ids = opposite_ids + [credit_line['id']]
+            for group in reconcile_groups:
+                if any([lid in group for lid in opposite_ids]):
+                    group.update(line_ids)
+                    break
+            else:
+                reconcile_groups.append(set(line_ids))
+
+        lines_by_id = dict([(l['id'], l) for l in credit_lines + debit_lines])
+        for reconcile_group_ids in reconcile_groups:
+            group_lines = [lines_by_id[lid] for lid in reconcile_group_ids]
+            reconciled, full = self._reconcile_lines(
+                cr, uid, rec, group_lines, allow_partial=True, context=context)
+            if reconciled and full:
+                reconciled_ids += reconcile_group_ids
+            elif reconciled:
+                partial_reconciled_ids += reconcile_group_ids
+
+        return reconciled_ids, partial_reconciled_ids

=== added file 'account_advanced_reconcile/easy_reconcile.py'
--- account_advanced_reconcile/easy_reconcile.py	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/easy_reconcile.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2012 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.ref',
+             'Advanced. Partner and Ref.'),
+        ]
+        return methods

=== added file 'account_advanced_reconcile/easy_reconcile_view.xml'
--- account_advanced_reconcile/easy_reconcile_view.xml	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/easy_reconcile_view.xml	2014-03-27 09:24:37 +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 Ref"/>
+                    <label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation.
+The lines should have the partner, the credit entry ref. is matched vs the debit entry ref. or name." colspan="4"/>
+                </group>
+              </page>
+          </field>
+      </record>
+    </data>
+</openerp>

=== added directory 'account_advanced_reconcile/i18n'
=== added file 'account_advanced_reconcile/i18n/account_advanced_reconcile.pot'
--- account_advanced_reconcile/i18n/account_advanced_reconcile.pot	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/i18n/account_advanced_reconcile.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,90 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_advanced_reconcile
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:54+0000\n"
+"PO-Revision-Date: 2014-01-21 11:54+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
+#: field:easy.reconcile.advanced,partner_ids:0
+#: field:easy.reconcile.advanced.ref,partner_ids:0
+msgid "Restrict on partners"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,account_id:0
+#: field:easy.reconcile.advanced.ref,account_id:0
+msgid "Account"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: model:ir.model,name:account_advanced_reconcile.model_account_easy_reconcile_method
+msgid "reconcile method for account_easy_reconcile"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,journal_id:0
+#: field:easy.reconcile.advanced.ref,journal_id:0
+msgid "Journal"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,account_profit_id:0
+#: field:easy.reconcile.advanced.ref,account_profit_id:0
+msgid "Account Profit"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: 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 ref. is matched vs the debit entry ref. or name."
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,filter:0
+#: field:easy.reconcile.advanced.ref,filter:0
+msgid "Filter"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: view:account.easy.reconcile:0
+msgid "Advanced. Partner and Ref"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,date_base_on:0
+#: field:easy.reconcile.advanced.ref,date_base_on:0
+msgid "Date of reconciliation"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: model:ir.model,name:account_advanced_reconcile.model_easy_reconcile_advanced
+msgid "easy.reconcile.advanced"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,account_lost_id:0
+#: field:easy.reconcile.advanced.ref,account_lost_id:0
+msgid "Account Lost"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: model:ir.model,name:account_advanced_reconcile.model_easy_reconcile_advanced_ref
+msgid "easy.reconcile.advanced.ref"
+msgstr ""
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,write_off:0
+#: field:easy.reconcile.advanced.ref,write_off:0
+msgid "Write off allowed"
+msgstr ""
+

=== added file 'account_advanced_reconcile/i18n/fr.po'
--- account_advanced_reconcile/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile/i18n/fr.po	2014-03-27 09:24:37 +0000
@@ -0,0 +1,98 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* account_advanced_reconcile
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:54+0000\n"
+"PO-Revision-Date: 2014-03-21 15:24+0000\n"
+"Last-Translator: Guewen Baconnier @ Camptocamp <Unknown>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-03-22 07:11+0000\n"
+"X-Generator: Launchpad (build 16967)\n"
+"Language: \n"
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,partner_ids:0
+#: field:easy.reconcile.advanced.ref,partner_ids:0
+msgid "Restrict on partners"
+msgstr "Restriction sur les partenaires"
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,account_id:0
+#: field:easy.reconcile.advanced.ref,account_id:0
+msgid "Account"
+msgstr "Compte"
+
+#. module: account_advanced_reconcile
+#: model:ir.model,name:account_advanced_reconcile.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
+#: field:easy.reconcile.advanced,journal_id:0
+#: field:easy.reconcile.advanced.ref,journal_id:0
+msgid "Journal"
+msgstr "Journal"
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,account_profit_id:0
+#: field:easy.reconcile.advanced.ref,account_profit_id:0
+msgid "Account Profit"
+msgstr "Compte de produit"
+
+#. module: account_advanced_reconcile
+#: 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 ref. is "
+"matched vs the debit entry 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 référence sur les écritures de crédit doit se retrouver "
+"dans la référence ou la description sur les écritures de débit."
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,filter:0
+#: field:easy.reconcile.advanced.ref,filter:0
+msgid "Filter"
+msgstr "Filtre"
+
+#. module: account_advanced_reconcile
+#: view:account.easy.reconcile:0
+msgid "Advanced. Partner and Ref"
+msgstr "Avancé. Partenaire et Réf."
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,date_base_on:0
+#: field:easy.reconcile.advanced.ref,date_base_on:0
+msgid "Date of reconciliation"
+msgstr "Date de lettrage"
+
+#. module: account_advanced_reconcile
+#: model:ir.model,name:account_advanced_reconcile.model_easy_reconcile_advanced
+msgid "easy.reconcile.advanced"
+msgstr "easy.reconcile.advanced"
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,account_lost_id:0
+#: field:easy.reconcile.advanced.ref,account_lost_id:0
+msgid "Account Lost"
+msgstr "Compte de charge"
+
+#. module: account_advanced_reconcile
+#: model:ir.model,name:account_advanced_reconcile.model_easy_reconcile_advanced_ref
+msgid "easy.reconcile.advanced.ref"
+msgstr "easy.reconcile.advanced.ref"
+
+#. module: account_advanced_reconcile
+#: field:easy.reconcile.advanced,write_off:0
+#: field:easy.reconcile.advanced.ref,write_off:0
+msgid "Write off allowed"
+msgstr "Écart autorisé"

=== 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	2014-03-27 09:24:37 +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	2014-03-27 09:24:37 +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.1',
+ '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	2014-03-27 09:24:37 +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 AccountBankStatement(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(AccountBankStatement, 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	2014-03-27 09:24:37 +0000
@@ -0,0 +1,43 @@
+# -*- 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	2014-03-27 09:24:37 +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	2014-03-27 09:24:37 +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	2014-03-27 09:24:37 +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/account_advanced_reconcile_transaction_ref.pot'
--- account_advanced_reconcile_transaction_ref/i18n/account_advanced_reconcile_transaction_ref.pot	1970-01-01 00:00:00 +0000
+++ account_advanced_reconcile_transaction_ref/i18n/account_advanced_reconcile_transaction_ref.pot	2014-03-27 09:24:37 +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: 2014-01-21 11:55+0000\n"
+"PO-Revision-Date: 2014-01-21 11:55+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 ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,account_id:0
+msgid "Account"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: view:account.easy.reconcile:0
+msgid "Advanced. Partner and Transaction Ref"
+msgstr ""
+
+#. 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 ""
+
+#. 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 ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:account.move.line,transaction_ref:0
+msgid "Transaction Ref."
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,journal_id:0
+msgid "Journal"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,account_profit_id:0
+msgid "Account Profit"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_account_bank_statement
+msgid "Bank Statement"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,filter:0
+msgid "Filter"
+msgstr ""
+
+#. 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 ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,date_base_on:0
+msgid "Date of reconciliation"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_account_move_line
+msgid "Journal Items"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: model:ir.model,name:account_advanced_reconcile_transaction_ref.model_easy_reconcile_advanced
+msgid "easy.reconcile.advanced"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,account_lost_id:0
+msgid "Account Lost"
+msgstr ""
+
+#. module: account_advanced_reconcile_transaction_ref
+#: field:easy.reconcile.advanced.transaction_ref,write_off:0
+msgid "Write off allowed"
+msgstr ""
+

=== 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	2014-03-27 09:24:37 +0000
@@ -0,0 +1,106 @@
+# 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: 2014-01-21 11:55+0000\n"
+"PO-Revision-Date: 2014-03-21 15:25+0000\n"
+"Last-Translator: Vincent Renaville@camptocamp "
+"<vincent.renaville@xxxxxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-03-22 07:11+0000\n"
+"X-Generator: Launchpad (build 16967)\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é"

=== added directory 'account_easy_reconcile'
=== added file 'account_easy_reconcile/__init__.py'
--- account_easy_reconcile/__init__.py	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright 2012 Camptocamp SA (Guewen Baconnier)
+#    Copyright (C) 2010   Sébastien Beau
+#
+#    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/>.
+#
+##############################################################################
+
+import easy_reconcile
+import base_reconciliation
+import simple_reconciliation
+import easy_reconcile_history

=== added file 'account_easy_reconcile/__openerp__.py'
--- account_easy_reconcile/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright 2012 Camptocamp SA (Guewen Baconnier)
+#    Copyright (C) 2010   Sébastien Beau
+#
+#    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": "Easy Reconcile",
+    "version": "1.3.0",
+    "depends": ["account"],
+    "author": "Akretion,Camptocamp",
+    "description": """
+Easy Reconcile
+==============
+
+This is a shared work between Akretion and Camptocamp
+in order to provide:
+ - reconciliation facilities for big volume of transactions
+ - setup different profiles of reconciliation by account
+ - each profile can use many methods of reconciliation
+ - this module is also a base to create others
+   reconciliation methods which can plug in the profiles
+ - a profile a reconciliation can be run manually
+   or by a cron
+ - monitoring of reconciliation runs with an history
+   which keep track of the reconciled Journal items
+
+2 simple reconciliation methods are integrated
+in this module, the simple reconciliations works
+on 2 lines (1 debit / 1 credit) and do not allow
+partial reconcilation, they also match on 1 key,
+partner or Journal item name.
+
+You may be interested to install also the
+``account_advanced_reconciliation`` module.
+This latter add more complex reconciliations,
+allows multiple lines and partial.
+
+""",
+    "website": "http://www.akretion.com/";,
+    "category": "Finance",
+    "demo_xml": [],
+    "data": ["easy_reconcile.xml",
+             "easy_reconcile_history_view.xml",
+             "security/ir_rule.xml",
+             "security/ir.model.access.csv"],
+    'license': 'AGPL-3',
+    "auto_install": False,
+    "installable": True,
+
+}

=== added file 'account_easy_reconcile/base_reconciliation.py'
--- account_easy_reconcile/base_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/base_reconciliation.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,211 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright 2012-2013 Camptocamp SA (Guewen Baconnier)
+#    Copyright (C) 2010   Sébastien Beau
+#
+#    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 fields, orm
+from operator import itemgetter, attrgetter
+
+
+class easy_reconcile_base(orm.AbstractModel):
+    """Abstract Model for reconciliation methods"""
+
+    _name = 'easy.reconcile.base'
+
+    _inherit = 'easy.reconcile.options'
+
+    _columns = {
+        'account_id': fields.many2one(
+            'account.account', 'Account', required=True),
+        'partner_ids': fields.many2many(
+            'res.partner', string="Restrict on partners"),
+        # other columns are inherited from easy.reconcile.options
+    }
+
+    def automatic_reconcile(self, cr, uid, ids, context=None):
+        """ Reconciliation method called from the view.
+
+        :return: list of reconciled ids, list of partially reconciled items
+        """
+        if isinstance(ids, (int, long)):
+            ids = [ids]
+        assert len(ids) == 1, "Has to be called on one id"
+        rec = self.browse(cr, uid, ids[0], context=context)
+        return self._action_rec(cr, uid, rec, context=context)
+
+    def _action_rec(self, cr, uid, rec, context=None):
+        """ Must be inherited to implement the reconciliation
+
+        :return: list of reconciled ids
+        """
+        raise NotImplementedError
+
+    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')
+        return ["account_move_line.%s" % col for col in aml_cols]
+
+    def _select(self, rec, *args, **kwargs):
+        return "SELECT %s" % ', '.join(self._base_columns(rec))
+
+    def _from(self, rec, *args, **kwargs):
+        return "FROM account_move_line"
+
+    def _where(self, rec, *args, **kwargs):
+        where = ("WHERE account_move_line.account_id = %s "
+                 "AND account_move_line.reconcile_id IS NULL ")
+        # it would be great to use dict for params
+        # but as we use _where_calc in _get_filter
+        # which returns a list, we have to
+        # accomodate with that
+        params = [rec.account_id.id]
+
+        if rec.partner_ids:
+            where += " AND account_move_line.partner_id IN %s"
+            params.append(tuple([l.id for l in rec.partner_ids]))
+        return where, params
+
+    def _get_filter(self, cr, uid, rec, context):
+        ml_obj = self.pool.get('account.move.line')
+        where = ''
+        params = []
+        if rec.filter:
+            dummy, where, params = ml_obj._where_calc(
+                cr, uid, eval(rec.filter), context=context).get_sql()
+            if where:
+                where = " AND %s" % where
+        return where, params
+
+    def _below_writeoff_limit(self, cr, uid, rec, lines,
+                              writeoff_limit, context=None):
+        precision = self.pool.get('decimal.precision').precision_get(
+            cr, uid, 'Account')
+        keys = ('debit', 'credit')
+        sums = reduce(
+            lambda line, memo:
+                dict((key, value + memo[key])
+                for key, value
+                in line.iteritems()
+                if key in keys), lines)
+
+        debit, credit = sums['debit'], sums['credit']
+        writeoff_amount = round(debit - credit, precision)
+        return bool(writeoff_limit >= abs(writeoff_amount)), debit, credit
+
+    def _get_rec_date(self, cr, uid, rec, lines,
+                      based_on='end_period_last_credit', context=None):
+        period_obj = self.pool.get('account.period')
+
+        def last_period(mlines):
+            period_ids = [ml['period_id'] for ml in mlines]
+            periods = period_obj.browse(
+                cr, uid, period_ids, context=context)
+            return max(periods, key=attrgetter('date_stop'))
+
+        def last_date(mlines):
+            return max(mlines, key=itemgetter('date'))
+
+        def credit(mlines):
+            return [l for l in mlines if l['credit'] > 0]
+
+        def debit(mlines):
+            return [l for l in mlines if l['debit'] > 0]
+
+        if based_on == 'end_period_last_credit':
+            return last_period(credit(lines)).date_stop
+        if based_on == 'end_period':
+            return last_period(lines).date_stop
+        elif based_on == 'newest':
+            return last_date(lines)['date']
+        elif based_on == 'newest_credit':
+            return last_date(credit(lines))['date']
+        elif based_on == 'newest_debit':
+            return last_date(debit(lines))['date']
+        # reconcilation date will be today
+        # when date is None
+        return None
+
+    def _reconcile_lines(self, cr, uid, rec, lines, allow_partial=False, context=None):
+        """ Try to reconcile given lines
+
+        :param list lines: list of dict of move lines, they must at least
+                           contain values for : id, debit, credit
+        :param boolean allow_partial: if True, partial reconciliation will be
+                                      created, otherwise only Full
+                                      reconciliation will be created
+        :return: tuple of boolean values, first item is wether the items
+                 have been reconciled or not,
+                 the second is wether the reconciliation is full (True)
+                 or partial (False)
+        """
+        if context is None:
+            context = {}
+
+        ml_obj = self.pool.get('account.move.line')
+        writeoff = rec.write_off
+
+        line_ids = [l['id'] for l in lines]
+        below_writeoff, sum_debit, sum_credit = self._below_writeoff_limit(
+            cr, uid, rec, lines, writeoff, context=context)
+        date = self._get_rec_date(
+            cr, uid, rec, lines, rec.date_base_on, context=context)
+
+        rec_ctx = dict(context, date_p=date)
+        if below_writeoff:
+            if sum_credit < sum_debit:
+                writeoff_account_id = rec.account_profit_id.id
+            else:
+                writeoff_account_id = rec.account_lost_id.id
+
+            period_id = self.pool.get('account.period').find(
+                cr, uid, dt=date, context=context)[0]
+
+            if rec.analytic_account_id:
+                rec_ctx['analytic_id'] = rec.analytic_account_id.id
+
+            ml_obj.reconcile(
+                cr, uid,
+                line_ids,
+                type='auto',
+                writeoff_acc_id=writeoff_account_id,
+                writeoff_period_id=period_id,
+                writeoff_journal_id=rec.journal_id.id,
+                context=rec_ctx)
+            return True, True
+        elif allow_partial:
+            ml_obj.reconcile_partial(
+                cr, uid,
+                line_ids,
+                type='manual',
+                context=rec_ctx)
+            return True, False
+
+        return False, False

=== added file 'account_easy_reconcile/easy_reconcile.py'
--- account_easy_reconcile/easy_reconcile.py	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/easy_reconcile.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,290 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright 2012-2013 Camptocamp SA (Guewen Baconnier)
+#    Copyright (C) 2010   Sébastien Beau
+#
+#    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 fields, osv, orm
+from openerp.tools.translate import _
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
+
+
+class easy_reconcile_options(orm.AbstractModel):
+    """Options of a reconciliation profile
+
+    Columns shared by the configuration of methods
+    and by the reconciliation wizards.
+    This allows decoupling of the methods and the
+    wizards and allows to launch the wizards alone
+    """
+
+    _name = 'easy.reconcile.options'
+
+    def _get_rec_base_date(self, cr, uid, context=None):
+        return [('end_period_last_credit', 'End of period of most recent credit'),
+                ('newest', 'Most recent move line'),
+                ('actual', 'Today'),
+                ('end_period', 'End of period of most recent move line'),
+                ('newest_credit', 'Date of most recent credit'),
+                ('newest_debit', 'Date of most recent debit')]
+
+    _columns = {
+            'write_off': fields.float('Write off allowed'),
+            'account_lost_id': fields.many2one(
+                'account.account', 'Account Lost'),
+            'account_profit_id': fields.many2one(
+                'account.account', 'Account Profit'),
+            'journal_id': fields.many2one(
+                'account.journal', 'Journal'),
+            'date_base_on': fields.selection(
+                _get_rec_base_date,
+                required=True,
+                string='Date of reconciliation'),
+            'filter': fields.char('Filter', size=128),
+            'analytic_account_id': fields.many2one(
+                'account.analytic.account', 'Analytic Account',
+                help="Analytic account for the write-off"),
+    }
+
+    _defaults = {
+        'write_off': 0.,
+        'date_base_on': 'end_period_last_credit',
+    }
+
+
+class account_easy_reconcile_method(orm.Model):
+
+    _name = 'account.easy.reconcile.method'
+    _description = 'reconcile method for account_easy_reconcile'
+
+    _inherit = 'easy.reconcile.options'
+
+    _order = 'sequence'
+
+    def _get_all_rec_method(self, cr, uid, context=None):
+        return [
+            ('easy.reconcile.simple.name', 'Simple. Amount and Name'),
+            ('easy.reconcile.simple.partner', 'Simple. Amount and Partner'),
+            ('easy.reconcile.simple.reference', 'Simple. Amount and Reference'),
+            ]
+
+    def _get_rec_method(self, cr, uid, context=None):
+        return self._get_all_rec_method(cr, uid, context=None)
+
+    _columns = {
+            'name': fields.selection(
+                _get_rec_method, 'Type', required=True),
+            'sequence': fields.integer(
+                'Sequence',
+                required=True,
+                help="The sequence field is used to order "
+                     "the reconcile method"),
+            'task_id': fields.many2one(
+                'account.easy.reconcile',
+                string='Task',
+                required=True,
+                ondelete='cascade'),
+            'company_id': fields.related('task_id','company_id',
+                                         relation='res.company',
+                                         type='many2one',
+                                         string='Company',
+                                         store=True,
+                                         readonly=True),
+    }
+
+    _defaults = {
+        'sequence': 1,
+    }
+
+    def init(self, cr):
+        """ Migration stuff
+
+        Name is not anymore methods names but the name
+        of the model which does the reconciliation
+        """
+        cr.execute("""
+        UPDATE account_easy_reconcile_method
+        SET name = 'easy.reconcile.simple.partner'
+        WHERE name = 'action_rec_auto_partner'
+        """)
+        cr.execute("""
+        UPDATE account_easy_reconcile_method
+        SET name = 'easy.reconcile.simple.name'
+        WHERE name = 'action_rec_auto_name'
+        """)
+
+
+class account_easy_reconcile(orm.Model):
+
+    _name = 'account.easy.reconcile'
+    _description = 'account easy reconcile'
+
+    def _get_total_unrec(self, cr, uid, ids, name, arg, context=None):
+        obj_move_line = self.pool.get('account.move.line')
+        res = {}
+        for task in self.browse(cr, uid, ids, context=context):
+            res[task.id] = len(obj_move_line.search(
+                cr, uid,
+                [('account_id', '=', task.account.id),
+                 ('reconcile_id', '=', False),
+                 ('reconcile_partial_id', '=', False)],
+                context=context))
+        return res
+
+    def _get_partial_rec(self, cr, uid, ids, name, arg, context=None):
+        obj_move_line = self.pool.get('account.move.line')
+        res = {}
+        for task in self.browse(cr, uid, ids, context=context):
+            res[task.id] = len(obj_move_line.search(
+                cr, uid,
+                [('account_id', '=', task.account.id),
+                 ('reconcile_id', '=', False),
+                 ('reconcile_partial_id', '!=', False)],
+                context=context))
+        return res
+
+    def _last_history(self, cr, uid, ids, name, args, context=None):
+        result = {}
+        for history in self.browse(cr, uid, ids, context=context):
+            result[history.id] = False
+            if history.history_ids:
+                # history is sorted by date desc
+                result[history.id] = history.history_ids[0].id
+        return result
+
+    _columns = {
+        'name': fields.char('Name', required=True),
+        'account': fields.many2one(
+            'account.account', 'Account', required=True),
+        'reconcile_method': fields.one2many(
+            'account.easy.reconcile.method', 'task_id', 'Method'),
+        'unreconciled_count': fields.function(
+            _get_total_unrec, type='integer', string='Unreconciled Items'),
+        'reconciled_partial_count': fields.function(
+            _get_partial_rec,
+            type='integer',
+            string='Partially Reconciled Items'),
+        'history_ids': fields.one2many(
+            'easy.reconcile.history',
+            'easy_reconcile_id',
+            string='History',
+            readonly=True),
+        'last_history':
+            fields.function(
+                _last_history,
+                string='Last History',
+                type='many2one',
+                relation='easy.reconcile.history',
+                readonly=True),
+        'company_id': fields.many2one('res.company', 'Company'),
+    }
+
+    def _prepare_run_transient(self, cr, uid, rec_method, context=None):
+        return {'account_id': rec_method.task_id.account.id,
+                'write_off': rec_method.write_off,
+                'account_lost_id': (rec_method.account_lost_id and
+                                    rec_method.account_lost_id.id),
+                'account_profit_id': (rec_method.account_profit_id and
+                                      rec_method.account_profit_id.id),
+                'analytic_account_id': (rec_method.analytic_account_id and
+                                        rec_method.analytic_account_id.id),
+                'journal_id': (rec_method.journal_id and
+                               rec_method.journal_id.id),
+                'date_base_on': rec_method.date_base_on,
+                'filter': rec_method.filter}
+
+    def run_reconcile(self, cr, uid, ids, context=None):
+        def find_reconcile_ids(fieldname, move_line_ids):
+            if not move_line_ids:
+                return []
+            sql = ("SELECT DISTINCT " + fieldname +
+                   " FROM account_move_line "
+                   " WHERE id in %s "
+                   " AND " + fieldname + " IS NOT NULL")
+            cr.execute(sql, (tuple(move_line_ids),))
+            res = cr.fetchall()
+            return [row[0] for row in res]
+
+        for rec in self.browse(cr, uid, ids, context=context):
+            all_ml_rec_ids = []
+            all_ml_partial_ids = []
+
+            for method in rec.reconcile_method:
+                rec_model = self.pool.get(method.name)
+                auto_rec_id = rec_model.create(
+                    cr, uid,
+                    self._prepare_run_transient(
+                        cr, uid, method, context=context),
+                    context=context)
+
+                ml_rec_ids, ml_partial_ids = rec_model.automatic_reconcile(
+                    cr, uid, auto_rec_id, context=context)
+
+                all_ml_rec_ids += ml_rec_ids
+                all_ml_partial_ids += ml_partial_ids
+
+            reconcile_ids = find_reconcile_ids(
+                    'reconcile_id', all_ml_rec_ids)
+            partial_ids = find_reconcile_ids(
+                    'reconcile_partial_id', all_ml_partial_ids)
+
+            self.pool.get('easy.reconcile.history').create(
+                cr,
+                uid,
+                {'easy_reconcile_id': rec.id,
+                 'date': fields.datetime.now(),
+                 'reconcile_ids': [(4, rid) for rid in reconcile_ids],
+                 'reconcile_partial_ids': [(4, rid) for rid in partial_ids]},
+                context=context)
+        return True
+
+    def _no_history(self, cr, uid, rec, context=None):
+        """ Raise an `osv.except_osv` error, supposed to
+        be called when there is no history on the reconciliation
+        task.
+        """
+        raise osv.except_osv(
+                _('Error'),
+                _('There is no history of reconciled '
+                  'items on the task: %s.') % rec.name)
+
+    def last_history_reconcile(self, cr, uid, rec_id, context=None):
+        """ Get the last history record for this reconciliation profile
+        and return the action which opens move lines reconciled
+        """
+        if isinstance(rec_id, (tuple, list)):
+            assert len(rec_id) == 1, \
+                    "Only 1 id expected"
+            rec_id = rec_id[0]
+        rec = self.browse(cr, uid, rec_id, context=context)
+        if not rec.last_history:
+            self._no_history(cr, uid, rec, context=context)
+        return rec.last_history.open_reconcile()
+
+    def last_history_partial(self, cr, uid, rec_id, context=None):
+        """ Get the last history record for this reconciliation profile
+        and return the action which opens move lines reconciled
+        """
+        if isinstance(rec_id, (tuple, list)):
+            assert len(rec_id) == 1, \
+                    "Only 1 id expected"
+            rec_id = rec_id[0]
+        rec = self.browse(cr, uid, rec_id, context=context)
+        if not rec.last_history:
+            self._no_history(cr, uid, rec, context=context)
+        return rec.last_history.open_partial()

=== added file 'account_easy_reconcile/easy_reconcile.xml'
--- account_easy_reconcile/easy_reconcile.xml	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/easy_reconcile.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+<data>
+
+    <!-- account.easy.reconcile view -->
+    <record id="account_easy_reconcile_form" model="ir.ui.view">
+        <field name="name">account.easy.reconcile.form</field>
+        <field name="priority">20</field>
+        <field name="model">account.easy.reconcile</field>
+        <field name="arch" type="xml">
+            <form string="Automatic Easy Reconcile" version="7.0">
+                <header>
+                    <button name="run_reconcile" class="oe_highlight"
+                        string="Start Auto Reconciliation" type="object"/>
+                    <button icon="STOCK_JUMP_TO" name="last_history_reconcile"
+                        class="oe_highlight"
+                        string="Display items reconciled on the last run"
+                        type="object"/>
+                    <button icon="STOCK_JUMP_TO" name="last_history_partial"
+                        class="oe_highlight"
+                        string="Display items partially reconciled on the last run"
+                        type="object"/>
+                </header>
+                <sheet>
+                    <separator colspan="4" string="Profile Information" />
+                    <group>
+                        <group>
+                            <field name="name" select="1"/>
+                            <field name="account"/>
+                            <field name="company_id" groups="base.group_multi_company"/>
+                        </group>
+                        <group>
+                            <field name="unreconciled_count"/>
+                            <field name="reconciled_partial_count"/>
+                        </group>
+                    </group>
+                    <notebook colspan="4">
+                        <page name="methods" string="Configuration">
+                            <field name="reconcile_method" colspan = "4" nolabel="1"/>
+                        </page>
+                        <page name="history" string="History">
+                            <field name="history_ids" nolabel="1">
+                                <tree string="Automatic Easy Reconcile History">
+                                    <field name="date"/>
+                                    <button icon="STOCK_JUMP_TO" name="open_reconcile"
+                                        string="Go to reconciled items" type="object"/>
+                                    <button icon="STOCK_JUMP_TO" name="open_partial"
+                                        string="Go to partially reconciled items" type="object"/>
+                                </tree>
+                            </field>
+                        </page>
+                        <page name="information" string="Information">
+                          <separator colspan="4" string="Simple. Amount and Name"/>
+                          <label string="Match one debit line vs one credit line. Do not allow partial reconciliation.
+The lines should have the same amount (with the write-off) and the same name to be reconciled." colspan="4"/>
+
+                          <separator colspan="4" string="Simple. Amount and Partner"/>
+                          <label string="Match one debit line vs one credit line. Do not allow partial reconciliation.
+The lines should have the same amount (with the write-off) and the same partner to be reconciled." colspan="4"/>
+
+                          <separator colspan="4" string="Simple. Amount and Reference"/>
+                          <label string="Match one debit line vs one credit line. Do not allow partial reconciliation.
+The lines should have the same amount (with the write-off) and the same reference to be reconciled." colspan="4"/>
+
+                        </page>
+                    </notebook>
+                </sheet>
+            </form>
+        </field>
+    </record>
+
+    <record id="account_easy_reconcile_tree" model="ir.ui.view">
+        <field name="name">account.easy.reconcile.tree</field>
+        <field name="priority">20</field>
+        <field name="model">account.easy.reconcile</field>
+        <field name="arch" type="xml">
+            <tree string="Automatic Easy Reconcile">
+                <field name="name"/>
+                <field name="account"/>
+                <field name="company_id" groups="base.group_multi_company"/>
+                <field name="unreconciled_count"/>
+                <field name="reconciled_partial_count"/>
+                <button icon="gtk-ok" name="run_reconcile" colspan="4"
+                    string="Start Auto Reconcilation" type="object"/>
+                <button icon="STOCK_JUMP_TO" name="last_history_reconcile" colspan="2"
+                    string="Display items reconciled on the last run" type="object"/>
+                <button icon="STOCK_JUMP_TO" name="last_history_partial" colspan="2"
+                    string="Display items partially reconciled on the last run"
+                    type="object"/>
+            </tree>
+        </field>
+    </record>
+
+    <record id="action_account_easy_reconcile" model="ir.actions.act_window">
+        <field name="name">Easy Automatic Reconcile</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">account.easy.reconcile</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="help" type="html">
+          <p class="oe_view_nocontent_create">
+            Click to add a reconciliation profile.
+          </p><p>
+            A reconciliation profile specifies, for one account, how
+            the entries should be reconciled.
+            You can select one or many reconciliation methods which will
+            be run sequentially to match the entries between them.
+          </p>
+        </field>
+    </record>
+
+
+    <!-- account.easy.reconcile.method view -->
+
+    <record id="account_easy_reconcile_method_form" model="ir.ui.view">
+        <field name="name">account.easy.reconcile.method.form</field>
+        <field name="priority">20</field>
+        <field name="model">account.easy.reconcile.method</field>
+        <field name="arch" type="xml">
+            <form string="Automatic Easy Reconcile Method">
+                <field name="sequence"/>
+                <field name="name"/>
+                <field name="write_off"/>
+                <field name="account_lost_id" attrs="{'required':[('write_off','>',0)]}"/>
+                <field name="account_profit_id" attrs="{'required':[('write_off','>',0)]}"/>
+                <field name="journal_id" attrs="{'required':[('write_off','>',0)]}"/>
+                <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
+                <field name="date_base_on"/>
+            </form>
+        </field>
+    </record>
+
+    <record id="account_easy_reconcile_method_tree" model="ir.ui.view">
+        <field name="name">account.easy.reconcile.method.tree</field>
+        <field name="priority">20</field>
+        <field name="model">account.easy.reconcile.method</field>
+        <field name="arch" type="xml">
+            <tree editable="top" string="Automatic Easy Reconcile Method">
+                <field name="sequence"/>
+                <field name="name"/>
+                <field name="write_off"/>
+                <field name="account_lost_id" attrs="{'required':[('write_off','>',0)]}"/>
+                <field name="account_profit_id" attrs="{'required':[('write_off','>',0)]}"/>
+                <field name="journal_id" attrs="{'required':[('write_off','>',0)]}"/>
+                <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
+                <field name="date_base_on"/>
+            </tree>
+        </field>
+    </record>
+
+    <!-- menu item -->
+
+    <menuitem action="action_account_easy_reconcile"
+        id="menu_easy_reconcile"
+        parent="account.periodical_processing_reconciliation"/>
+
+</data>
+</openerp>

=== added file 'account_easy_reconcile/easy_reconcile_history.py'
--- account_easy_reconcile/easy_reconcile_history.py	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/easy_reconcile_history.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,153 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2012 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, fields
+from openerp.tools.translate import _
+
+
+class easy_reconcile_history(orm.Model):
+    """ Store an history of the runs per profile
+    Each history stores the list of reconciliations done"""
+
+    _name = 'easy.reconcile.history'
+    _rec_name = 'easy_reconcile_id'
+    _order = 'date DESC'
+
+    def _reconcile_line_ids(self, cr, uid, ids, name, args, context=None):
+        result = {}
+
+        for history in self.browse(cr, uid, ids, context=context):
+            result[history.id] = {}
+
+            move_line_ids = []
+            for reconcile in history.reconcile_ids:
+                move_line_ids += [line.id
+                                    for line
+                                    in reconcile.line_id]
+            result[history.id]['reconcile_line_ids'] = move_line_ids
+
+            move_line_ids = []
+            for reconcile in history.reconcile_partial_ids:
+                move_line_ids += [line.id
+                                    for line
+                                    in reconcile.line_partial_ids]
+            result[history.id]['partial_line_ids'] = move_line_ids
+
+        return result
+
+    _columns = {
+            'easy_reconcile_id': fields.many2one(
+                'account.easy.reconcile', 'Reconcile Profile', readonly=True),
+            'date': fields.datetime('Run date', readonly=True),
+            'reconcile_ids': fields.many2many(
+                'account.move.reconcile',
+                'account_move_reconcile_history_rel',
+                string='Reconciliations', readonly=True),
+            'reconcile_partial_ids': fields.many2many(
+                'account.move.reconcile',
+                'account_move_reconcile_history_partial_rel',
+                string='Partial Reconciliations', readonly=True),
+            'reconcile_line_ids':
+                fields.function(
+                    _reconcile_line_ids,
+                    string='Reconciled Items',
+                    type='many2many',
+                    relation='account.move.line',
+                    readonly=True,
+                    multi='lines'),
+            'partial_line_ids':
+                fields.function(
+                    _reconcile_line_ids,
+                    string='Partially Reconciled Items',
+                    type='many2many',
+                    relation='account.move.line',
+                    readonly=True,
+                    multi='lines'),
+            'company_id': fields.related('easy_reconcile_id','company_id',
+                                         relation='res.company',
+                                         type='many2one',
+                                         string='Company',
+                                         store=True,
+                                         readonly=True),
+
+        }
+
+    def _open_move_lines(self, cr, uid, history_id, rec_type='full', context=None):
+        """ For an history record, open the view of move line with
+        the reconciled or partially reconciled move lines
+
+        :param history_id: id of the history
+        :param rec_type: 'full' or 'partial'
+        :return: action to open the move lines
+        """
+        assert rec_type in ('full', 'partial'), \
+                "rec_type must be 'full' or 'partial'"
+
+        history = self.browse(cr, uid, history_id, context=context)
+
+        if rec_type == 'full':
+            field = 'reconcile_line_ids'
+            name = _('Reconciliations')
+        else:
+            field = 'partial_line_ids'
+            name = _('Partial Reconciliations')
+
+        move_line_ids = [line.id for line in getattr(history, field)]
+
+        return {
+            'name': name,
+            'view_mode': 'tree,form',
+            'view_id': False,
+            'view_type': 'form',
+            'res_model': 'account.move.line',
+            'type': 'ir.actions.act_window',
+            'nodestroy': True,
+            'target': 'current',
+            'domain': unicode([('id', 'in', move_line_ids)]),
+            }
+
+    def open_reconcile(self, cr, uid, history_ids, context=None):
+        """ For an history record, open the view of move line
+        with the reconciled move lines
+
+        :param history_ids: id of the record as int or long
+                            Accept a list with 1 id too to be
+                            used from the client.
+        """
+        if isinstance(history_ids, (tuple, list)):
+            assert len(history_ids) == 1, "only 1 ID is accepted"
+            history_ids = history_ids[0]
+        return self._open_move_lines(
+                cr, uid, history_ids, rec_type='full', context=None)
+
+    def open_partial(self, cr, uid, history_ids, context=None):
+        """ For an history record, open the view of move line
+        with the partially reconciled move lines
+
+        :param history_ids: id of the record as int or long
+                            Accept a list with 1 id too to be
+                            used from the client.
+        """
+        if isinstance(history_ids, (tuple, list)):
+            assert len(history_ids) == 1, "only 1 ID is accepted"
+            history_ids = history_ids[0]
+        return self._open_move_lines(
+                cr, uid, history_ids, rec_type='partial', context=None)

=== added file 'account_easy_reconcile/easy_reconcile_history_view.xml'
--- account_easy_reconcile/easy_reconcile_history_view.xml	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/easy_reconcile_history_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="0">
+
+    <record id="view_easy_reconcile_history_search" model="ir.ui.view">
+        <field name="name">easy.reconcile.history.search</field>
+        <field name="model">easy.reconcile.history</field>
+        <field name="arch" type="xml">
+            <search string="Automatic Easy Reconcile History">
+                <filter icon="terp-go-today" string="Today"
+                    domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('date','&gt;=', time.strftime('%%Y-%%m-%%d 00:00:00'))]"
+                    help="Todays' Reconcilations" />
+                <filter icon="terp-go-week" string="7 Days"
+                    help="Reconciliations of last 7 days"
+                    domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d 00:00:00'))]"
+                />
+
+                <separator orientation="vertical"/>
+                <field name="easy_reconcile_id"/>
+                <field name="date"/>
+
+                <newline/>
+                <group expand="0" string="Group By...">
+                    <filter string="Reconciliation Profile"
+                        icon="terp-stock_effects-object-colorize"
+                        domain="[]" context="{'group_by': 'easy_reconcile_id'}"/>
+                    <filter string="Date" icon="terp-go-month" domain="[]"
+                        context="{'group_by': 'date'}"/>
+                </group>
+            </search>
+        </field>
+    </record>
+
+    <record id="easy_reconcile_history_form" model="ir.ui.view">
+        <field name="name">easy.reconcile.history.form</field>
+        <field name="model">easy.reconcile.history</field>
+        <field name="arch" type="xml">
+            <form string="Automatic Easy Reconcile History" version="7.0">
+                <header>
+                    <button name="open_reconcile"
+                        string="Go to reconciled items"
+                        icon="STOCK_JUMP_TO" type="object"/>
+                    <button name="open_partial"
+                        string="Go to partially reconciled items"
+                        icon="STOCK_JUMP_TO" type="object"/>
+                </header>
+                <sheet>
+                    <group>
+                        <field name="easy_reconcile_id"/>
+                        <field name="date"/>
+                        <field name="company_id" groups="base.group_multi_company"/>
+                    </group>
+                    <group col="2">
+                        <separator colspan="2" string="Reconciliations"/>
+                        <field name="reconcile_ids" nolabel="1"/>
+                    </group>
+                    <group col="2">
+                        <separator colspan="2" string="Partial Reconciliations"/>
+                        <field name="reconcile_partial_ids" nolabel="1"/>
+                    </group>
+                </sheet>
+            </form>
+        </field>
+    </record>
+
+    <record id="easy_reconcile_history_tree" model="ir.ui.view">
+        <field name="name">easy.reconcile.history.tree</field>
+        <field name="model">easy.reconcile.history</field>
+        <field name="arch" type="xml">
+            <tree string="Automatic Easy Reconcile History">
+                <field name="easy_reconcile_id"/>
+                <field name="date"/>
+                <button icon="STOCK_JUMP_TO" name="open_reconcile"
+                    string="Go to reconciled items" type="object"/>
+                <button icon="STOCK_JUMP_TO" name="open_partial"
+                    string="Go to partially reconciled items" type="object"/>
+            </tree>
+        </field>
+    </record>
+
+    <record id="action_easy_reconcile_history" model="ir.actions.act_window">
+        <field name="name">Easy Automatic Reconcile History</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">easy.reconcile.history</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+    </record>
+
+    <act_window
+      context="{'search_default_easy_reconcile_id': [active_id], 'default_easy_reconcile_id': active_id}"
+      id="act_easy_reconcile_to_history"
+      name="History Details"
+      groups=""
+      res_model="easy.reconcile.history"
+      src_model="account.easy.reconcile"/>
+
+    </data>
+</openerp>

=== added directory 'account_easy_reconcile/i18n'
=== added file 'account_easy_reconcile/i18n/account_easy_reconcile.pot'
--- account_easy_reconcile/i18n/account_easy_reconcile.pot	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/i18n/account_easy_reconcile.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,406 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_easy_reconcile
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:55+0000\n"
+"PO-Revision-Date: 2014-01-21 11:55+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_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile_history.py:108
+#: view:easy.reconcile.history:0
+#: field:easy.reconcile.history,reconcile_ids:0
+#, python-format
+msgid "Reconciliations"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: view:easy.reconcile.history:0
+msgid "Automatic Easy Reconcile History"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Information"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: view:easy.reconcile.history:0
+msgid "Go to partially reconciled items"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: help:account.easy.reconcile.method,sequence:0
+msgid "The sequence field is used to order the reconcile method"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_history
+msgid "easy.reconcile.history"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,help:account_easy_reconcile.action_account_easy_reconcile
+msgid "<p class=\"oe_view_nocontent_create\">\n"
+"            Click to add a reconciliation profile.\n"
+"          </p><p>\n"
+"            A reconciliation profile specifies, for one account, how\n"
+"            the entries should be reconciled.\n"
+"            You can select one or many reconciliation methods which will\n"
+"            be run sequentially to match the entries between them.\n"
+"          </p>\n"
+"        "
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_options
+msgid "easy.reconcile.options"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Group By..."
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,unreconciled_count:0
+msgid "Unreconciled Items"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_base
+msgid "easy.reconcile.base"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.history,reconcile_line_ids:0
+msgid "Reconciled Items"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,reconcile_method:0
+msgid "Method"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "7 Days"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,name:account_easy_reconcile.action_easy_reconcile_history
+msgid "Easy Automatic Reconcile History"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.history,date:0
+msgid "Run date"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same reference to be reconciled."
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,name:account_easy_reconcile.act_easy_reconcile_to_history
+msgid "History Details"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Display items reconciled on the last run"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,name:0
+msgid "Type"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,company_id:0
+#: field:account.easy.reconcile.method,company_id:0
+#: field:easy.reconcile.history,company_id:0
+msgid "Company"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,account_profit_id:0
+#: field:easy.reconcile.base,account_profit_id:0
+#: field:easy.reconcile.options,account_profit_id:0
+#: field:easy.reconcile.simple,account_profit_id:0
+#: field:easy.reconcile.simple.name,account_profit_id:0
+#: field:easy.reconcile.simple.partner,account_profit_id:0
+#: field:easy.reconcile.simple.reference,account_profit_id:0
+msgid "Account Profit"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Todays' Reconcilations"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Simple. Amount and Name"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.base,partner_ids:0
+#: field:easy.reconcile.simple,partner_ids:0
+#: field:easy.reconcile.simple.name,partner_ids:0
+#: field:easy.reconcile.simple.partner,partner_ids:0
+#: field:easy.reconcile.simple.reference,partner_ids:0
+msgid "Restrict on partners"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,name:account_easy_reconcile.action_account_easy_reconcile
+#: model:ir.ui.menu,name:account_easy_reconcile.menu_easy_reconcile
+msgid "Easy Automatic Reconcile"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Today"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Date"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,last_history:0
+msgid "Last History"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Configuration"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,reconciled_partial_count:0
+#: field:easy.reconcile.history,partial_line_ids:0
+msgid "Partially Reconciled Items"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_partner
+msgid "easy.reconcile.simple.partner"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,write_off:0
+#: field:easy.reconcile.base,write_off:0
+#: field:easy.reconcile.options,write_off:0
+#: field:easy.reconcile.simple,write_off:0
+#: field:easy.reconcile.simple.name,write_off:0
+#: field:easy.reconcile.simple.partner,write_off:0
+#: field:easy.reconcile.simple.reference,write_off:0
+msgid "Write off allowed"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Automatic Easy Reconcile"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,account:0
+#: field:easy.reconcile.base,account_id:0
+#: field:easy.reconcile.simple,account_id:0
+#: field:easy.reconcile.simple.name,account_id:0
+#: field:easy.reconcile.simple.partner,account_id:0
+#: field:easy.reconcile.simple.reference,account_id:0
+msgid "Account"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,task_id:0
+msgid "Task"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,name:0
+msgid "Name"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Simple. Amount and Partner"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Start Auto Reconcilation"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_name
+msgid "easy.reconcile.simple.name"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,filter:0
+#: field:easy.reconcile.base,filter:0
+#: field:easy.reconcile.options,filter:0
+#: field:easy.reconcile.simple,filter:0
+#: field:easy.reconcile.simple.name,filter:0
+#: field:easy.reconcile.simple.partner,filter:0
+#: field:easy.reconcile.simple.reference,filter:0
+msgid "Filter"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same partner to be reconciled."
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.history,easy_reconcile_id:0
+msgid "Reconcile Profile"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_account_easy_reconcile_method
+msgid "reconcile method for account_easy_reconcile"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Start Auto Reconciliation"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile.py:257
+#, python-format
+msgid "Error"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile.py:258
+#, python-format
+msgid "There is no history of reconciled items on the task: %s."
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same name to be reconciled."
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,account_lost_id:0
+#: field:easy.reconcile.base,account_lost_id:0
+#: field:easy.reconcile.options,account_lost_id:0
+#: field:easy.reconcile.simple,account_lost_id:0
+#: field:easy.reconcile.simple.name,account_lost_id:0
+#: field:easy.reconcile.simple.partner,account_lost_id:0
+#: field:easy.reconcile.simple.reference,account_lost_id:0
+msgid "Account Lost"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Reconciliation Profile"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: field:account.easy.reconcile,history_ids:0
+msgid "History"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: view:easy.reconcile.history:0
+msgid "Go to reconciled items"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Profile Information"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile.method:0
+msgid "Automatic Easy Reconcile Method"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Simple. Amount and Reference"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Display items partially reconciled on the last run"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,sequence:0
+msgid "Sequence"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple
+msgid "easy.reconcile.simple"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Reconciliations of last 7 days"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,date_base_on:0
+#: field:easy.reconcile.base,date_base_on:0
+#: field:easy.reconcile.options,date_base_on:0
+#: field:easy.reconcile.simple,date_base_on:0
+#: field:easy.reconcile.simple.name,date_base_on:0
+#: field:easy.reconcile.simple.partner,date_base_on:0
+#: field:easy.reconcile.simple.reference,date_base_on:0
+msgid "Date of reconciliation"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile_history.py:111
+#: view:easy.reconcile.history:0
+#: field:easy.reconcile.history,reconcile_partial_ids:0
+#, python-format
+msgid "Partial Reconciliations"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,journal_id:0
+#: field:easy.reconcile.base,journal_id:0
+#: field:easy.reconcile.options,journal_id:0
+#: field:easy.reconcile.simple,journal_id:0
+#: field:easy.reconcile.simple.name,journal_id:0
+#: field:easy.reconcile.simple.partner,journal_id:0
+#: field:easy.reconcile.simple.reference,journal_id:0
+msgid "Journal"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_reference
+msgid "easy.reconcile.simple.reference"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_account_easy_reconcile
+msgid "account easy reconcile"
+msgstr ""
+

=== added file 'account_easy_reconcile/i18n/fr.po'
--- account_easy_reconcile/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/i18n/fr.po	2014-03-27 09:24:37 +0000
@@ -0,0 +1,432 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* account_easy_reconcile
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:55+0000\n"
+"PO-Revision-Date: 2014-03-21 15:25+0000\n"
+"Last-Translator: Guewen Baconnier @ Camptocamp <Unknown>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-03-22 07:11+0000\n"
+"X-Generator: Launchpad (build 16967)\n"
+"Language: \n"
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile_history.py:108
+#: view:easy.reconcile.history:0
+#: field:easy.reconcile.history,reconcile_ids:0
+#, python-format
+msgid "Reconciliations"
+msgstr "Lettrages"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: view:easy.reconcile.history:0
+msgid "Automatic Easy Reconcile History"
+msgstr "Historique des lettrages automatisés"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Information"
+msgstr "Information"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: view:easy.reconcile.history:0
+msgid "Go to partially reconciled items"
+msgstr "Voir les entrées partiellement lettrées"
+
+#. module: account_easy_reconcile
+#: help:account.easy.reconcile.method,sequence:0
+msgid "The sequence field is used to order the reconcile method"
+msgstr "La séquence détermine l'ordre des méthodes de lettrage"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_history
+msgid "easy.reconcile.history"
+msgstr "easy.reconcile.history"
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,help:account_easy_reconcile.action_account_easy_reconcile
+msgid ""
+"<p class=\"oe_view_nocontent_create\">\n"
+"            Click to add a reconciliation profile.\n"
+"          </p><p>\n"
+"            A reconciliation profile specifies, for one account, how\n"
+"            the entries should be reconciled.\n"
+"            You can select one or many reconciliation methods which will\n"
+"            be run sequentially to match the entries between them.\n"
+"          </p>\n"
+"        "
+msgstr ""
+"<p class=\"oe_view_nocontent_create\">\n"
+"            Cliquez pour ajouter un profil de lettrage.\n"
+"          </p><p>\n"
+"            Un profil de lettrage spécifie, pour un compte, comment\n"
+"            les écritures doivent être lettrées.\n"
+"            Vous pouvez sélectionner une ou plusieurs méthodes de lettrage\n"
+"            qui seront lancées successivement pour identifier les écritures\n"
+"            devant être lettrées.          </p>\n"
+"        "
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_options
+msgid "easy.reconcile.options"
+msgstr "easy.reconcile.options"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Group By..."
+msgstr "Grouper par..."
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,unreconciled_count:0
+msgid "Unreconciled Items"
+msgstr "Écritures non lettrées"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_base
+msgid "easy.reconcile.base"
+msgstr "easy.reconcile.base"
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.history,reconcile_line_ids:0
+msgid "Reconciled Items"
+msgstr "Écritures lettrées"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,reconcile_method:0
+msgid "Method"
+msgstr "Méthode"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "7 Days"
+msgstr "7 jours"
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,name:account_easy_reconcile.action_easy_reconcile_history
+msgid "Easy Automatic Reconcile History"
+msgstr "Lettrage automatisé"
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.history,date:0
+msgid "Run date"
+msgstr "Date de lancement"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid ""
+"Match one debit line vs one credit line. Do not allow partial "
+"reconciliation. The lines should have the same amount (with the write-off) "
+"and the same reference to be reconciled."
+msgstr ""
+"Lettre un débit avec un crédit ayant le même montant et la même référence. "
+"Le lettrage ne peut être partiel (écriture d'ajustement en cas d'écart)."
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,name:account_easy_reconcile.act_easy_reconcile_to_history
+msgid "History Details"
+msgstr "Détails de l'historique"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Display items reconciled on the last run"
+msgstr "Voir les entrées lettrées au dernier lettrage"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,name:0
+msgid "Type"
+msgstr "Type"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,company_id:0
+#: field:account.easy.reconcile.method,company_id:0
+#: field:easy.reconcile.history,company_id:0
+msgid "Company"
+msgstr ""
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,account_profit_id:0
+#: field:easy.reconcile.base,account_profit_id:0
+#: field:easy.reconcile.options,account_profit_id:0
+#: field:easy.reconcile.simple,account_profit_id:0
+#: field:easy.reconcile.simple.name,account_profit_id:0
+#: field:easy.reconcile.simple.partner,account_profit_id:0
+#: field:easy.reconcile.simple.reference,account_profit_id:0
+msgid "Account Profit"
+msgstr "Compte de profits"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Todays' Reconcilations"
+msgstr "Lettrages du jour"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Simple. Amount and Name"
+msgstr "Simple. Montant et description"
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.base,partner_ids:0
+#: field:easy.reconcile.simple,partner_ids:0
+#: field:easy.reconcile.simple.name,partner_ids:0
+#: field:easy.reconcile.simple.partner,partner_ids:0
+#: field:easy.reconcile.simple.reference,partner_ids:0
+msgid "Restrict on partners"
+msgstr "Filtrer sur des partenaires"
+
+#. module: account_easy_reconcile
+#: model:ir.actions.act_window,name:account_easy_reconcile.action_account_easy_reconcile
+#: model:ir.ui.menu,name:account_easy_reconcile.menu_easy_reconcile
+msgid "Easy Automatic Reconcile"
+msgstr "Lettrage automatisé"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Today"
+msgstr "Aujourd'hui"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Date"
+msgstr "Date"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,last_history:0
+msgid "Last History"
+msgstr "Dernier historique"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Configuration"
+msgstr "Configuration"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,reconciled_partial_count:0
+#: field:easy.reconcile.history,partial_line_ids:0
+msgid "Partially Reconciled Items"
+msgstr "Écritures partiellement lettrées"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_partner
+msgid "easy.reconcile.simple.partner"
+msgstr "easy.reconcile.simple.partner"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,write_off:0
+#: field:easy.reconcile.base,write_off:0
+#: field:easy.reconcile.options,write_off:0
+#: field:easy.reconcile.simple,write_off:0
+#: field:easy.reconcile.simple.name,write_off:0
+#: field:easy.reconcile.simple.partner,write_off:0
+#: field:easy.reconcile.simple.reference,write_off:0
+msgid "Write off allowed"
+msgstr "Écart autorisé"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Automatic Easy Reconcile"
+msgstr "Lettrage automatisé"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,account:0
+#: field:easy.reconcile.base,account_id:0
+#: field:easy.reconcile.simple,account_id:0
+#: field:easy.reconcile.simple.name,account_id:0
+#: field:easy.reconcile.simple.partner,account_id:0
+#: field:easy.reconcile.simple.reference,account_id:0
+msgid "Account"
+msgstr "Compte"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,task_id:0
+msgid "Task"
+msgstr "Tâche"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile,name:0
+msgid "Name"
+msgstr "Nom"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Simple. Amount and Partner"
+msgstr "Simple. Montant et partenaire"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Start Auto Reconcilation"
+msgstr "Lancer le lettrage automatisé"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_name
+msgid "easy.reconcile.simple.name"
+msgstr "easy.reconcile.simple.name"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,filter:0
+#: field:easy.reconcile.base,filter:0
+#: field:easy.reconcile.options,filter:0
+#: field:easy.reconcile.simple,filter:0
+#: field:easy.reconcile.simple.name,filter:0
+#: field:easy.reconcile.simple.partner,filter:0
+#: field:easy.reconcile.simple.reference,filter:0
+msgid "Filter"
+msgstr "Filtre"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid ""
+"Match one debit line vs one credit line. Do not allow partial "
+"reconciliation. The lines should have the same amount (with the write-off) "
+"and the same partner to be reconciled."
+msgstr ""
+"Lettre un débit avec un crédit ayant le même montant et le même partenaire. "
+"Le lettrage ne peut être partiel (écriture d'ajustement en cas d'écart)."
+
+#. module: account_easy_reconcile
+#: field:easy.reconcile.history,easy_reconcile_id:0
+msgid "Reconcile Profile"
+msgstr "Profil de réconciliation"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_account_easy_reconcile_method
+msgid "reconcile method for account_easy_reconcile"
+msgstr "Méthode de lettrage"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Start Auto Reconciliation"
+msgstr "Lancer le lettrage automatisé"
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile.py:257
+#, python-format
+msgid "Error"
+msgstr "Erreur"
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile.py:258
+#, python-format
+msgid "There is no history of reconciled items on the task: %s."
+msgstr "Il n'y a pas d'historique d'écritures lettrées sur la tâche: %s."
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid ""
+"Match one debit line vs one credit line. Do not allow partial "
+"reconciliation. The lines should have the same amount (with the write-off) "
+"and the same name to be reconciled."
+msgstr ""
+"Lettre un débit avec un crédit ayant le même montant et la même description. "
+"Le lettrage ne peut être partiel (écriture d'ajustement en cas d'écart)."
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,account_lost_id:0
+#: field:easy.reconcile.base,account_lost_id:0
+#: field:easy.reconcile.options,account_lost_id:0
+#: field:easy.reconcile.simple,account_lost_id:0
+#: field:easy.reconcile.simple.name,account_lost_id:0
+#: field:easy.reconcile.simple.partner,account_lost_id:0
+#: field:easy.reconcile.simple.reference,account_lost_id:0
+msgid "Account Lost"
+msgstr "Compte de pertes"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Reconciliation Profile"
+msgstr "Profil de réconciliation"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: field:account.easy.reconcile,history_ids:0
+msgid "History"
+msgstr "Historique"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+#: view:easy.reconcile.history:0
+msgid "Go to reconciled items"
+msgstr "Voir les entrées lettrées"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Profile Information"
+msgstr "Information sur le profil"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile.method:0
+msgid "Automatic Easy Reconcile Method"
+msgstr "Méthode de lettrage automatisé"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Simple. Amount and Reference"
+msgstr "Simple. Montant et référence"
+
+#. module: account_easy_reconcile
+#: view:account.easy.reconcile:0
+msgid "Display items partially reconciled on the last run"
+msgstr "Afficher les entrées partiellement lettrées au dernier lettrage"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,sequence:0
+msgid "Sequence"
+msgstr "Séquence"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple
+msgid "easy.reconcile.simple"
+msgstr "easy.reconcile.simple"
+
+#. module: account_easy_reconcile
+#: view:easy.reconcile.history:0
+msgid "Reconciliations of last 7 days"
+msgstr "Lettrages des 7 derniers jours"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,date_base_on:0
+#: field:easy.reconcile.base,date_base_on:0
+#: field:easy.reconcile.options,date_base_on:0
+#: field:easy.reconcile.simple,date_base_on:0
+#: field:easy.reconcile.simple.name,date_base_on:0
+#: field:easy.reconcile.simple.partner,date_base_on:0
+#: field:easy.reconcile.simple.reference,date_base_on:0
+msgid "Date of reconciliation"
+msgstr "Date de lettrage"
+
+#. module: account_easy_reconcile
+#: code:addons/account_easy_reconcile/easy_reconcile_history.py:111
+#: view:easy.reconcile.history:0
+#: field:easy.reconcile.history,reconcile_partial_ids:0
+#, python-format
+msgid "Partial Reconciliations"
+msgstr "Lettrages partiels"
+
+#. module: account_easy_reconcile
+#: field:account.easy.reconcile.method,journal_id:0
+#: field:easy.reconcile.base,journal_id:0
+#: field:easy.reconcile.options,journal_id:0
+#: field:easy.reconcile.simple,journal_id:0
+#: field:easy.reconcile.simple.name,journal_id:0
+#: field:easy.reconcile.simple.partner,journal_id:0
+#: field:easy.reconcile.simple.reference,journal_id:0
+msgid "Journal"
+msgstr "Journal"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_reference
+msgid "easy.reconcile.simple.reference"
+msgstr "easy.reconcile.simple.reference"
+
+#. module: account_easy_reconcile
+#: model:ir.model,name:account_easy_reconcile.model_account_easy_reconcile
+msgid "account easy reconcile"
+msgstr "Lettrage automatisé"

=== added directory 'account_easy_reconcile/security'
=== added file 'account_easy_reconcile/security/ir.model.access.csv'
--- account_easy_reconcile/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/security/ir.model.access.csv	2014-03-27 09:24:37 +0000
@@ -0,0 +1,15 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_easy_reconcile_options_acc_user,easy.reconcile.options,model_easy_reconcile_options,account.group_account_user,1,0,0,0
+access_account_easy_reconcile_method_acc_user,account.easy.reconcile.method,model_account_easy_reconcile_method,account.group_account_user,1,0,0,0
+access_account_easy_reconcile_acc_user,account.easy.reconcile,model_account_easy_reconcile,account.group_account_user,1,1,0,0
+access_easy_reconcile_simple_name_acc_user,easy.reconcile.simple.name,model_easy_reconcile_simple_name,account.group_account_user,1,0,0,0
+access_easy_reconcile_simple_partner_acc_user,easy.reconcile.simple.partner,model_easy_reconcile_simple_partner,account.group_account_user,1,0,0,0
+access_easy_reconcile_simple_reference_acc_user,easy.reconcile.simple.reference,model_easy_reconcile_simple_reference,account.group_account_user,1,0,0,0
+access_easy_reconcile_options_acc_mgr,easy.reconcile.options,model_easy_reconcile_options,account.group_account_user,1,0,0,0
+access_account_easy_reconcile_method_acc_mgr,account.easy.reconcile.method,model_account_easy_reconcile_method,account.group_account_user,1,1,1,1
+access_account_easy_reconcile_acc_mgr,account.easy.reconcile,model_account_easy_reconcile,account.group_account_user,1,1,1,1
+access_easy_reconcile_simple_name_acc_mgr,easy.reconcile.simple.name,model_easy_reconcile_simple_name,account.group_account_user,1,0,0,0
+access_easy_reconcile_simple_partner_acc_mgr,easy.reconcile.simple.partner,model_easy_reconcile_simple_partner,account.group_account_user,1,0,0,0
+access_easy_reconcile_simple_reference_acc_mgr,easy.reconcile.simple.reference,model_easy_reconcile_simple_reference,account.group_account_user,1,0,0,0
+access_easy_reconcile_history_acc_user,easy.reconcile.history,model_easy_reconcile_history,account.group_account_user,1,1,1,0
+access_easy_reconcile_history_acc_mgr,easy.reconcile.history,model_easy_reconcile_history,account.group_account_manager,1,1,1,1

=== added file 'account_easy_reconcile/security/ir_rule.xml'
--- account_easy_reconcile/security/ir_rule.xml	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/security/ir_rule.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data noupdate="1">
+    <record id="easy_reconcile_rule" model="ir.rule">
+      <field name="name">Easy reconcile multi-company</field>
+      <field name="model_id" ref="model_account_easy_reconcile"/>
+      <field name="global" eval="True"/>
+      <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
+    </record>
+
+    <record id="easy_reconcile_history_rule" model="ir.rule">
+      <field name="name">Easy reconcile history multi-company</field>
+      <field name="model_id" ref="model_easy_reconcile_history"/>
+      <field name="global" eval="True"/>
+      <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
+    </record>
+
+    <record id="easy_reconcile_method_rule" model="ir.rule">
+      <field name="name">Easy reconcile method multi-company</field>
+      <field name="model_id" ref="model_account_easy_reconcile_method"/>
+      <field name="global" eval="True"/>
+      <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
+    </record>
+  </data>
+</openerp>

=== added file 'account_easy_reconcile/simple_reconciliation.py'
--- account_easy_reconcile/simple_reconciliation.py	1970-01-01 00:00:00 +0000
+++ account_easy_reconcile/simple_reconciliation.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,120 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright 2012-2013 Camptocamp SA (Guewen Baconnier)
+#    Copyright (C) 2010   Sébastien Beau
+#
+#    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 AbstractModel, TransientModel
+
+
+class easy_reconcile_simple(AbstractModel):
+
+    _name = 'easy.reconcile.simple'
+    _inherit = 'easy.reconcile.base'
+
+    # has to be subclassed
+    # field name used as key for matching the move lines
+    _key_field = None
+
+    def rec_auto_lines_simple(self, cr, uid, rec, lines, context=None):
+        if context is None:
+            context = {}
+
+        if self._key_field is None:
+            raise ValueError("_key_field has to be defined")
+
+        count = 0
+        res = []
+        while (count < len(lines)):
+            for i in xrange(count+1, len(lines)):
+                writeoff_account_id = False
+                if lines[count][self._key_field] != lines[i][self._key_field]:
+                    break
+
+                check = False
+                if lines[count]['credit'] > 0 and lines[i]['debit'] > 0:
+                    credit_line = lines[count]
+                    debit_line = lines[i]
+                    check = True
+                elif lines[i]['credit'] > 0  and lines[count]['debit'] > 0:
+                    credit_line = lines[i]
+                    debit_line = lines[count]
+                    check = True
+                if not check:
+                    continue
+
+                reconciled, dummy = self._reconcile_lines(
+                    cr, uid, rec, [credit_line, debit_line],
+                    allow_partial=False, context=context)
+                if reconciled:
+                    res += [credit_line['id'], debit_line['id']]
+                    del lines[i]
+                    break
+            count += 1
+        return res, []  # empty list for partial, only full rec in "simple" rec
+
+    def _simple_order(self, rec, *args, **kwargs):
+        return "ORDER BY account_move_line.%s" % self._key_field
+
+    def _action_rec(self, cr, uid, rec, context=None):
+        """Match only 2 move lines, do not allow partial reconcile"""
+        select = self._select(rec)
+        select += ", account_move_line.%s " % self._key_field
+        where, params = self._where(rec)
+        where += " AND account_move_line.%s IS NOT NULL " % self._key_field
+
+        where2, params2 = self._get_filter(cr, uid, rec, context=context)
+        query = ' '.join((
+            select,
+            self._from(rec),
+            where, where2,
+            self._simple_order(rec)))
+
+        cr.execute(query, params + params2)
+        lines = cr.dictfetchall()
+        return self.rec_auto_lines_simple(cr, uid, rec, lines, context)
+
+
+class easy_reconcile_simple_name(TransientModel):
+
+    _name = 'easy.reconcile.simple.name'
+    _inherit = 'easy.reconcile.simple'
+
+    # has to be subclassed
+    # field name used as key for matching the move lines
+    _key_field = 'name'
+
+
+class easy_reconcile_simple_partner(TransientModel):
+
+    _name = 'easy.reconcile.simple.partner'
+    _inherit = 'easy.reconcile.simple'
+
+    # has to be subclassed
+    # field name used as key for matching the move lines
+    _key_field = 'partner_id'
+
+
+class easy_reconcile_simple_reference(TransientModel):
+
+    _name = 'easy.reconcile.simple.reference'
+    _inherit = 'easy.reconcile.simple'
+
+    # has to be subclassed
+    # field name used as key for matching the move lines
+    _key_field = 'ref'

=== added directory 'account_statement_bankaccount_completion'
=== added file 'account_statement_bankaccount_completion/__init__.py'
--- account_statement_bankaccount_completion/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+#
+#
+#    Author: Laurent Mignon
+#    Copyright 2013 'ACSONE SA/NV'
+#
+#    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/>.
+#
+#
+import statement

=== added file 'account_statement_bankaccount_completion/__openerp__.py'
--- account_statement_bankaccount_completion/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+#
+#
+#    Author: Laurent Mignon
+#    Copyright 2013 'ACSONE SA/NV'
+#
+#    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': "Bank statement completion from bank account number",
+ 'version': '1.0.1',
+ 'author': 'ACSONE SA/NV',
+ 'maintainer': 'ACSONE SA/NV',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': [
+     'account_statement_base_completion',
+ ],
+ 'description': """
+  Add a completion method based on the partner bank account number
+  provided by the bank/office.
+
+  Completion will look in the partner with that bank account number
+  to match the partner, then it will fill in the bank statement line
+  with it to ease the reconciliation.
+
+ """,
+ 'website': 'http://www.acsone.eu',
+ 'data': [
+     "data.xml",
+ ],
+ 'demo': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ }

=== added file 'account_statement_bankaccount_completion/data.xml'
--- account_statement_bankaccount_completion/data.xml	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/data.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="1">
+
+    <record id="bank_statement_completion_rule_10" model="account.statement.completion.rule">
+         <field name="name">Match from bank account number (Normal or IBAN))</field>
+         <field name="sequence">10</field>
+         <field name="function_to_call">get_from_bank_account</field>
+     </record>
+    
+</data>
+</openerp>

=== added directory 'account_statement_bankaccount_completion/i18n'
=== added file 'account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot'
--- account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,43 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_bankaccount_completion
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:57+0000\n"
+"PO-Revision-Date: 2014-01-21 11:57+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_statement_bankaccount_completion
+#: help:account.bank.statement.line,partner_acc_number:0
+msgid "Account number of the partner"
+msgstr ""
+
+#. module: account_statement_bankaccount_completion
+#: model:ir.model,name:account_statement_bankaccount_completion.model_account_bank_statement_line
+msgid "Bank Statement Line"
+msgstr ""
+
+#. module: account_statement_bankaccount_completion
+#: code:addons/account_statement_bankaccount_completion/statement.py:68
+#, python-format
+msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner for account number \"%s\"."
+msgstr ""
+
+#. module: account_statement_bankaccount_completion
+#: field:account.bank.statement.line,partner_acc_number:0
+msgid "Account Number"
+msgstr ""
+
+#. module: account_statement_bankaccount_completion
+#: model:ir.model,name:account_statement_bankaccount_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr ""
+

=== added file 'account_statement_bankaccount_completion/statement.py'
--- account_statement_bankaccount_completion/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,96 @@
+# -*- coding: utf-8 -*-
+#
+#
+#    Author: Laurent Mignon
+#    Copyright 2013 'ACSONE SA/NV'
+#
+#    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.tools.translate import _
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.addons.account_statement_base_completion.statement import ErrorTooManyPartner
+
+
+class AccountStatementCompletionRule(Model):
+    """Add a rule based on transaction ID"""
+
+    _inherit = "account.statement.completion.rule"
+
+    def _get_functions(self, cr, uid, context=None):
+        res = super(AccountStatementCompletionRule, self)._get_functions(
+            cr, uid, context=context)
+        res.append(('get_from_bank_account',
+                    'From bank account number (Normal or IBAN)'))
+        return res
+
+    _columns = {
+        'function_to_call': fields.selection(_get_functions, 'Method'),
+    }
+
+    def get_from_bank_account(self, cr, uid, st_line, context=None):
+        """
+        Match the partner based on the partner account number field
+        Then, call the generic st_line method to complete other values.
+        :param dict st_line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id' : value,
+            ...}
+        """
+        partner_acc_number = st_line['partner_acc_number']
+        if not partner_acc_number:
+            return {}
+        st_obj = self.pool.get('account.bank.statement.line')
+        res = {}
+        res_bank_obj = self.pool.get('res.partner.bank')
+        ids = res_bank_obj.search(cr,
+                                  uid,
+                                  [('acc_number', '=', partner_acc_number)],
+                                  context=context)
+        if len(ids) > 1:
+            raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more than '
+                                        'one partner for account number "%s".') % (st_line['name'], st_line['ref'], partner_acc_number))
+        if len(ids) == 1:
+            partner = res_bank_obj.browse(cr, uid, ids[0], context=context).partner_id
+            res['partner_id'] = partner.id
+            st_vals = st_obj.get_values_for_line(cr,
+                                                 uid,
+                                                 profile_id=st_line['profile_id'],
+                                                 master_account_id=st_line['master_account_id'],
+                                                 partner_id=res.get('partner_id', False),
+                                                 line_type=st_line['type'],
+                                                 amount=st_line['amount'] if st_line['amount'] else 0.0,
+                                                 context=context)
+            res.update(st_vals)
+        return res
+
+
+class AccountStatementLine(Model):
+    _inherit = "account.bank.statement.line"
+
+    _columns = {
+        # 'additional_bank_fields' : fields.serialized('Additional infos from bank', help="Used by completion and import system."),
+        'partner_acc_number': fields.sparse(
+            type='char',
+            string='Account Number',
+            size=64,
+            serialization_field='additionnal_bank_fields',
+            help="Account number of the partner"),
+    }

=== added directory 'account_statement_bankaccount_completion/tests'
=== added file 'account_statement_bankaccount_completion/tests/__init__.py'
--- account_statement_bankaccount_completion/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/tests/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+#
+#
+# Authors: Laurent Mignon
+# Copyright (c) 2013 Acsone SA/NV (http://www.acsone.eu)
+# All Rights Reserved
+#
+# 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 test_bankaccount_completion
+
+checks = [
+    test_bankaccount_completion
+]

=== added file 'account_statement_bankaccount_completion/tests/test_bankaccount_completion.py'
--- account_statement_bankaccount_completion/tests/test_bankaccount_completion.py	1970-01-01 00:00:00 +0000
+++ account_statement_bankaccount_completion/tests/test_bankaccount_completion.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+#
+#
+# Authors: Laurent Mignon
+# Copyright (c) 2013 Acsone SA/NV (http://www.acsone.eu)
+# All Rights Reserved
+#
+# 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.tests import common
+import time
+
+ACC_NUMBER = "BE38733040385372"
+
+
+class bankaccount_completion(common.TransactionCase):
+
+    def prepare(self):
+        self.company_a = self.browse_ref('base.main_company')
+        self.profile_obj = self.registry("account.statement.profile")
+        self.account_bank_statement_obj = self.registry("account.bank.statement")
+        self.account_bank_statement_line_obj = self.registry("account.bank.statement.line")
+        self.completion_rule_id = self.ref('account_statement_bankaccount_completion.bank_statement_completion_rule_10')
+        self.journal_id = self.registry("ir.model.data").get_object_reference(self.cr, self. uid, "account", "bank_journal")[1]
+        self.partner_id = self.ref('base.main_partner')
+        # Create the profile
+        self.account_id = self.registry("ir.model.data").get_object_reference(self.cr, self.uid, "account", "a_recv")[1]
+        self.journal_id = self.registry("ir.model.data").get_object_reference(self.cr, self. uid, "account", "bank_journal")[1]
+        self.profile_id = self.profile_obj.create(self.cr, self.uid, {
+            "name": "TEST",
+            "commission_account_id": self.account_id,
+            "journal_id": self.journal_id,
+            "rule_ids": [(6, 0, [self.completion_rule_id])]})
+        # Create the completion rule
+
+        # Create a bank statement
+        self.statement_id = self.account_bank_statement_obj.create(self.cr, self.uid, {
+            "balance_end_real": 0.0,
+            "balance_start": 0.0,
+            "date": time.strftime('%Y-%m-%d'),
+            "journal_id": self.journal_id,
+            "profile_id": self.profile_id
+
+        })
+
+        # Create bank a statement line
+        self.statement_line_id = self.account_bank_statement_line_obj.create(self.cr, self.uid, {
+            'amount': 1000.0,
+            'name': 'EXT001',
+            'ref': 'My ref',
+            'statement_id': self.statement_id,
+            'partner_acc_number': ACC_NUMBER
+        })
+
+        # Add a bank account number to the partner
+        res_bank_obj = self.registry('res.partner.bank')
+        res_bank_obj.create(self.cr, self.uid, {
+                            "state": "bank",
+                            "company_id": self.company_a.id,
+                            "partner_id": self.partner_id,
+                            "acc_number": ACC_NUMBER,
+                            "footer": True,
+                            "bank_name": "Reserve"
+                            })
+
+    def test_00(self):
+        """Test complete partner_id from bank account number
+        
+        Test the automatic completion of the partner_id based on the account number associated to the
+        statement line
+        """
+        self.prepare()
+        statement_line = self.account_bank_statement_line_obj.browse(self.cr, self.uid, self.statement_line_id)
+        # before import, the
+        self.assertFalse(statement_line.partner_id, "Partner_id must be blank before completion")
+        statement_obj = self.account_bank_statement_obj.browse(self.cr, self.uid, self.statement_id)
+        statement_obj.button_auto_completion()
+        statement_line = self.account_bank_statement_line_obj.browse(self.cr, self.uid, self.statement_line_id)
+        self.assertEquals(self.partner_id, statement_line.partner_id['id'], "Missing expected partner id after completion")

=== added directory 'account_statement_base_completion'
=== added file 'account_statement_base_completion/__init__.py'
--- account_statement_base_completion/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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 partner
+from . import statement

=== added file 'account_statement_base_completion/__openerp__.py'
--- account_statement_base_completion/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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': "Bank statement base completion",
+ 'version': '1.0.1',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': ['account_statement_ext'],
+ 'description': """
+ The goal of this module is to improve the basic bank statement, help dealing with huge volume of
+ reconciliation by providing basic rules to identify the partner of a bank statement line.
+ Each bank statement profile can have its own rules to be applied according to a sequence order.
+
+ Some basic rules are provided in this module:
+
+ 1) Match from statement line label (based on partner field 'Bank Statement Label')
+ 2) Match from statement line label (based on partner name)
+ 3) Match from statement line reference (based on Invoice number)
+
+ You can easily override this module and add your own rules in your own one. The basic rules only
+ fill in  the partner, but you can use them to fill in any value of the line (in the future, we will
+ add a rule to automatically match and reconcile the line).
+
+ It adds as well a label on the bank statement line (on which the pre-define rules can match) and
+ a char field on the partner called 'Bank Statement Label'. Using the pre-define rules, you will be
+ able to match various labels for a partner.
+
+ The reference of the line is always used by the reconciliation process. We're supposed to copy
+ there (or write manually) the matching string. This can be: the order Number or an invoice number,
+ or anything that will be found in the invoice accounting entry part to make the match.
+
+ You can use it with  our account_advanced_reconcile module to automatize the reconciliation process.
+
+
+ TODO: The rules that look for invoices to find out the partner should take back the payable / receivable
+       account from there directly instead of retrieving it from partner properties !
+
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'data': [
+     'statement_view.xml',
+     'partner_view.xml',
+     'data.xml',
+     'security/ir.model.access.csv',
+ ],
+ 'demo': [],
+ 'test': [
+    'test/partner.yml',
+    'test/invoice.yml',
+    'test/supplier_invoice.yml',
+    'test/completion_test.yml'
+ ],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+}

=== added file 'account_statement_base_completion/data.xml'
--- account_statement_base_completion/data.xml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/data.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="1">
+
+     <record id="bank_statement_completion_rule_2" model="account.statement.completion.rule">
+          <field name="name">Match from line label (based on partner field 'Bank Statement Label')</field>
+          <field name="sequence">60</field>
+          <field name="function_to_call">get_from_label_and_partner_field</field>
+      </record>
+
+    <record id="bank_statement_completion_rule_3" model="account.statement.completion.rule">
+         <field name="name">Match from line label (based on partner name)</field>
+         <field name="sequence">70</field>
+         <field name="function_to_call">get_from_label_and_partner_name</field>
+     </record>
+
+     <record id="bank_statement_completion_rule_4" model="account.statement.completion.rule">
+          <field name="name">Match from line reference (based on Invoice number)</field>
+          <field name="sequence">40</field>
+          <field name="function_to_call">get_from_ref_and_invoice</field>
+      </record>
+
+     <record id="bank_statement_completion_rule_5" model="account.statement.completion.rule">
+          <field name="name">Match from line reference (based on Invoice Supplier number)</field>
+          <field name="sequence">45</field>
+          <field name="function_to_call">get_from_ref_and_supplier_invoice</field>
+      </record>
+
+
+</data>
+</openerp>

=== added directory 'account_statement_base_completion/i18n'
=== added file 'account_statement_base_completion/i18n/account_statement_base_completion.pot'
--- account_statement_base_completion/i18n/account_statement_base_completion.pot	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/i18n/account_statement_base_completion.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,199 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_base_completion
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:57+0000\n"
+"PO-Revision-Date: 2014-01-21 11:57+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_statement_base_completion
+#: view:account.statement.completion.rule:0
+msgid "Related Profiles"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.bank.statement.line,label:0
+msgid "Generic field to store a label given from the bank/office on which we can base the default/standard providen rule."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:169
+#, python-format
+msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on %s invoices"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement,completion_logs:0
+msgid "Completion Log"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement.line,label:0
+msgid "Label"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement
+msgid "Bank Statement"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,function_to_call:0
+msgid "Method"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:326
+#, python-format
+msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on partner by name"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:504
+#, python-format
+msgid "Statement ID %s auto-completed for %s lines completed"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:500
+#, python-format
+msgid "%s Bank Statement ID %s has %s lines completed by %s \n"
+"%s\n"
+"%s\n"
+""
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line
+msgid "Bank Statement Line"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement.line,additionnal_bank_fields:0
+msgid "Additionnal infos from bank"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.statement.profile:0
+msgid "Auto-Completion Rules"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.bank.statement:0
+msgid "Importation related infos"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:159
+#: code:addons/account_statement_base_completion/statement.py:179
+#, python-format
+msgid "Invalid invoice type for completion: %"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,name:0
+msgid "Name"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.bank.statement:0
+msgid "Auto Completion"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.statement.completion.rule:0
+#: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree
+#: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu
+msgid "Statement Completion Rule"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.bank.statement.line,additionnal_bank_fields:0
+msgid "Used by completion and import system. Adds every field that is present in your bank/office statement file"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,profile_ids:0
+#: field:account.statement.profile,rule_ids:0
+msgid "Related statement profiles"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:158
+#: code:addons/account_statement_base_completion/statement.py:178
+#, python-format
+msgid "System error"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement.line,already_completed:0
+msgid "Auto-Completed"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:448
+#: code:addons/account_statement_base_completion/statement.py:466
+#, python-format
+msgid "ORM bypass error"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,sequence:0
+msgid "Sequence"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:280
+#, python-format
+msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on partner label: %s"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.statement.completion.rule,sequence:0
+msgid "Lower means parsed first."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:res.partner,bank_statement_label:0
+msgid "Bank Statement Label"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.bank.statement.line,already_completed:0
+msgid "When this checkbox is ticked, the auto-completion process/button will ignore this line."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:res.partner,bank_statement_label:0
+msgid "Enter the various label found on your bank statement separated by a ; If                  one of this label is include in the bank statement line, the partner will be automatically                  filled (as long as you use this method/rules in your statement profile)."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.bank.statement:0
+msgid "Completion Logs"
+msgstr ""
+

=== added file 'account_statement_base_completion/i18n/fr.po'
--- account_statement_base_completion/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/i18n/fr.po	2014-03-27 09:24:37 +0000
@@ -0,0 +1,216 @@
+# French translation for banking-addons
+# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
+# This file is distributed under the same license as the banking-addons package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: banking-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
+"POT-Creation-Date: 2014-01-21 11:57+0000\n"
+"PO-Revision-Date: 2014-03-21 15:17+0000\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: French <fr@xxxxxx>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-03-22 07:11+0000\n"
+"X-Generator: Launchpad (build 16967)\n"
+
+#. module: account_statement_base_completion
+#: view:account.statement.completion.rule:0
+msgid "Related Profiles"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.bank.statement.line,label:0
+msgid ""
+"Generic field to store a label given from the bank/office on which we can "
+"base the default/standard providen rule."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:169
+#, python-format
+msgid ""
+"Line named \"%s\" (Ref:%s) was matched by more than one partner while "
+"looking on %s invoices"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement,completion_logs:0
+msgid "Completion Log"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement.line,label:0
+msgid "Label"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement
+msgid "Bank Statement"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,function_to_call:0
+msgid "Method"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:326
+#, python-format
+msgid ""
+"Line named \"%s\" (Ref:%s) was matched by more than one partner while "
+"looking on partner by name"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:504
+#, python-format
+msgid "Statement ID %s auto-completed for %s lines completed"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:500
+#, python-format
+msgid ""
+"%s Bank Statement ID %s has %s lines completed by %s \n"
+"%s\n"
+"%s\n"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line
+msgid "Bank Statement Line"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement.line,additionnal_bank_fields:0
+msgid "Additionnal infos from bank"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.statement.profile:0
+msgid "Auto-Completion Rules"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.bank.statement:0
+msgid "Importation related infos"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:159
+#: code:addons/account_statement_base_completion/statement.py:179
+#, python-format
+msgid "Invalid invoice type for completion: %"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,name:0
+msgid "Name"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.bank.statement:0
+msgid "Auto Completion"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.statement.completion.rule:0
+#: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree
+#: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu
+msgid "Statement Completion Rule"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.bank.statement.line,additionnal_bank_fields:0
+msgid ""
+"Used by completion and import system. Adds every field that is present in "
+"your bank/office statement file"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,profile_ids:0
+#: field:account.statement.profile,rule_ids:0
+msgid "Related statement profiles"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:158
+#: code:addons/account_statement_base_completion/statement.py:178
+#, python-format
+msgid "System error"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.bank.statement.line,already_completed:0
+msgid "Auto-Completed"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:448
+#: code:addons/account_statement_base_completion/statement.py:466
+#, python-format
+msgid "ORM bypass error"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:account.statement.completion.rule,sequence:0
+msgid "Sequence"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: code:addons/account_statement_base_completion/statement.py:280
+#, python-format
+msgid ""
+"Line named \"%s\" (Ref:%s) was matched by more than one partner while "
+"looking on partner label: %s"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.statement.completion.rule,sequence:0
+msgid "Lower means parsed first."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: field:res.partner,bank_statement_label:0
+msgid "Bank Statement Label"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:account.bank.statement.line,already_completed:0
+msgid ""
+"When this checkbox is ticked, the auto-completion process/button will ignore "
+"this line."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: help:res.partner,bank_statement_label:0
+msgid ""
+"Enter the various label found on your bank statement separated by a ; If     "
+"             one of this label is include in the bank statement line, the "
+"partner will be automatically                  filled (as long as you use "
+"this method/rules in your statement profile)."
+msgstr ""
+
+#. module: account_statement_base_completion
+#: model:ir.model,name:account_statement_base_completion.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: account_statement_base_completion
+#: view:account.bank.statement:0
+msgid "Completion Logs"
+msgstr ""

=== added file 'account_statement_base_completion/partner.py'
--- account_statement_base_completion/partner.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/partner.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    Copyright (C) 2011 Akretion & Camptocamp
+#    Author : Sébastien BEAU, Joel Grand-Guillaume                              #
+#                                                                               #
+#    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
+from openerp.osv import fields, osv
+
+
+class res_partner(Model):
+    """
+    Add a bank label on the partner so that we can use it to match
+    this partner when we found this in a statement line.
+    """
+    _inherit = 'res.partner'
+
+    _columns = {
+        'bank_statement_label': fields.char('Bank Statement Label', size=100,
+                help="Enter the various label found on your bank statement separated by a ; If \
+                 one of this label is include in the bank statement line, the partner will be automatically \
+                 filled (as long as you use this method/rules in your statement profile)."),
+            }

=== added file 'account_statement_base_completion/partner_view.xml'
--- account_statement_base_completion/partner_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/partner_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<openerp>
+	<data>
+
+        <record id="bk_view_partner_form" model="ir.ui.view">
+            <field name="name">account_bank_statement_import.view.partner.form</field>
+            <field name="model">res.partner</field>
+            <field name="type">form</field>
+            <field name="priority">20</field>
+            <field name="inherit_id" ref="account.view_partner_property_form"/>
+            <field name="arch" type="xml">
+                <field name="property_account_payable" position="after">
+                    <field name="bank_statement_label"/>
+                </field>
+            </field>
+        </record>
+
+                
+    </data>
+</openerp>

=== added directory 'account_statement_base_completion/security'
=== added file 'account_statement_base_completion/security/ir.model.access.csv'
--- account_statement_base_completion/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/security/ir.model.access.csv	2014-03-27 09:24:37 +0000
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_account_bank_st_cmpl_user,account.statement.completion.rule,model_account_statement_completion_rule,account.group_account_user,1,0,0,0
+access_account_bank_st_cmpl_manager,account.statement.completion.rule,model_account_statement_completion_rule,account.group_account_manager,1,1,1,1

=== added file 'account_statement_base_completion/statement.py'
--- account_statement_base_completion/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,573 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+# TODO replace customer supplier by package constant
+import traceback
+import sys
+import logging
+import simplejson
+import inspect
+
+import psycopg2
+
+from collections import defaultdict
+import re
+from tools.translate import _
+from openerp.osv import osv, orm, fields
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
+from operator import attrgetter
+import datetime
+
+_logger = logging.getLogger(__name__)
+
+
+class ErrorTooManyPartner(Exception):
+    """
+    New Exception definition that is raised when more than one partner is matched by
+    the completion rule.
+    """
+    def __init__(self, value):
+        self.value = value
+
+    def __str__(self):
+        return repr(self.value)
+
+    def __repr__(self):
+        return repr(self.value)
+
+
+class AccountStatementProfil(orm.Model):
+    """
+    Extend the class to add rules per profile that will match at least the partner,
+    but it could also be used to match other values as well.
+    """
+
+    _inherit = "account.statement.profile"
+
+    _columns = {
+        # @Akretion: For now, we don't implement this features, but this would probably be there:
+        # 'auto_completion': fields.text('Auto Completion'),
+        # 'transferts_account_id':fields.many2one('account.account', 'Transferts Account'),
+        # => You can implement it in a module easily, we design it with your needs in mind
+        # as well!
+
+        'rule_ids': fields.many2many(
+            'account.statement.completion.rule',
+            string='Related statement profiles',
+            rel='as_rul_st_prof_rel'),
+    }
+
+    def _get_rules(self, cr, uid, profile, context=None):
+        if isinstance(profile, (int, long)):
+            prof = self.browse(cr, uid, profile, context=context)
+        else:
+            prof = profile
+        # We need to respect the sequence order
+        return sorted(prof.rule_ids, key=attrgetter('sequence'))
+
+    def _find_values_from_rules(self, cr, uid, calls, line, context=None):
+        """
+        This method will execute all related rules, in their sequence order,
+        to retrieve all the values returned by the first rules that will match.
+        :param calls: list of lookup function name available in rules
+        :param dict line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id: value,
+
+            ...}
+        """
+        if context is None:
+            context = {}
+        if not calls:
+            calls = self._get_rules(cr, uid, line['profile_id'], context=context)
+        rule_obj = self.pool.get('account.statement.completion.rule')
+
+        for call in calls:
+            method_to_call = getattr(rule_obj, call.function_to_call)
+            if len(inspect.getargspec(method_to_call).args) == 6:
+                result = method_to_call(cr, uid, call.id, line, context)
+            else:
+                result = method_to_call(cr, uid, line, context)
+            if result:
+                result['already_completed'] = True
+                return result
+        return None
+
+
+class AccountStatementCompletionRule(orm.Model):
+    """
+    This will represent all the completion method that we can have to
+    fullfill the bank statement lines. You'll be able to extend them in you own module
+    and choose those to apply for every statement profile.
+    The goal of a rule is to fullfill at least the partner of the line, but
+    if possible also the reference because we'll use it in the reconciliation
+    process. The reference should contain the invoice number or the SO number
+    or any reference that will be matched by the invoice accounting move.
+    """
+
+    _name = "account.statement.completion.rule"
+    _order = "sequence asc"
+
+    def _get_functions(self, cr, uid, context=None):
+        """
+        List of available methods for rules. Override this to add you own.
+        """
+        return [
+            ('get_from_ref_and_invoice', 'From line reference (based on customer invoice number)'),
+            ('get_from_ref_and_supplier_invoice', 'From line reference (based on supplier invoice number)'),
+            ('get_from_label_and_partner_field', 'From line label (based on partner field)'),
+            ('get_from_label_and_partner_name', 'From line label (based on partner name)')]
+
+    _columns = {
+        'sequence': fields.integer('Sequence', help="Lower means parsed first."),
+        'name': fields.char('Name', size=128),
+        'profile_ids': fields.many2many(
+            'account.statement.profile',
+            rel='as_rul_st_prof_rel',
+            string='Related statement profiles'),
+        'function_to_call': fields.selection(_get_functions, 'Method'),
+    }
+
+    def _find_invoice(self, cr, uid, st_line, inv_type, context=None):
+        """Find invoice related to statement line"""
+        inv_obj = self.pool.get('account.invoice')
+        if inv_type == 'supplier':
+            type_domain = ('in_invoice', 'in_refund')
+            number_field = 'supplier_invoice_number'
+        elif inv_type == 'customer':
+            type_domain = ('out_invoice', 'out_refund')
+            number_field = 'number'
+        else:
+            raise osv.except_osv(_('System error'),
+                                 _('Invalid invoice type for completion: %') % inv_type)
+
+        inv_id = inv_obj.search(cr, uid,
+                                [(number_field, '=', st_line['ref'].strip()),
+                                 ('type', 'in', type_domain)],
+                                context=context)
+        if inv_id:
+            if len(inv_id) == 1:
+                inv = inv_obj.browse(cr, uid, inv_id[0], context=context)
+            else:
+                raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more '
+                                            'than one partner while looking on %s invoices') %
+                                          (st_line['name'], st_line['ref'], inv_type))
+            return inv
+        return False
+
+    def _from_invoice(self, cr, uid, line, inv_type, context):
+        """Populate statement line values"""
+        if not inv_type in ('supplier', 'customer'):
+            raise osv.except_osv(_('System error'),
+                                 _('Invalid invoice type for completion: %') % inv_type)
+        res = {}
+        inv = self._find_invoice(cr, uid, line, inv_type, context=context)
+        if inv:
+            # FIXME use only commercial_partner_id of invoice in 7.1
+            # this is for backward compatibility in 7.0 before
+            # the refactoring of res.partner
+            if hasattr(inv, 'commercial_partner_id'):
+                partner_id = inv.commercial_partner_id.id
+            else:
+                partner_id = inv.partner_id.id
+
+            res = {'partner_id': partner_id,
+                   'account_id': inv.account_id.id,
+                   'type': inv_type}
+            override_acc = line['master_account_id']
+            if override_acc:
+                res['account_id'] = override_acc
+        return res
+
+    # Should be private but data are initialised with no update XML
+    def get_from_ref_and_supplier_invoice(self, cr, uid, line, context=None):
+        """
+        Match the partner based on the invoice supplier invoice number and the reference of the statement
+        line. Then, call the generic get_values_for_line method to complete other values.
+        If more than one partner matched, raise the ErrorTooManyPartner error.
+
+        :param dict line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id': value,
+
+            ...}
+        """
+        return self._from_invoice(cr, uid, line, 'supplier', context=context)
+
+    # Should be private but data are initialised with no update XML
+    def get_from_ref_and_invoice(self, cr, uid, line, context=None):
+        """
+        Match the partner based on the invoice number and the reference of the statement
+        line. Then, call the generic get_values_for_line method to complete other values.
+        If more than one partner matched, raise the ErrorTooManyPartner error.
+
+        :param dict line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id': value,
+            ...}
+        """
+        return self._from_invoice(cr, uid, line, 'customer', context=context)
+
+    # Should be private but data are initialised with no update XML
+    def get_from_label_and_partner_field(self, cr, uid, st_line, context=None):
+        """
+        Match the partner based on the label field of the statement line
+        and the text defined in the 'bank_statement_label' field of the partner.
+        Remember that we can have values separated with ; Then, call the generic
+        get_values_for_line method to complete other values.
+        If more than one partner matched, raise the ErrorTooManyPartner error.
+
+        :param dict st_line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id': value,
+
+            ...}
+            """
+        partner_obj = self.pool.get('res.partner')
+        st_obj = self.pool.get('account.bank.statement.line')
+        res = {}
+        # As we have to iterate on each partner for each line,
+        # we memoize the pair to avoid
+        # to redo computation for each line.
+        # Following code can be done by a single SQL query
+        # but this option is not really maintanable
+        if not context.get('label_memoizer'):
+            context['label_memoizer'] = defaultdict(list)
+            partner_ids = partner_obj.search(cr,
+                                             uid,
+                                             [('bank_statement_label', '!=', False)])
+            line_ids = context.get('line_ids', [])
+            for partner in partner_obj.browse(cr, uid, partner_ids, context=context):
+                vals = '|'.join(re.escape(x.strip()) for x in partner.bank_statement_label.split(';'))
+                or_regex = ".*%s.*" % vals
+                sql = ("SELECT id from account_bank_statement_line"
+                       " WHERE id in %s"
+                       " AND name ~* %s")
+                cr.execute(sql, (line_ids, or_regex))
+                pairs = cr.fetchall()
+                for pair in pairs:
+                    context['label_memoizer'][pair[0]].append(partner)
+
+        if st_line['id'] in context['label_memoizer']:
+            found_partner = context['label_memoizer'][st_line['id']]
+            if len(found_partner) > 1:
+                msg = (_('Line named "%s" (Ref:%s) was matched by '
+                         'more than one partner while looking on partner label: %s') %
+                       (st_line['name'], st_line['ref'], ','.join([x.name for x in found_partner])))
+                raise ErrorTooManyPartner(msg)
+            res['partner_id'] = found_partner[0].id
+            st_vals = st_obj.get_values_for_line(cr,
+                                                 uid,
+                                                 profile_id=st_line['profile_id'],
+                                                 master_account_id=st_line['master_account_id'],
+                                                 partner_id=found_partner[0].id,
+                                                 line_type=False,
+                                                 amount=st_line['amount'] if st_line['amount'] else 0.0,
+                                                 context=context)
+            res.update(st_vals)
+        return res
+
+    def get_from_label_and_partner_name(self, cr, uid, st_line, context=None):
+        """
+        Match the partner based on the label field of the statement line
+        and the name of the partner.
+        Then, call the generic get_values_for_line method to complete other values.
+        If more than one partner matched, raise the ErrorTooManyPartner error.
+
+        :param dict st_line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id': value,
+
+            ...}
+            """
+        res = {}
+        # We memoize allowed partner
+        if not context.get('partner_memoizer'):
+            context['partner_memoizer'] = tuple(self.pool['res.partner'].search(cr, uid, []))
+        if not context['partner_memoizer']:
+            return res
+        st_obj = self.pool.get('account.bank.statement.line')
+        # regexp_replace(name,'([^a-zA-Z0-9 -])', '\\\1', 'g'), 'i') escape the column name to avoid false positive. (ex 'jho..doe' -> 'joh\.\.doe'
+        sql = """SELECT id FROM  (
+                        SELECT id, regexp_matches(%s, regexp_replace(name,'([^[:alpha:]0-9 -])', %s, 'g'), 'i') AS name_match FROM res_partner
+                            WHERE id IN %s) AS res_patner_matcher
+                    WHERE name_match IS NOT NULL"""
+        cr.execute(sql, (st_line['name'], r"\\\1", context['partner_memoizer']))
+        result = cr.fetchall()
+        if not result:
+            return res
+        if len(result) > 1:
+            raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more '
+                                        'than one partner while looking on partner by name') %
+                                      (st_line['name'], st_line['ref']))
+        res['partner_id'] = result[0][0]
+        st_vals = st_obj.get_values_for_line(cr,
+                                             uid,
+                                             profile_id=st_line['profile_id'],
+                                             master_account_id=st_line['master_account_id'],
+                                             partner_id=res['partner_id'],
+                                             line_type=False,
+                                             amount=st_line['amount'] if st_line['amount'] else 0.0,
+                                             context=context)
+        res.update(st_vals)
+        return res
+
+
+class AccountStatementLine(orm.Model):
+    """
+    Add sparse field on the statement line to allow to store all the
+    bank infos that are given by a bank/office. You can then add you own in your
+    module. The idea here is to store all bank/office infos in the additionnal_bank_fields
+    serialized field when importing the file. If many values, add a tab in the bank
+    statement line to store your specific one. Have a look in account_statement_base_import
+    module to see how we've done it.
+    """
+    _inherit = "account.bank.statement.line"
+
+    _columns = {
+        'additionnal_bank_fields': fields.serialized(
+            'Additionnal infos from bank',
+            help="Used by completion and import system. Adds every field that "
+                 "is present in your bank/office statement file"),
+        'label': fields.sparse(
+            type='char',
+            string='Label',
+            serialization_field='additionnal_bank_fields',
+            help="Generic field to store a label given from the "
+                 "bank/office on which we can base the default/standard "
+                 "providen rule."),
+        'already_completed': fields.boolean(
+            "Auto-Completed",
+            help="When this checkbox is ticked, the auto-completion "
+                 "process/button will ignore this line."),
+    }
+
+    _defaults = {
+        'already_completed': False,
+    }
+
+    def _get_line_values_from_rules(self, cr, uid, line, rules, context=None):
+        """
+        We'll try to find out the values related to the line based on rules setted on
+        the profile.. We will ignore line for which already_completed is ticked.
+
+        :return:
+            A dict of dict value that can be passed directly to the write method of
+            the statement line or {}. The first dict has statement line ID as a key:
+            {117009: {'partner_id': 100997, 'account_id': 489L}}
+        """
+        profile_obj = self.pool.get('account.statement.profile')
+        if line.get('already_completed'):
+            return {}
+        # Ask the rule
+        vals = profile_obj._find_values_from_rules(cr, uid, rules, line, context)
+        if vals:
+            vals['id'] = line['id']
+            return vals
+        return {}
+
+    def _get_available_columns(self, statement_store, include_serializable=False):
+        """Return writeable by SQL columns"""
+        statement_line_obj = self.pool['account.bank.statement.line']
+        model_cols = statement_line_obj._columns
+        avail = [k for k, col in model_cols.iteritems() if not hasattr(col, '_fnct')]
+        keys = [k for k in statement_store[0].keys() if k in avail]
+        # add sparse fields..
+        if include_serializable:
+            for k, col in model_cols.iteritems():
+                if  k in statement_store[0].keys() and \
+                      isinstance(col, fields.sparse) and \
+                      col.serialization_field not in keys and \
+                      col._type == 'char':
+                    keys.append(col.serialization_field)
+        keys.sort()
+        return keys
+
+    def _serialize_sparse_fields(self, cols, statement_store):
+        """ Serialize sparse fields values in the target serialized field
+        Return a copy of statement_store
+        """
+        statement_line_obj = self.pool['account.bank.statement.line']
+        model_cols = statement_line_obj._columns
+        sparse_fields = dict([(k, col) for k, col in model_cols.iteritems() if isinstance(col, fields.sparse) and col._type == 'char'])
+        values = []
+        for statement in statement_store:
+            to_json_k = set()
+            st_copy = statement.copy()
+            for k, col in sparse_fields.iteritems():
+                if k in st_copy:
+                    to_json_k.add(col.serialization_field)
+                    serialized = st_copy.setdefault(col.serialization_field, {})
+                    serialized[k] = st_copy[k]
+            for k in to_json_k:
+                st_copy[k] = simplejson.dumps(st_copy[k])
+            values.append(st_copy)
+        return values
+
+    def _insert_lines(self, cr, uid, statement_store, context=None):
+        """ Do raw insert into database because ORM is awfully slow
+            when doing batch write. It is a shame that batch function
+            does not exist"""
+        statement_line_obj = self.pool['account.bank.statement.line']
+        statement_line_obj.check_access_rule(cr, uid, [], 'create')
+        statement_line_obj.check_access_rights(cr, uid, 'create', raise_exception=True)
+        cols = self._get_available_columns(statement_store, include_serializable=True)
+        tmp_vals = (', '.join(cols), ', '.join(['%%(%s)s' % i for i in cols]))
+        sql = "INSERT INTO account_bank_statement_line (%s) VALUES (%s);" % tmp_vals
+        try:
+            cr.executemany(sql, tuple(self._serialize_sparse_fields(cols, statement_store)))
+        except psycopg2.Error as sql_err:
+            cr.rollback()
+            raise osv.except_osv(_("ORM bypass error"),
+                                 sql_err.pgerror)
+
+    def _update_line(self, cr, uid, vals, context=None):
+        """ Do raw update into database because ORM is awfully slow
+            when cheking security.
+        TODO / WARM: sparse fields are skipped by the method. IOW, if your
+        completion rule update an sparse field, the updated value will never
+        be stored in the database. It would be safer to call the update method
+        from the ORM for records updating this kind of fields.
+        """
+        cols = self._get_available_columns([vals])
+        tmp_vals = (', '.join(['%s = %%(%s)s' % (i, i) for i in cols]))
+        sql = "UPDATE account_bank_statement_line SET %s where id = %%(id)s;" % tmp_vals
+        try:
+            cr.execute(sql, vals)
+        except psycopg2.Error as sql_err:
+            cr.rollback()
+            raise osv.except_osv(_("ORM bypass error"),
+                                 sql_err.pgerror)
+
+
+class AccountBankStatement(orm.Model):
+    """
+    We add a basic button and stuff to support the auto-completion
+    of the bank statement once line have been imported or manually fullfill.
+    """
+    _inherit = "account.bank.statement"
+
+    _columns = {
+        'completion_logs': fields.text('Completion Log', readonly=True),
+    }
+
+    def write_completion_log(self, cr, uid, stat_id, error_msg, number_imported, context=None):
+        """
+        Write the log in the completion_logs field of the bank statement to let the user
+        know what have been done. This is an append mode, so we don't overwrite what
+        already recoded.
+
+        :param int/long stat_id: ID of the account.bank.statement
+        :param char error_msg: Message to add
+        :number_imported int/long: Number of lines that have been completed
+        :return True
+        """
+        user_name = self.pool.get('res.users').read(cr, uid, uid,
+                                                    ['name'], context=context)['name']
+
+        log = self.read(cr, uid, stat_id, ['completion_logs'],
+                        context=context)['completion_logs']
+        log = log if log else ""
+
+        completion_date = datetime.datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+        message = (_("%s Bank Statement ID %s has %s lines completed by %s \n%s\n%s\n") %
+                   (completion_date, stat_id, number_imported, user_name, error_msg, log))
+        self.write(cr, uid, [stat_id], {'completion_logs': message}, context=context)
+
+        body = (_('Statement ID %s auto-completed for %s lines completed') %
+                (stat_id, number_imported)),
+        self.message_post(cr, uid,
+                          [stat_id],
+                          body=body,
+                          context=context)
+        return True
+
+    def button_auto_completion(self, cr, uid, ids, context=None):
+        """
+        Complete line with values given by rules and tic the already_completed
+        checkbox so we won't compute them again unless the user untick them!
+        """
+        if context is None:
+            context = {}
+        stat_line_obj = self.pool['account.bank.statement.line']
+        profile_obj = self.pool.get('account.statement.profile')
+        compl_lines = 0
+        stat_line_obj.check_access_rule(cr, uid, [], 'create')
+        stat_line_obj.check_access_rights(cr, uid, 'create', raise_exception=True)
+        for stat in self.browse(cr, uid, ids, context=context):
+            msg_lines = []
+            ctx = context.copy()
+            ctx['line_ids'] = tuple((x.id for x in stat.line_ids))
+            b_profile = stat.profile_id
+            rules = profile_obj._get_rules(cr, uid, b_profile, context=context)
+            profile_id = b_profile.id  # Only for perfo even it gains almost nothing
+            master_account_id = b_profile.receivable_account_id
+            master_account_id = master_account_id.id if master_account_id else False
+            res = False
+            for line in stat_line_obj.read(cr, uid, ctx['line_ids']):
+                try:
+                    # performance trick
+                    line['master_account_id'] = master_account_id
+                    line['profile_id'] = profile_id
+                    res = stat_line_obj._get_line_values_from_rules(cr, uid, line,
+                                                                    rules, context=ctx)
+                    if res:
+                        compl_lines += 1
+                except ErrorTooManyPartner, exc:
+                    msg_lines.append(repr(exc))
+                except Exception, exc:
+                    msg_lines.append(repr(exc))
+                    error_type, error_value, trbk = sys.exc_info()
+                    st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
+                    st += ''.join(traceback.format_tb(trbk, 30))
+                    _logger.error(st)
+                if res:
+                    #stat_line_obj.write(cr, uid, [line.id], vals, context=ctx)
+                    try:
+                        stat_line_obj._update_line(cr, uid, res, context=context)
+                    except Exception as exc:
+                        msg_lines.append(repr(exc))
+                        error_type, error_value, trbk = sys.exc_info()
+                        st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
+                        st += ''.join(traceback.format_tb(trbk, 30))
+                        _logger.error(st)
+                    # we can commit as it is not needed to be atomic
+                    # commiting here adds a nice perfo boost
+                    if not compl_lines % 500:
+                        cr.commit()
+            msg = u'\n'.join(msg_lines)
+            self.write_completion_log(cr, uid, stat.id,
+                                      msg, compl_lines, context=context)
+        return True

=== added file 'account_statement_base_completion/statement_view.xml'
--- account_statement_base_completion/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <record id="bank_statement_view_form" model="ir.ui.view">
+         <field name="name">account_bank_statement_import_base.bank_statement.view_form</field>
+         <field name="model">account.bank.statement</field>
+         <field name="inherit_id" ref="account.view_bank_statement_form" />
+         <field eval="16" name="priority"/>
+         <field name="type">form</field>
+         <field name="arch" type="xml">
+             <data>
+                 <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='sequence']" position="after">
+                     <separator colspan="4" string="Importation related infos"/>
+                    <field name="label" />
+                    <field name="already_completed" />
+                 </xpath>
+
+                 <!-- <xpath expr="/form/group[2]" position="attributes">
+                                     <attribute name="col">10</attribute>
+                                 </xpath> -->
+
+                 <button name="button_confirm_bank" position="before">
+                     <button name="button_auto_completion" string="Auto Completion" states='draft,open' type="object" class="oe_highlight" icon="gtk-execute"/>
+                 </button>
+
+                 <xpath expr="/form/sheet/notebook/page[@string='Transactions']" position="after">
+                      <page string="Completion Logs" attrs="{'invisible':[('completion_logs','=',False)]}">
+                          <field name="completion_logs" colspan="4" nolabel="1" attrs="{'invisible':[('completion_logs','=',False)]}"/>
+                      </page>
+                 </xpath>
+
+             </data>
+         </field>
+     </record>
+    <record id="bank_statement_view_form2" model="ir.ui.view">
+         <field name="name">account_bank_statement_import_base.bank_statement.auto_cmpl</field>
+         <field name="model">account.bank.statement</field>
+         <field name="inherit_id" ref="account.view_bank_statement_form" />
+         <field name="type">form</field>
+         <field name="arch" type="xml">
+             <data>
+                 <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='amount']" position="after">
+                    <field name="already_completed" />
+                 </xpath>
+             </data>
+         </field>
+     </record>
+
+     <record id="statement_rules_view_form" model="ir.ui.view">
+         <field name="name">account.statement.profile.view</field>
+         <field name="model">account.statement.profile</field>
+         <field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/>
+         <field name="type">form</field>
+         <field name="arch" type="xml">
+             <field name="bank_statement_prefix" position="after">
+                 <separator colspan="4" string="Auto-Completion Rules"/>
+                 <field name="rule_ids" colspan="4" nolabel="1"/>
+             </field>
+         </field>
+     </record>
+    
+    
+         <record id="statement_st_completion_rule_view_form" model="ir.ui.view">
+             <field name="name">account.statement.completion.rule.view</field>
+             <field name="model">account.statement.completion.rule</field>
+             <field name="type">form</field>
+             <field name="arch" type="xml">
+                 <form string="Statement Completion Rule">
+                     <field name="sequence"/>
+                     <field name="name" select="1" />
+                     <field name="function_to_call"/>
+                     <separator colspan="4" string="Related Profiles"/>
+                     <field name="profile_ids" nolabel="1" colspan="4"/>
+                 </form>
+             </field>
+         </record>
+
+         <record id="statement_st_completion_rule_view_tree" model="ir.ui.view">
+             <field name="name">account.statement.completion.rule.view</field>
+             <field name="model">account.statement.completion.rule</field>
+             <field name="type">tree</field>
+             <field name="arch" type="xml">
+                 <tree string="Statement Completion Rule">
+                     <field name="sequence"/>
+                     <field name="name" select="1" />
+                     <field name="profile_ids" />
+                     <field name="function_to_call"/>
+                 </tree>
+             </field>
+         </record>
+         <record id="action_st_completion_rule_tree" model="ir.actions.act_window">
+             <field name="name">Statement Completion Rule</field>
+             <field name="res_model">account.statement.completion.rule</field>
+             <field name="view_type">form</field>
+             <field name="view_mode">tree,form</field>
+         </record>
+
+         <menuitem string="Statement Completion Rule" action="action_st_completion_rule_tree"
+             id="menu_action_st_completion_rule_tree_menu" parent="account.menu_configuration_misc" 
+             sequence="30"/>
+    
+</data>
+</openerp>

=== added directory 'account_statement_base_completion/test'
=== added file 'account_statement_base_completion/test/completion_test.yml'
--- account_statement_base_completion/test/completion_test.yml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/test/completion_test.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,87 @@
+-
+  In order to test the banking framework, I first need to create a profile
+-
+  !record {model: account.statement.profile, id: profile_test1}:
+    name: Bank EUR Profile
+    journal_id: account.bank_journal
+    commission_account_id: account.a_expense
+    company_id: base.main_company
+    balance_check: True
+    rule_ids:
+      - bank_statement_completion_rule_4
+      - bank_statement_completion_rule_5
+      - bank_statement_completion_rule_2
+      - bank_statement_completion_rule_3
+-
+  Now I create a statement. I create statment lines separately because I need
+  to find each one by XML id
+-
+  !record {model: account.bank.statement, id: statement_test1}:
+    name: Statement 2
+    profile_id: profile_test1
+    company_id: base.main_company
+-
+  I create a statement line for a CI
+-
+  !record {model: account.bank.statement.line, id: statement_line_ci}:
+    name: Test autocompletion based on Customer Invoice Number
+    statement_id: statement_test1
+    ref: CI0001
+    date: '2013-12-20'
+    amount: 210.0
+-
+  I create a statement line for a SI
+-
+  !record {model: account.bank.statement.line, id: statement_line_si}:
+    name: Test autocompletion based on Supplier Invoice Number
+    statement_id: statement_test1
+    ref: T2S12345
+    date: '2013-12-19'
+    amount: -65.0
+-
+  I create a statement line for the Partner Name
+-
+  !record {model: account.bank.statement.line, id: statement_line_partner_name}:
+    name: Test autocompletion based on Partner Name Vauxoo
+    statement_id: statement_test1
+    ref: /
+    date: '2013-12-17'
+    amount: 600.0
+-
+  I create a statement line for the Partner Label
+-
+  !record {model: account.bank.statement.line, id: statement_line_partner_label}:
+    name: test autocompletion based on text (XXX66Z) matching with partner form information (note that Ref does not exist)
+    statement_id: statement_test1
+    ref: ZU788
+    date: '2013-12-24'
+    amount: -932.4
+-
+  I run the auto complete
+-
+  !python {model: account.bank.statement}: |
+    result = self.button_auto_completion(cr, uid, [ref("statement_test1")])
+-
+  Now I can check that all is nice and shiny, line 1. I expect the Customer
+  Invoice Number to be recognised.
+  I Use _ref, because ref conflicts with the field ref of the statement line
+-
+  !assert {model: account.bank.statement.line, id: statement_line_ci, string: Check completion by CI number}:
+    - partner_id.id == _ref("base.res_partner_12")
+-
+  Line 2. I expect the Supplier invoice number to be recognised. The supplier
+  invoice was created by the account module demo data, and we confirmed it
+  here.
+-
+  !assert {model: account.bank.statement.line, id: statement_line_si, string: Check completion by SI number}:
+    - partner_id.id == _ref("base.res_partner_17")
+-
+  Line 3. I check that the partner name has been recognised.
+-
+  !assert {model: account.bank.statement.line, id: statement_line_partner_name, string: Check completion by partner name}:
+    - partner_id.name == 'Vauxoo'
+-
+  Line 4. I check that the partner special label has been recognised.
+-
+  !assert {model: account.bank.statement.line, id: statement_line_partner_label, string: Check completion by partner label}:
+    - partner_id.id == _ref("base.res_partner_6")

=== added file 'account_statement_base_completion/test/invoice.yml'
--- account_statement_base_completion/test/invoice.yml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/test/invoice.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,32 @@
+-
+  I create a customer Invoice to be found by the completion.
+-
+  !record {model: account.invoice, id: invoice_for_completion_1}:
+    account_id: account.a_recv
+    company_id: base.main_company
+    currency_id: base.EUR
+    internal_number: CI0001
+    invoice_line:
+      - account_id: account.a_sale
+        name: '[PCSC234] PC Assemble SC234'
+        price_unit: 210.0
+        quantity: 1.0
+        product_id: product.product_product_3
+        uos_id: product.product_uom_unit
+    journal_id: account.bank_journal
+    partner_id: base.res_partner_12
+    reference_type: none
+-
+  I confirm the Invoice
+-
+  !workflow {model: account.invoice, action: invoice_open, ref: invoice_for_completion_1}
+-
+  I check that the invoice state is "Open"
+-
+  !assert {model: account.invoice, id: invoice_for_completion_1}:
+    - state == 'open'
+-
+  I check that it is given the number "CI0001"
+-
+  !assert {model: account.invoice, id: invoice_for_completion_1, string: Check CI number}:
+    - number == 'CI0001'

=== added file 'account_statement_base_completion/test/partner.yml'
--- account_statement_base_completion/test/partner.yml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/test/partner.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,5 @@
+-
+  I fill in the field Bank Statement Label in a Partner
+-
+  !record {model: res.partner, id: base.res_partner_6}:
+    bank_statement_label: XXX66Z

=== added file 'account_statement_base_completion/test/supplier_invoice.yml'
--- account_statement_base_completion/test/supplier_invoice.yml	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/test/supplier_invoice.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,31 @@
+-
+  I check that my invoice is a supplier invoice
+-
+  !assert {model: account.invoice, id: account.demo_invoice_0, string: Check invoice type}:
+    - type == 'in_invoice'
+-
+  I add a reference to an existing supplier invoce
+-
+  !python {model: account.invoice}: |
+    self.write(cr, uid, ref('account.demo_invoice_0'), {
+      'supplier_invoice_number': 'T2S12345'
+    })
+-
+  I check a second time that my invoice is still a supplier invoice
+-
+  !assert {model: account.invoice, id: account.demo_invoice_0, string: Check invoice type 2}:
+    - type == 'in_invoice'
+-
+  Now I confirm it
+-
+  !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0}
+-
+  I check that the supplier number is there
+-
+  !assert {model: account.invoice, id: account.demo_invoice_0, string: Check supplier number}:
+    - supplier_invoice_number == 'T2S12345'
+-
+  I check a third time that my invoice is still a supplier invoice
+-
+  !assert {model: account.invoice, id: account.demo_invoice_0, string: Check invoice type 3}:
+    - type == 'in_invoice'

=== added directory 'account_statement_base_completion/tests'
=== added file 'account_statement_base_completion/tests/__init__.py'
--- account_statement_base_completion/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/tests/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+#
+#
+# Authors: Laurent Mignon
+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+# All Rights Reserved
+#
+# 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 test_base_completion
+
+checks = [
+    test_base_completion
+]

=== added file 'account_statement_base_completion/tests/test_base_completion.py'
--- account_statement_base_completion/tests/test_base_completion.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_completion/tests/test_base_completion.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+#
+#
+# Authors: Laurent Mignon
+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+# All Rights Reserved
+#
+# 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.tests import common
+import time
+from collections import namedtuple
+
+name_completion_case = namedtuple("name_completion_case", ["partner_name", "line_label", "should_match"])
+NAMES_COMPLETION_CASES = [
+         name_completion_case("Acsone", "Line for Acsone SA", True),
+         name_completion_case("Acsone", "Line for Acsone", True),
+         name_completion_case("Acsone", "Acsone for line", True),
+         name_completion_case("acsone", "Acsone for line", True),
+         name_completion_case("Acsone SA", "Line for Acsone SA test", True),
+         name_completion_case("Ac..ne", "Acsone for line", False),
+         name_completion_case("é@|r{}", "Acsone é@|r{} for line", True),
+         name_completion_case("Acsone", "A..one for line", False),
+         name_completion_case("A.one SA", "A.one SA for line", True),
+         name_completion_case("Acsone SA", "Line for Acsone ([^a-zA-Z0-9 -]) SA test", False),
+         name_completion_case("Acsone ([^a-zA-Z0-9 -]) SA", "Line for Acsone ([^a-zA-Z0-9 -]) SA test", True),
+        ]
+
+
+class base_completion(common.TransactionCase):
+
+    def setUp(self):
+        super(base_completion, self).setUp()
+        self.company_a = self.browse_ref('base.main_company')
+        self.profile_obj = self.registry("account.statement.profile")
+        self.partner_obj = self.registry("res.partner")
+        self.account_bank_statement_obj = self.registry("account.bank.statement")
+        self.account_bank_statement_line_obj = self.registry("account.bank.statement.line")
+        self.journal_id = self.ref("account.bank_journal")
+        self.partner_id = self.ref('base.main_partner')
+        self.account_id = self.ref("account.a_recv")
+        self.partner_id = self.ref("base.res_partner_12")
+
+    def test_name_completion(self):
+        """Test complete partner_id from statement line label
+        Test the automatic completion of the partner_id based if the name of the partner appears in
+        the statement line label
+        """
+        self.completion_rule_id = self.ref('account_statement_base_completion.bank_statement_completion_rule_3')
+        # Create the profile
+        self.profile_id = self.profile_obj.create(self.cr, self.uid, {
+            "name": "TEST",
+            "commission_account_id": self.account_id,
+            "journal_id": self.journal_id,
+            "rule_ids": [(6, 0, [self.completion_rule_id])]})
+        # Create a bank statement
+        self.statement_id = self.account_bank_statement_obj.create(self.cr, self.uid, {
+            "balance_end_real": 0.0,
+            "balance_start": 0.0,
+            "date": time.strftime('%Y-%m-%d'),
+            "journal_id": self.journal_id,
+            "profile_id": self.profile_id
+        })
+
+        for case in NAMES_COMPLETION_CASES:
+            self.partner_obj.write(self.cr, self.uid, self.partner_id, {'name': case.partner_name})
+            statement_line_id = self.account_bank_statement_line_obj.create(self.cr, self.uid, {
+                    'amount': 1000.0,
+                    'name': case.line_label,
+                    'ref': 'My ref',
+                    'statement_id': self.statement_id,
+                })
+            statement_line = self.account_bank_statement_line_obj.browse(self.cr, self.uid, statement_line_id)
+            self.assertFalse(statement_line.partner_id, "Partner_id must be blank before completion")
+            statement_obj = self.account_bank_statement_obj.browse(self.cr, self.uid, self.statement_id)
+            statement_obj.button_auto_completion()
+            statement_line = self.account_bank_statement_line_obj.browse(self.cr, self.uid, statement_line_id)
+            if case.should_match:
+                self.assertEquals(self.partner_id, statement_line.partner_id['id'],
+                                "Missing expected partner id after completion (partner_name: %s, line_name: %s)" % (case.partner_name, case.line_label))
+            else:
+                self.assertNotEquals(self.partner_id, statement_line.partner_id['id'],
+                                     "Partner id should be empty after completion(partner_name: %s, line_name: %s)" % (case.partner_name, case.line_label))

=== added directory 'account_statement_base_import'
=== added file 'account_statement_base_import/__init__.py'
--- account_statement_base_import/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+import parser
+import wizard
+import statement

=== added file 'account_statement_base_import/__openerp__.py'
--- account_statement_base_import/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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': "Bank statement base import",
+ 'version': '1.1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': [
+     'account_statement_ext',
+     'account_statement_base_completion'
+     ],
+ 'description': """
+ This module brings basic methods and fields on bank statement to deal with
+ the importation of different bank and offices. A generic abstract method is defined and an
+ example that gives you a basic way of importing bank statement through a standard file is provided.
+
+ This module improves the bank statement and allows you to import your bank transactions with
+ a standard .csv or .xls file (you'll find it in the 'data' folder). It respects the profile
+ (provided by the accouhnt_statement_ext module) to pass the entries. That means,
+ you'll have to choose a file format for each profile.
+ In order to achieve this it uses the `xlrd` Python module which you will need to install
+ separately in your environment.
+
+ This module can handle a commission taken by the payment office and has the following format:
+
+ * ref :               the SO number, INV number or any matching ref found. It'll be used as reference
+                       in the generated entries and will be useful for reconciliation process
+ * date :              date of the payment
+ * amount :            amount paid in the currency of the journal used in the importation profile
+ * label :             the comunication given by the payment office, used as communication in the
+                       generated entries.
+
+ The goal is here to populate the statement lines of a bank statement with the infos that the
+ bank or office give you. Fell free to inherit from this module to add your own format.Then,
+ if you need to complete data from there, add your own account_statement_*_completion module and implement
+ the needed rules.
+
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'data': [
+        "wizard/import_statement_view.xml",
+        "statement_view.xml",
+ ],
+ 'test': [],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+}

=== added directory 'account_statement_base_import/data'
=== added file 'account_statement_base_import/data/statement.csv'
--- account_statement_base_import/data/statement.csv	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/data/statement.csv	2014-03-27 09:24:37 +0000
@@ -0,0 +1,4 @@
+"ref";"date";"amount";"commission_amount";"label"
+50969286;2011-03-07 13:45:14;118.4;-11.84;"label a"
+51065326;2011-03-05 13:45:14;189;-15.12;"label b"
+51179306;2011-03-02 17:45:14;189;-15.12;"label c"

=== added file 'account_statement_base_import/data/statement.xls'
Binary files account_statement_base_import/data/statement.xls	1970-01-01 00:00:00 +0000 and account_statement_base_import/data/statement.xls	2014-03-27 09:24:37 +0000 differ
=== added directory 'account_statement_base_import/i18n'
=== added file 'account_statement_base_import/i18n/account_statement_base_import.pot'
--- account_statement_base_import/i18n/account_statement_base_import.pot	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/i18n/account_statement_base_import.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,289 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_base_import
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:58+0000\n"
+"PO-Revision-Date: 2014-01-21 11:58+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_statement_base_import
+#: view:credit.statement.import:0
+#: model:ir.actions.act_window,name:account_statement_base_import.statement_importer_action
+msgid "Import statement"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:account.statement.profile:0
+msgid "Historical Import Logs"
+msgstr ""
+
+#. module: account_statement_base_import
+#: model:ir.model,name:account_statement_base_import.model_credit_statement_import
+msgid "credit.statement.import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,input_statement:0
+msgid "Statement file"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:168
+#, python-format
+msgid "Column %s you try to import is not present in the bank statement line!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:162
+#, python-format
+msgid "Nothing to import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,journal_id:0
+msgid "Financial journal to use transaction"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:108
+#, python-format
+msgid "Column %s not present in file"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:account.statement.profile:0
+#: model:ir.ui.menu,name:account_statement_base_import.statement_importer_menu
+msgid "Import Bank Statement"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:54
+#, python-format
+msgid "User Error"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:223
+#, python-format
+msgid "The statement cannot be created: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:167
+#, python-format
+msgid "Missing column!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/parser.py:150
+#, python-format
+msgid "No buffer file given."
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:107
+#: code:addons/account_statement_base_import/parser/file_parser.py:171
+#: code:addons/account_statement_base_import/parser/file_parser.py:205
+#, python-format
+msgid "Invalid data"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,launch_import_completion:0
+msgid "Launch completion after import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,partner_id:0
+msgid "Credit insitute partner"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:account.statement.profile:0
+msgid "Import related infos"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:163
+#, python-format
+msgid "The file is empty"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/wizard/import_statement.py:90
+#, python-format
+msgid "Please use a file with an extention"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:172
+#: code:addons/account_statement_base_import/parser/file_parser.py:206
+#, python-format
+msgid "Value %s of column %s is not valid.\n"
+" Please check the line with ref %s:\n"
+" \n"
+" Detail: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:29
+#: code:addons/account_statement_base_import/parser/generic_file_parser.py:30
+#, python-format
+msgid "Please install python lib xlrd"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:160
+#, python-format
+msgid " It should be YYYY-MM-DD for column: %s value: %s \n"
+" \n"
+" \n"
+" Please check the line with ref: %s \n"
+" \n"
+" Detail: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,last_import_date:0
+msgid "Last Import Date"
+msgstr ""
+
+#. module: account_statement_base_import
+#: model:ir.model,name:account_statement_base_import.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:222
+#, python-format
+msgid "Statement import error"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:193
+#, python-format
+msgid "Please modify the cell formatting to date format for column: %s value: %s\n"
+" Please check the line with ref: %s\n"
+" \n"
+" Detail: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:192
+#, python-format
+msgid "Date format is not valid"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,import_type:0
+msgid "Type of import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:account.statement.profile,launch_import_completion:0
+msgid "Tic that box to automatically launch the completion on each imported file using this profile."
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:credit.statement.import,balance_check:0
+msgid "Tic that box if you want OpenERP to control the start/end balance before confirming a bank statement. If don't ticked, no balance control will be done."
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:154
+#, python-format
+msgid "No Profile!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:159
+#, python-format
+msgid "Date format is not valid."
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,profile_id:0
+msgid "Import configuration parameter"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,rec_log:0
+msgid "log"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:credit.statement.import:0
+msgid "Import Parameters Summary"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,balance_check:0
+msgid "Balance check"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,force_partner_on_bank:0
+msgid "Force partner on bank move"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,file_name:0
+msgid "File Name"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:55
+#, python-format
+msgid "Invalid file type %s. Please use csv or xls"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:155
+#, python-format
+msgid "You must provide a valid profile to import a bank statement!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:83
+#, python-format
+msgid "Statement ID %s have been imported with %s lines."
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,receivable_account_id:0
+msgid "Force Receivable/Payable Account"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:164
+#: code:addons/account_statement_base_import/parser/file_parser.py:174
+#: code:addons/account_statement_base_import/parser/file_parser.py:198
+#: code:addons/account_statement_base_import/parser/file_parser.py:208
+#, python-format
+msgid "Missing"
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:account.statement.profile,import_type:0
+msgid "Choose here the method by which you want to import bank statement for this profile."
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:credit.statement.import:0
+msgid "Cancel"
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:credit.statement.import,force_partner_on_bank:0
+msgid "Tic that box if you want to use the credit insitute partner in the counterpart of the treasury/banking move."
+msgstr ""
+

=== added file 'account_statement_base_import/i18n/fr.po'
--- account_statement_base_import/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/i18n/fr.po	2014-03-27 09:24:37 +0000
@@ -0,0 +1,303 @@
+# French translation for banking-addons
+# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
+# This file is distributed under the same license as the banking-addons package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: banking-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
+"POT-Creation-Date: 2014-01-21 11:58+0000\n"
+"PO-Revision-Date: 2014-03-21 15:17+0000\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: French <fr@xxxxxx>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-03-22 07:11+0000\n"
+"X-Generator: Launchpad (build 16967)\n"
+
+#. module: account_statement_base_import
+#: view:credit.statement.import:0
+#: model:ir.actions.act_window,name:account_statement_base_import.statement_importer_action
+msgid "Import statement"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:account.statement.profile:0
+msgid "Historical Import Logs"
+msgstr ""
+
+#. module: account_statement_base_import
+#: model:ir.model,name:account_statement_base_import.model_credit_statement_import
+msgid "credit.statement.import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,input_statement:0
+msgid "Statement file"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:168
+#, python-format
+msgid ""
+"Column %s you try to import is not present in the bank statement line!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:162
+#, python-format
+msgid "Nothing to import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,journal_id:0
+msgid "Financial journal to use transaction"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:108
+#, python-format
+msgid "Column %s not present in file"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:account.statement.profile:0
+#: model:ir.ui.menu,name:account_statement_base_import.statement_importer_menu
+msgid "Import Bank Statement"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:54
+#, python-format
+msgid "User Error"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:223
+#, python-format
+msgid "The statement cannot be created: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:167
+#, python-format
+msgid "Missing column!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/parser.py:150
+#, python-format
+msgid "No buffer file given."
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:107
+#: code:addons/account_statement_base_import/parser/file_parser.py:171
+#: code:addons/account_statement_base_import/parser/file_parser.py:205
+#, python-format
+msgid "Invalid data"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,launch_import_completion:0
+msgid "Launch completion after import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,partner_id:0
+msgid "Credit insitute partner"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:account.statement.profile:0
+msgid "Import related infos"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:163
+#, python-format
+msgid "The file is empty"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/wizard/import_statement.py:90
+#, python-format
+msgid "Please use a file with an extention"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:172
+#: code:addons/account_statement_base_import/parser/file_parser.py:206
+#, python-format
+msgid ""
+"Value %s of column %s is not valid.\n"
+" Please check the line with ref %s:\n"
+" \n"
+" Detail: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:29
+#: code:addons/account_statement_base_import/parser/generic_file_parser.py:30
+#, python-format
+msgid "Please install python lib xlrd"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:160
+#, python-format
+msgid ""
+" It should be YYYY-MM-DD for column: %s value: %s \n"
+" \n"
+" \n"
+" Please check the line with ref: %s \n"
+" \n"
+" Detail: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,last_import_date:0
+msgid "Last Import Date"
+msgstr ""
+
+#. module: account_statement_base_import
+#: model:ir.model,name:account_statement_base_import.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:222
+#, python-format
+msgid "Statement import error"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:193
+#, python-format
+msgid ""
+"Please modify the cell formatting to date format for column: %s value: %s\n"
+" Please check the line with ref: %s\n"
+" \n"
+" Detail: %s"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:192
+#, python-format
+msgid "Date format is not valid"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,import_type:0
+msgid "Type of import"
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:account.statement.profile,launch_import_completion:0
+msgid ""
+"Tic that box to automatically launch the completion on each imported file "
+"using this profile."
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:credit.statement.import,balance_check:0
+msgid ""
+"Tic that box if you want OpenERP to control the start/end balance before "
+"confirming a bank statement. If don't ticked, no balance control will be "
+"done."
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:154
+#, python-format
+msgid "No Profile!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:159
+#, python-format
+msgid "Date format is not valid."
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,profile_id:0
+msgid "Import configuration parameter"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:account.statement.profile,rec_log:0
+msgid "log"
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:credit.statement.import:0
+msgid "Import Parameters Summary"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,balance_check:0
+msgid "Balance check"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,force_partner_on_bank:0
+msgid "Force partner on bank move"
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,file_name:0
+msgid "File Name"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:55
+#, python-format
+msgid "Invalid file type %s. Please use csv or xls"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:155
+#, python-format
+msgid "You must provide a valid profile to import a bank statement!"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/statement.py:83
+#, python-format
+msgid "Statement ID %s have been imported with %s lines."
+msgstr ""
+
+#. module: account_statement_base_import
+#: field:credit.statement.import,receivable_account_id:0
+msgid "Force Receivable/Payable Account"
+msgstr ""
+
+#. module: account_statement_base_import
+#: code:addons/account_statement_base_import/parser/file_parser.py:164
+#: code:addons/account_statement_base_import/parser/file_parser.py:174
+#: code:addons/account_statement_base_import/parser/file_parser.py:198
+#: code:addons/account_statement_base_import/parser/file_parser.py:208
+#, python-format
+msgid "Missing"
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:account.statement.profile,import_type:0
+msgid ""
+"Choose here the method by which you want to import bank statement for this "
+"profile."
+msgstr ""
+
+#. module: account_statement_base_import
+#: view:credit.statement.import:0
+msgid "Cancel"
+msgstr ""
+
+#. module: account_statement_base_import
+#: help:credit.statement.import,force_partner_on_bank:0
+msgid ""
+"Tic that box if you want to use the credit insitute partner in the "
+"counterpart of the treasury/banking move."
+msgstr ""

=== added directory 'account_statement_base_import/parser'
=== added file 'account_statement_base_import/parser/__init__.py'
--- account_statement_base_import/parser/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/parser/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-2012 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 parser import new_bank_statement_parser
+from parser import BankStatementImportParser
+import file_parser
+import generic_file_parser

=== added file 'account_statement_base_import/parser/file_parser.py'
--- account_statement_base_import/parser/file_parser.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/parser/file_parser.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,221 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright Camptocamp SA
+#    Author Nicolas Bessi, Joel Grand-Guillaume
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU 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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openerp.tools.translate import _
+from openerp.osv.osv import except_osv
+import tempfile
+import datetime
+from parser import BankStatementImportParser
+from parser import UnicodeDictReader
+try:
+    import xlrd
+except:
+    raise Exception(_('Please install python lib xlrd'))
+
+def float_or_zero(val):
+    """ Conversion function used to manage
+    empty string into float usecase"""
+    return float(val) if val else 0.0
+
+class FileParser(BankStatementImportParser):
+    """
+    Generic abstract class for defining parser for .csv, .xls or .xlsx file format.
+    """
+
+    def __init__(self, parse_name, ftype='csv', extra_fields=None, header=None, **kwargs):
+        """
+            :param char: parse_name: The name of the parser
+            :param char: ftype: extension of the file (could be csv, xls or xlsx)
+            :param dict: extra_fields: extra fields to add to the conversion dict. In the format
+                                     {fieldname: fieldtype}
+            :param list: header : specify header fields if the csv file has no header
+            """
+
+        super(FileParser, self).__init__(parse_name, **kwargs)
+        if ftype in ('csv', 'xls' ,'xlsx'):
+            self.ftype = ftype[0:3]
+        else:
+            raise except_osv(_('User Error'),
+                             _('Invalid file type %s. Please use csv, xls or xlsx') % ftype)
+        self.conversion_dict = {
+            'ref': unicode,
+            'label': unicode,
+            'date': datetime.datetime,
+            'amount': float_or_zero,
+        }
+        if extra_fields:
+            self.conversion_dict.update(extra_fields)
+        self.keys_to_validate = self.conversion_dict.keys()
+        self.fieldnames = header
+        self._datemode = 0  # used only for xls documents,
+                            # 0 means Windows mode (1900 based dates).
+                            # Set in _parse_xls, from the contents of the file
+
+    def _custom_format(self, *args, **kwargs):
+        """
+        No other work on data are needed in this parser.
+        """
+        return True
+
+    def _pre(self, *args, **kwargs):
+        """
+        No pre-treatment needed for this parser.
+        """
+        return True
+
+    def _parse(self, *args, **kwargs):
+        """
+        Launch the parsing through .csv, .xls or .xlsx depending on the
+        given ftype
+        """
+
+        res = None
+        if self.ftype == 'csv':
+            res = self._parse_csv()
+        else:
+            res = self._parse_xls()
+        self.result_row_list = res
+        return True
+
+    def _validate(self, *args, **kwargs):
+        """
+        We check that all the key of the given file (means header) are present
+        in the validation key provided. Otherwise, we raise an Exception.
+        We skip the validation step if the file header is provided separately
+        (in the field: fieldnames).
+        """
+        if self.fieldnames is None:
+            parsed_cols = self.result_row_list[0].keys()
+            for col in self.keys_to_validate:
+                if col not in parsed_cols:
+                    raise except_osv(_('Invalid data'),
+                                     _('Column %s not present in file') % col)
+        return True
+
+    def _post(self, *args, **kwargs):
+        """
+        Cast row type depending on the file format .csv or .xls after parsing the file.
+        """
+        self.result_row_list = self._cast_rows(*args, **kwargs)
+        return True
+
+    def _parse_csv(self):
+        """
+        :return: list of dict from csv file (line/rows)
+        """
+        csv_file = tempfile.NamedTemporaryFile()
+        csv_file.write(self.filebuffer)
+        csv_file.flush()
+        with open(csv_file.name, 'rU') as fobj:
+            reader = UnicodeDictReader(fobj, fieldnames=self.fieldnames)
+            return list(reader)
+
+    def _parse_xls(self):
+        """
+        :return: dict of dict from xls/xlsx file (line/rows)
+        """
+        wb_file = tempfile.NamedTemporaryFile()
+        wb_file.write(self.filebuffer)
+        # We ensure that cursor is at beginig of file
+        wb_file.seek(0)
+        with xlrd.open_workbook(wb_file.name) as wb:
+            self._datemode = wb.datemode
+            sheet = wb.sheet_by_index(0)
+            header = sheet.row_values(0)
+            res = []
+            for rownum in range(1, sheet.nrows):
+                res.append(dict(zip(header, sheet.row_values(rownum))))
+        return res
+
+    def _from_csv(self, result_set, conversion_rules):
+        """
+        Handle the converstion from the dict and handle date format from
+        an .csv file.
+        """
+        for line in result_set:
+            for rule in conversion_rules:
+                if conversion_rules[rule] == datetime.datetime:
+                    try:
+                        date_string = line[rule].split(' ')[0]
+                        line[rule] = datetime.datetime.strptime(date_string,
+                                                                '%Y-%m-%d')
+                    except ValueError as err:
+                        raise except_osv(_("Date format is not valid."),
+                                         _(" It should be YYYY-MM-DD for column: %s"
+                                           " value: %s \n \n"
+                                           " \n Please check the line with ref: %s"
+                                           " \n \n Detail: %s") % (rule,
+                                                                   line.get(rule, _('Missing')),
+                                                                   line.get('ref', line),
+                                                                   repr(err)))
+                else:
+                    try:
+                        line[rule] = conversion_rules[rule](line[rule])
+                    except Exception as err:
+                        raise except_osv(_('Invalid data'),
+                                         _("Value %s of column %s is not valid."
+                                           "\n Please check the line with ref %s:"
+                                           "\n \n Detail: %s") % (line.get(rule, _('Missing')),
+                                                                  rule,
+                                                                  line.get('ref', line),
+                                                                  repr(err)))
+        return result_set
+
+    def _from_xls(self, result_set, conversion_rules):
+        """
+        Handle the converstion from the dict and handle date format from
+        an .csv, .xls or .xlsx file.
+        """
+        for line in result_set:
+            for rule in conversion_rules:
+                if conversion_rules[rule] == datetime.datetime:
+                    try:
+                        t_tuple = xlrd.xldate_as_tuple(line[rule], self._datemode)
+                        line[rule] = datetime.datetime(*t_tuple)
+                    except Exception as err:
+                        raise except_osv(_("Date format is not valid"),
+                                         _("Please modify the cell formatting to date format"
+                                           " for column: %s"
+                                           " value: %s"
+                                           "\n Please check the line with ref: %s"
+                                           "\n \n Detail: %s") % (rule,
+                                                                  line.get(rule, _('Missing')),
+                                                                  line.get('ref', line),
+                                                                  repr(err)))
+                else:
+                    try:
+                        line[rule] = conversion_rules[rule](line[rule])
+                    except Exception as err:
+                        raise except_osv(_('Invalid data'),
+                                         _("Value %s of column %s is not valid."
+                                           "\n Please check the line with ref %s:"
+                                           "\n \n Detail: %s") % (line.get(rule, _('Missing')),
+                                                                  rule,
+                                                                  line.get('ref', line),
+                                                                  repr(err)))
+        return result_set
+
+    def _cast_rows(self, *args, **kwargs):
+        """
+        Convert the self.result_row_list using the self.conversion_dict providen.
+        We call here _from_xls or _from_csv depending on the self.ftype variable.
+        """
+        func = getattr(self, '_from_%s' % self.ftype)
+        res = func(self.result_row_list, self.conversion_dict)
+        return res

=== added file 'account_statement_base_import/parser/generic_file_parser.py'
--- account_statement_base_import/parser/generic_file_parser.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/parser/generic_file_parser.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright Camptocamp SA
+#    Author Joel Grand-Guillaume
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU 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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.tools.translate import _
+import base64
+import csv
+import tempfile
+import datetime
+from file_parser import FileParser
+try:
+    import xlrd
+except:
+    raise Exception(_('Please install python lib xlrd'))
+
+
+class GenericFileParser(FileParser):
+    """
+    Standard parser that use a define format in csv or xls to import into a
+    bank statement. This is mostely an example of how to proceed to create a new
+    parser, but will also be useful as it allow to import a basic flat file.
+    """
+
+    def __init__(self, parse_name, ftype='csv', **kwargs):
+        super(GenericFileParser, self).__init__(parse_name, ftype=ftype, **kwargs)
+
+    @classmethod
+    def parser_for(cls, parser_name):
+        """
+        Used by the new_bank_statement_parser class factory. Return true if
+        the providen name is generic_csvxls_so
+        """
+        return parser_name == 'generic_csvxls_so'
+
+    def get_st_line_vals(self, line, *args, **kwargs):
+        """
+        This method must return a dict of vals that can be passed to create
+        method of statement line in order to record it. It is the responsibility
+        of every parser to give this dict of vals, so each one can implement his
+        own way of recording the lines.
+            :param:  line: a dict of vals that represent a line of result_row_list
+            :return: dict of values to give to the create method of statement line,
+                     it MUST contain at least:
+                {
+                    'name':value,
+                    'date':value,
+                    'amount':value,
+                    'ref':value,
+                    'label':value,
+                }
+        """
+        return {
+            'name': line.get('label', line.get('ref', '/')),
+            'date': line.get('date', datetime.datetime.now().date()),
+            'amount': line.get('amount', 0.0),
+            'ref': line.get('ref', '/'),
+            'label': line.get('label', ''),
+        }

=== added file 'account_statement_base_import/parser/parser.py'
--- account_statement_base_import/parser/parser.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/parser/parser.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,222 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+import base64
+import csv
+from datetime import datetime
+
+
+def UnicodeDictReader(utf8_data, **kwargs):
+    sniffer = csv.Sniffer()
+    pos = utf8_data.tell()
+    sample_data = utf8_data.read(2048)
+    utf8_data.seek(pos)
+    dialect = sniffer.sniff(sample_data, delimiters=',;\t')
+    csv_reader = csv.DictReader(utf8_data, dialect=dialect, **kwargs)
+    for row in csv_reader:
+        yield dict([(key, unicode(value, 'utf-8')) for key, value in row.iteritems()])
+
+
+class BankStatementImportParser(object):
+    """
+    Generic abstract class for defining parser for different files and
+    format to import in a bank statement. Inherit from it to create your
+    own. If your file is a .csv or .xls format, you should consider inheirt
+    from the FileParser instead.
+    """
+
+    def __init__(self, parser_name, *args, **kwargs):
+        # The name of the parser as it will be called
+        self.parser_name = parser_name
+        # The result as a list of row. One row per line of data in the file, but
+        # not the commission one !
+        self.result_row_list = None
+        # The file buffer on which to work on
+        self.filebuffer = None
+        self.balance_start = None
+        self.balance_end = None
+        self.statement_name = None
+        self.statement_date = None
+
+    @classmethod
+    def parser_for(cls, parser_name):
+        """
+        Override this method for every new parser, so that new_bank_statement_parser can
+        return the good class from his name.
+        """
+        return False
+
+    def _decode_64b_stream(self):
+        """
+        Decode self.filebuffer in base 64 and override it
+        """
+        self.filebuffer = base64.b64decode(self.filebuffer)
+        return True
+
+    def _format(self, decode_base_64=True, **kwargs):
+        """
+        Decode into base 64 if asked and Format the given filebuffer by calling
+        _custom_format method.
+        """
+        if decode_base_64:
+            self._decode_64b_stream()
+        self._custom_format(kwargs)
+        return True
+
+    def _custom_format(self, *args, **kwargs):
+        """
+        Implement a method in your parser to convert format, encoding and so on before
+        starting to work on datas. Work on self.filebuffer
+        """
+        return NotImplementedError
+
+    def _pre(self, *args, **kwargs):
+        """
+        Implement a method in your parser to make a pre-treatment on datas before parsing
+        them, like concatenate stuff, and so... Work on self.filebuffer
+        """
+        return NotImplementedError
+
+    def _parse(self, *args, **kwargs):
+        """
+        Implement a method in your parser to save the result of parsing self.filebuffer
+        in self.result_row_list instance property.
+        """
+        return NotImplementedError
+
+    def _validate(self, *args, **kwargs):
+        """
+        Implement a method in your parser  to validate the self.result_row_list instance
+        property and raise an error if not valid.
+        """
+        return NotImplementedError
+
+    def _post(self, *args, **kwargs):
+        """
+        Implement a method in your parser to make some last changes on the result of parsing
+        the datas, like converting dates, computing commission, ...
+        """
+        return NotImplementedError
+
+    def get_st_vals(self):
+        """
+        This method return a dict of vals that ca be passed to
+        create method of statement.
+        :return: dict of vals that represent additional infos for the statement
+        """
+        return {
+                'name': self.statement_name or '/',
+                'balance_start': self.balance_start,
+                'balance_end_real': self.balance_end,
+                'date': self.statement_date or datetime.now()
+        }
+
+    def get_st_line_vals(self, line, *args, **kwargs):
+        """
+        Implement a method in your parser that must return a dict of vals that can be
+        passed to create method of statement line in order to record it. It is the responsibility
+        of every parser to give this dict of vals, so each one can implement his
+        own way of recording the lines.
+            :param:  line: a dict of vals that represent a line of result_row_list
+            :return: dict of values to give to the create method of statement line,
+                     it MUST contain at least:
+                {
+                    'name':value,
+                    'date':value,
+                    'amount':value,
+                    'ref':value,
+                }
+        """
+        return NotImplementedError
+
+    def parse(self, filebuffer, *args, **kwargs):
+        """
+        This will be the method that will be called by wizard, button and so
+        to parse a filebuffer by calling successively all the private method
+        that need to be define for each parser.
+        Return:
+             [] of rows as {'key':value}
+
+        Note: The row_list must contain only value that are present in the account.
+        bank.statement.line object !!!
+        """
+        if filebuffer:
+            self.filebuffer = filebuffer
+        else:
+            raise Exception(_('No buffer file given.'))
+        self._format(*args, **kwargs)
+        self._pre(*args, **kwargs)
+        self._parse(*args, **kwargs)
+        self._validate(*args, **kwargs)
+        self._post(*args, **kwargs)
+        return self.result_row_list
+
+
+def itersubclasses(cls, _seen=None):
+    """
+    itersubclasses(cls)
+
+    Generator over all subclasses of a given class, in depth first order.
+
+    >>> list(itersubclasses(int)) == [bool]
+    True
+    >>> class A(object): pass
+    >>> class B(A): pass
+    >>> class C(A): pass
+    >>> class D(B,C): pass
+    >>> class E(D): pass
+    >>>
+    >>> for cls in itersubclasses(A):
+    ...     print(cls.__name__)
+    B
+    D
+    E
+    C
+    >>> # get ALL (new-style) classes currently defined
+    >>> [cls.__name__ for cls in itersubclasses(object)] #doctest: +ELLIPSIS
+    ['type', ...'tuple', ...]
+    """
+    if not isinstance(cls, type):
+        raise TypeError('itersubclasses must be called with '
+                        'new-style classes, not %.100r' % cls)
+    if _seen is None:
+        _seen = set()
+    try:
+        subs = cls.__subclasses__()
+    except TypeError:  # fails only when cls is type
+        subs = cls.__subclasses__(cls)
+    for sub in subs:
+        if sub not in _seen:
+            _seen.add(sub)
+            yield sub
+            for sub in itersubclasses(sub, _seen):
+                yield sub
+
+
+def new_bank_statement_parser(parser_name, *args, **kwargs):
+    """
+    Return an instance of the good parser class base on the providen name
+    :param char: parser_name
+    :return: class instance of parser_name providen.
+    """
+    for cls in itersubclasses(BankStatementImportParser):
+        if cls.parser_for(parser_name):
+            return cls(parser_name, *args, **kwargs)
+    raise ValueError

=== added file 'account_statement_base_import/statement.py'
--- account_statement_base_import/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,240 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+import sys
+import traceback
+
+from openerp.tools.translate import _
+import datetime
+from openerp.osv.orm import Model
+from openerp.osv import fields, osv
+from parser import new_bank_statement_parser
+from openerp.tools.config import config
+
+
+class AccountStatementProfil(Model):
+    _inherit = "account.statement.profile"
+
+    def get_import_type_selection(self, cr, uid, context=None):
+        """This is the method to be inherited for adding the parser"""
+        return [('generic_csvxls_so', 'Generic .csv/.xls based on SO Name')]
+
+    def _get_import_type_selection(self, cr, uid, context=None):
+        return self.get_import_type_selection(cr, uid, context=context)
+
+    _columns = {
+        'launch_import_completion': fields.boolean(
+            "Launch completion after import",
+            help="Tic that box to automatically launch the completion "
+                 "on each imported file using this profile."),
+        'last_import_date': fields.datetime("Last Import Date"),
+        #  we remove deprecated as it floods logs in standard/warning level sob...
+        'rec_log': fields.text('log', readonly=True),  # Deprecated
+        'import_type': fields.selection(
+            _get_import_type_selection,
+            'Type of import',
+            required=True,
+            help="Choose here the method by which you want to import bank"
+                 "statement for this profile."),
+    }
+
+    _defaults = {
+                'import_type': 'generic_csvxls_so'
+            }
+
+    def _write_extra_statement_lines(
+            self, cr, uid, parser, result_row_list, profile, statement_id, context):
+        """Insert extra lines after the main statement lines.
+
+        After the main statement lines have been created, you can override this method to create
+        extra statement lines.
+
+            :param:    browse_record of the current parser
+            :param:    result_row_list: [{'key':value}]
+            :param:    profile: browserecord of account.statement.profile
+            :param:    statement_id: int/long of the current importing statement ID
+            :param:    context: global context
+        """
+        pass
+
+    def write_logs_after_import(self, cr, uid, ids, statement_id, num_lines, context):
+        """
+        Write the log in the logger
+
+        :param int/long statement_id: ID of the concerned account.bank.statement
+        :param int/long num_lines: Number of line that have been parsed
+        :return: True
+        """
+        self.message_post(cr,
+                          uid,
+                          ids,
+                          body=_('Statement ID %s have been imported with %s lines.') %
+                                (statement_id, num_lines),
+                          context=context)
+        return True
+
+    #Deprecated remove on V8
+    def prepare_statetement_lines_vals(self, *args, **kwargs):
+        return self.prepare_statement_lines_vals(*args, **kwargs)
+
+    def prepare_statement_lines_vals(
+            self, cr, uid, parser_vals, account_payable, account_receivable,
+            statement_id, context):
+        """
+        Hook to build the values of a line from the parser returned values. At
+        least it fullfill the statement_id and account_id. Override it to add your
+        own completion if needed.
+
+        :param dict of vals from parser for account.bank.statement.line (called by
+                parser.get_st_line_vals)
+        :param int/long account_payable: ID of the receivable account to use
+        :param int/long account_receivable: ID of the payable account to use
+        :param int/long statement_id: ID of the concerned account.bank.statement
+        :return: dict of vals that will be passed to create method of statement line.
+        """
+        statement_obj = self.pool.get('account.bank.statement')
+        values = parser_vals
+        values['statement_id'] = statement_id
+        values['account_id'] = statement_obj.get_account_for_counterpart(cr,
+                                                                         uid,
+                                                                         parser_vals['amount'],
+                                                                         account_receivable,
+                                                                         account_payable)
+
+        date = values.get('date')
+        period_memoizer = context.get('period_memoizer')
+        if not period_memoizer:
+            period_memoizer = {}
+            context['period_memoizer'] = period_memoizer
+        if period_memoizer.get(date):
+            values['period_id'] = period_memoizer[date]
+        else:
+            # This is awfully slow...
+            periods = self.pool.get('account.period').find(cr, uid,
+                                                           dt=values.get('date'),
+                                                           context=context)
+            values['period_id'] = periods[0]
+            period_memoizer[date] = periods[0]
+        values['type'] = 'general'
+        return values
+
+    def prepare_statement_vals(self, cr, uid, profile_id, result_row_list, parser, context):
+        """
+        Hook to build the values of the statement from the parser and
+        the profile.
+        """
+        vals = {'profile_id': profile_id}
+        vals.update(parser.get_st_vals())
+        return vals
+
+    def statement_import(self, cr, uid, ids, profile_id, file_stream, ftype="csv", context=None):
+        """
+        Create a bank statement with the given profile and parser. It will fullfill the bank statement
+        with the values of the file providen, but will not complete data (like finding the partner, or
+        the right account). This will be done in a second step with the completion rules.
+
+        :param int/long profile_id: ID of the profile used to import the file
+        :param filebuffer file_stream: binary of the providen file
+        :param char: ftype represent the file exstension (csv by default)
+        :return: ID of the created account.bank.statemênt
+        """
+        statement_obj = self.pool.get('account.bank.statement')
+        statement_line_obj = self.pool.get('account.bank.statement.line')
+        attachment_obj = self.pool.get('ir.attachment')
+        prof_obj = self.pool.get("account.statement.profile")
+        if not profile_id:
+            raise osv.except_osv(_("No Profile!"),
+                                 _("You must provide a valid profile to import a bank statement!"))
+        prof = prof_obj.browse(cr, uid, profile_id, context=context)
+
+        parser = new_bank_statement_parser(prof.import_type, ftype=ftype)
+        result_row_list = parser.parse(file_stream)
+        # Check all key are present in account.bank.statement.line!!
+        if not result_row_list:
+            raise osv.except_osv(_("Nothing to import"),
+                                 _("The file is empty"))
+        parsed_cols = parser.get_st_line_vals(result_row_list[0]).keys()
+        for col in parsed_cols:
+            if col not in statement_line_obj._columns:
+                raise osv.except_osv(_("Missing column!"),
+                                     _("Column %s you try to import is not "
+                                       "present in the bank statement line!") % col)
+
+        statement_vals = self.prepare_statement_vals(cr, uid, prof.id, result_row_list, parser, context)
+        statement_id = statement_obj.create(cr, uid,
+                                            statement_vals,
+                                            context=context)
+
+        if prof.receivable_account_id:
+            account_receivable = account_payable = prof.receivable_account_id.id
+        else:
+            account_receivable, account_payable = statement_obj.get_default_pay_receiv_accounts(
+                                                       cr, uid, context)
+        try:
+            # Record every line in the bank statement
+            statement_store = []
+            for line in result_row_list:
+                parser_vals = parser.get_st_line_vals(line)
+                values = self.prepare_statement_lines_vals(
+                    cr, uid, parser_vals, account_payable, account_receivable, statement_id,
+                    context)
+                statement_store.append(values)
+            # Hack to bypass ORM poor perfomance. Sob...
+            statement_line_obj._insert_lines(cr, uid, statement_store, context=context)
+
+            self._write_extra_statement_lines(
+                cr, uid, parser, result_row_list, prof, statement_id, context)
+            # Trigger store field computation if someone has better idea
+            start_bal = statement_obj.read(
+                cr, uid, statement_id, ['balance_start'], context=context)
+            start_bal = start_bal['balance_start']
+            statement_obj.write(cr, uid, [statement_id], {'balance_start': start_bal})
+
+            attachment_data = {
+                'name': 'statement file',
+                'datas': file_stream,
+                'datas_fname': "%s.%s" % (datetime.datetime.now().date(), ftype),
+                'res_model': 'account.bank.statement',
+                'res_id': statement_id,
+            }
+            attachment_obj.create(cr, uid, attachment_data, context=context)
+
+            # If user ask to launch completion at end of import, do it!
+            if prof.launch_import_completion:
+                statement_obj.button_auto_completion(cr, uid, [statement_id], context)
+
+            # Write the needed log infos on profile
+            self.write_logs_after_import(cr, uid, prof.id,
+                                         statement_id,
+                                         len(result_row_list),
+                                         context)
+
+        except Exception:
+            error_type, error_value, trbk = sys.exc_info()
+            st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
+            st += ''.join(traceback.format_tb(trbk, 30))
+            #TODO we should catch correctly the exception with a python
+            #Exception and only re-catch some special exception.
+            #For now we avoid re-catching error in debug mode
+            if config['debug_mode']:
+                raise
+            raise osv.except_osv(_("Statement import error"),
+                                 _("The statement cannot be created: %s") % st)
+        return statement_id

=== added file 'account_statement_base_import/statement_view.xml'
--- account_statement_base_import/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+
+    <record id="statement_importer_view_form" model="ir.ui.view">
+        <field name="name">account.statement.profile.view</field>
+        <field name="model">account.statement.profile</field>
+        <field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/>
+        <field name="type">form</field>
+        <field name="arch" type="xml">
+            <field name="bank_statement_prefix" position="after">
+                <separator colspan="4" string="Import related infos"/>
+                <field name="launch_import_completion"/>
+                <field name="last_import_date"/>
+                <field name="import_type"/>
+                <button name="%(account_statement_base_import.statement_importer_action)d"
+                                                        string="Import Bank Statement"
+                                                        type="action" icon="gtk-ok"
+                                                        colspan = "2"/>
+                <group attrs="{'invisible': [('rec_log', '=', False)]}">
+                    <separator colspan="4" string="Historical Import Logs"/>
+                    <field name="rec_log" colspan="4" nolabel="1" />
+                </group>
+            </field>
+        </field>
+    </record>
+
+</data>
+</openerp>

=== added directory 'account_statement_base_import/wizard'
=== added file 'account_statement_base_import/wizard/__init__.py'
--- account_statement_base_import/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/wizard/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author Nicolas Bessi, Joel Grand-Guillaume. Copyright Camptocamp SA
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU 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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import import_statement

=== added file 'account_statement_base_import/wizard/import_statement.py'
--- account_statement_base_import/wizard/import_statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/wizard/import_statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+
+"""
+Wizard to import financial institute date in bank statement
+"""
+
+from openerp.osv import orm, fields
+
+from openerp.tools.translate import _
+import os
+
+
+class CreditPartnerStatementImporter(orm.TransientModel):
+    _name = "credit.statement.import"
+
+    def default_get(self, cr, uid, fields, context=None):
+        if context is None:
+            context = {}
+        res = {}
+        if (context.get('active_model', False) == 'account.statement.profile' and
+            context.get('active_ids', False)):
+            ids = context['active_ids']
+            assert len(ids) == 1, 'You cannot use this on more than one profile !'
+            res['profile_id'] = ids[0]
+            other_vals = self.onchange_profile_id(cr, uid, [], res['profile_id'], context=context)
+            res.update(other_vals.get('value', {}))
+        return res
+
+    _columns = {
+        'profile_id': fields.many2one('account.statement.profile',
+                                      'Import configuration parameter',
+                                      required=True),
+        'input_statement': fields.binary('Statement file', required=True),
+        'partner_id': fields.many2one('res.partner',
+                                      'Credit insitute partner'),
+        'journal_id': fields.many2one('account.journal',
+                                      'Financial journal to use transaction'),
+        'file_name': fields.char('File Name', size=128),
+        'receivable_account_id': fields.many2one('account.account',
+                                                 'Force Receivable/Payable Account'),
+        'force_partner_on_bank': fields.boolean(
+            'Force partner on bank move',
+            help="Tic that box if you want to use the credit insitute partner "
+            "in the counterpart of the treasury/banking move."),
+        'balance_check': fields.boolean(
+            'Balance check',
+            help="Tic that box if you want OpenERP to control the "
+            "start/end balance before confirming a bank statement. "
+            "If don't ticked, no balance control will be done."),
+    }
+
+    def onchange_profile_id(self, cr, uid, ids, profile_id, context=None):
+        res = {}
+        if profile_id:
+            c = self.pool.get("account.statement.profile").browse(
+                    cr, uid, profile_id, context=context)
+            res = {'value':
+                    {'partner_id': c.partner_id and c.partner_id.id or False,
+                     'journal_id': c.journal_id and c.journal_id.id or False,
+                     'receivable_account_id': c.receivable_account_id and c.receivable_account_id.id or False,
+                     'force_partner_on_bank': c.force_partner_on_bank,
+                     'balance_check': c.balance_check,
+                     }
+                }
+        return res
+
+    def _check_extension(self, filename):
+        (__, ftype) = os.path.splitext(filename)
+        if not ftype:
+            #We do not use osv exception we do not want to have it logged
+            raise Exception(_('Please use a file with an extention'))
+        return ftype
+
+    def import_statement(self, cr, uid, req_id, context=None):
+        """This Function import credit card agency statement"""
+        context = context or {}
+        if isinstance(req_id, list):
+            req_id = req_id[0]
+        importer = self.browse(cr, uid, req_id, context)
+        ftype = self._check_extension(importer.file_name)
+        context['file_name'] = importer.file_name
+        sid = self.pool.get(
+                'account.statement.profile').statement_import(
+                                            cr,
+                                            uid,
+                                            False,
+                                            importer.profile_id.id,
+                                            importer.input_statement,
+                                            ftype.replace('.', ''),
+                                            context=context
+                                        )
+        model_obj = self.pool.get('ir.model.data')
+        action_obj = self.pool.get('ir.actions.act_window')
+        action_id = model_obj.get_object_reference(cr, uid, 'account', 'action_bank_statement_tree')[1]
+        res = action_obj.read(cr, uid, action_id)
+        res['domain'] = res['domain'][:-1] + ",('id', '=', %d)]" % sid
+        return res

=== added file 'account_statement_base_import/wizard/import_statement_view.xml'
--- account_statement_base_import/wizard/import_statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_base_import/wizard/import_statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="statement_importer_view" model="ir.ui.view">
+            <field name="name">credit.statement.import.config.view</field>
+            <field name="model">credit.statement.import</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Import statement">
+                    <group colspan="4" >
+                        <field name="profile_id" on_change="onchange_profile_id(profile_id)"/>
+                        <field name="input_statement" filename="file_name" colspan="2"/>
+                        <field name="file_name" colspan="2" invisible="1"/>
+                        <separator string="Import Parameters Summary" colspan="4"/>
+                        <field name="partner_id" readonly="1"/>
+                        <field name="journal_id" readonly="1"/>
+                        <field name="receivable_account_id" readonly="1"/>
+                        <field name="force_partner_on_bank" readonly="1"/>
+                        <field name="balance_check" readonly="1"/>
+                    </group>
+                    <separator string="" colspan="4"/>
+                    <group colspan="4" col="6">
+                        <button  icon="gtk-cancel" special="cancel" string="Cancel"/>
+                        <button  icon="gtk-ok" name="import_statement" string="Import statement" type="object"/>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <record id="statement_importer_action" model="ir.actions.act_window">
+            <field name="name">Import statement</field>
+            <field name="res_model">credit.statement.import</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="view_id" ref="statement_importer_view"/>
+            <field name="target">new</field>
+        </record>
+
+        <menuitem id="statement_importer_menu" name="Import Bank Statement" action="statement_importer_action" parent="account.menu_finance_bank_and_cash"/>
+
+    </data>
+</openerp>

=== added directory 'account_statement_commission'
=== added file 'account_statement_commission/__init__.py'
--- account_statement_commission/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_commission/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 Camptocamp SA
+#    Copyright 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
+#
+#    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/>.
+#
+##############################################################################
+import commission

=== added file 'account_statement_commission/__openerp__.py'
--- account_statement_commission/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_commission/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 Camptocamp SA
+#    Copyright 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>)
+#
+#    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': "Bank statement import - commissions",
+    'version': '1.0',
+    'author': 'Camptocamp',
+    'maintainer': 'Camptocamp',
+    'category': 'Finance',
+    'complexity': 'normal',
+    'depends': [
+        'account_statement_base_import'
+    ],
+    'description': """
+This module brings commission support to bank statement imports. It computes the sum of a commission
+field on each transaction and creates a statement entry for it.
+""",
+'website': 'http://www.camptocamp.com',
+'data': [
+    "statement_view.xml",
+    "import_statement_view.xml",
+],
+'test': [],
+'installable': True,
+'images': [],
+'auto_install': False,
+'license': 'AGPL-3',
+}

=== added file 'account_statement_commission/commission.py'
--- account_statement_commission/commission.py	1970-01-01 00:00:00 +0000
+++ account_statement_commission/commission.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,72 @@
+from openerp.tools.translate import _
+import datetime
+from openerp.osv import orm, fields
+
+
+def float_or_zero(val):
+    return float(val) if val else 0.0
+
+
+class AccountStatementProfil(orm.Model):
+    _inherit = "account.statement.profile"
+
+    def _write_extra_statement_lines(
+            self, cr, uid, parser, result_row_list, profile, statement_id, context):
+        """Prepare the global commission line if there is one.
+        """
+        global_commission_amount = 0
+        for row in parser.result_row_list:
+            global_commission_amount += float_or_zero(row.get('commission_amount', '0.0'))
+        if not global_commission_amount:
+            return
+        partner_id = profile.partner_id and profile.partner_id.id or False
+        commission_account_id = profile.commission_account_id and profile.commission_account_id.id or False
+        commission_analytic_id = profile.commission_analytic_id and profile.commission_analytic_id.id or False
+        comm_values = {
+            'name': 'IN ' + _('Commission line'),
+            'date': parser.get_st_vals().get('date') or datetime.datetime.now(),
+            'amount': global_commission_amount,
+            'partner_id': partner_id,
+            'type': 'general',
+            'statement_id': statement_id,
+            'account_id': commission_account_id,
+            'ref': 'commission',
+            'analytic_account_id': commission_analytic_id,
+            # !! We set the already_completed so auto-completion will not update those values!
+            'already_completed': True,
+        }
+        statement_line_obj = self.pool.get('account.bank.statement.line')
+        statement_line_obj.create(cr, uid, comm_values, context=context)
+
+
+class AccountStatementLineWithCommission(orm.Model):
+    _inherit = "account.bank.statement.line"
+    _columns = {
+        'commission_amount': fields.sparse(
+            type='float',
+            string='Line Commission Amount',
+            serialization_field='additionnal_bank_fields'),
+    }
+
+
+class CreditPartnerStatementImporter(orm.TransientModel):
+    _inherit = "credit.statement.import"
+
+    _columns = {
+        'commission_account_id': fields.many2one('account.account',
+                                                 'Commission account'),
+        'commission_analytic_id': fields.many2one('account.analytic.account',
+                                                 'Commission analytic account'),
+    }
+
+    def onchange_profile_id(self, cr, uid, ids, profile_id, context=None):
+        res = super(CreditPartnerStatementImporter, self).onchange_profile_id(
+            cr, uid, ids, profile_id, context=context)
+        if profile_id:
+            c = self.pool.get("account.statement.profile").browse(
+                    cr, uid, profile_id, context=context)
+            res['value']['commission_account_id'] = \
+                c.commission_account_id and c.commission_account_id.id or False
+            res['value']['commission_a'] = \
+                c.commission_analytic_id and c.commission_analytic_id.id or False
+        return res

=== added directory 'account_statement_commission/i18n'
=== added file 'account_statement_commission/i18n/account_statement_commission.pot'
--- account_statement_commission/i18n/account_statement_commission.pot	1970-01-01 00:00:00 +0000
+++ account_statement_commission/i18n/account_statement_commission.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,53 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_commission
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 11:58+0000\n"
+"PO-Revision-Date: 2014-01-21 11:58+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_statement_commission
+#: field:credit.statement.import,commission_account_id:0
+msgid "Commission account"
+msgstr ""
+
+#. module: account_statement_commission
+#: model:ir.model,name:account_statement_commission.model_account_bank_statement_line
+msgid "Bank Statement Line"
+msgstr ""
+
+#. module: account_statement_commission
+#: model:ir.model,name:account_statement_commission.model_credit_statement_import
+msgid "credit.statement.import"
+msgstr ""
+
+#. module: account_statement_commission
+#: field:credit.statement.import,commission_analytic_id:0
+msgid "Commission analytic account"
+msgstr ""
+
+#. module: account_statement_commission
+#: model:ir.model,name:account_statement_commission.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+
+#. module: account_statement_commission
+#: field:account.bank.statement.line,commission_amount:0
+msgid "Line Commission Amount"
+msgstr ""
+
+#. module: account_statement_commission
+#: code:addons/account_statement_commission/commission.py:24
+#, python-format
+msgid "Commission line"
+msgstr ""
+

=== added file 'account_statement_commission/import_statement_view.xml'
--- account_statement_commission/import_statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_commission/import_statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="statement_importer_view" model="ir.ui.view">
+            <field name="name">credit.statement.import.config.view</field>
+            <field name="model">credit.statement.import</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="account_statement_base_import.statement_importer_view" />
+            <field name="arch" type="xml">
+                <xpath expr="/form/group/field[@name='journal_id']" position="after">
+                    <field name="commission_account_id" readonly="1"/>
+                    <field name="commission_analytic_id" readonly="1"/>
+                </xpath>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added file 'account_statement_commission/statement_view.xml'
--- account_statement_commission/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_commission/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <record id="bank_statement_view_form" model="ir.ui.view">
+        <field name="name">account_bank_statement.bank_statement.view_form</field>
+        <field name="model">account.bank.statement</field>
+        <field name="inherit_id" ref="account_statement_base_completion.bank_statement_view_form" />
+        <field name="type">form</field>
+        <field eval="20" name="priority"/>
+        <field name="arch" type="xml">
+            <data>
+                <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='label']" position="after">
+                    <field name="commission_amount" />
+                </xpath>
+            </data>
+        </field>
+    </record>
+
+</data>
+</openerp>

=== added directory 'account_statement_completion_voucher'
=== added file 'account_statement_completion_voucher/__init__.py'
--- account_statement_completion_voucher/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_completion_voucher/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################

=== added file 'account_statement_completion_voucher/__openerp__.py'
--- account_statement_completion_voucher/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_completion_voucher/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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': "Bank statement extension with voucher",
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': [
+     'account_statement_base_completion',
+     'account_voucher'
+     ],
+ 'description': """
+ This module is only needed when using account_statement_base_completion with voucher in order adapt the view correctly.
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'init_xml': [],
+ 'update_xml': [
+    "statement_view.xml",
+ ],
+ 'demo_xml': [],
+ 'test': [],
+ 'installable': False,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+}

=== added file 'account_statement_completion_voucher/statement_view.xml'
--- account_statement_completion_voucher/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_completion_voucher/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <!-- Override what we have in account_statement_base_completion to replace the one in the voucher -->
+    <!-- <record id="account_statement_base_completion.bank_statement_view_form2" model="ir.ui.view">
+         <field name="name">account_bank_statement_import_base.bank_statement.auto_cmpl</field>
+         <field name="model">account.bank.statement</field>
+         <field name="inherit_id" ref="account_voucher.view_bank_statement_tree_voucher" />
+         <field name="type">form</field>
+         <field name="arch" type="xml">
+             <data>
+                 <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='voucher_id']" position="after">
+                    <field name="already_completed" />
+                 </xpath>
+             </data>
+         </field>
+     </record> -->
+    
+</data>
+</openerp>

=== added directory 'account_statement_ext'
=== added file 'account_statement_ext/__init__.py'
--- account_statement_ext/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+
+import statement
+import report
+import account
+import voucher
\ No newline at end of file

=== added file 'account_statement_ext/__openerp__.py'
--- account_statement_ext/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-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/>.
+#
+##############################################################################
+
+{'name': "Bank statement extension and profiles",
+ 'version': '1.3.4',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': ['account',
+             'report_webkit',
+             'account_voucher'],
+ 'description': """
+ Improve the basic bank statement, by adding various new features,
+ and help dealing with huge volume of reconciliation through payment offices such as Paypal, Lazer,
+ Visa, Amazon...
+
+ It is mostly used for E-commerce but can be useful for other use cases as it introduces a
+ notion of profile on the bank statement to have more control on the generated entries. It serves as
+ a base for all new features developped to improve the reconciliation process (see our other
+ set of modules:
+
+ * account_statement_base_completion
+ * account_statement_base_import
+ * account_advanced_reconcile
+
+ Features:
+
+ 1) Improve the bank statement: allows to  define profiles (for each
+ Office or Bank). The bank statement will then generate the entries based on some criteria chosen
+ in the selected profile. You can setup on the profile:
+
+  - the journal to use
+  - use balance check or not
+  - account commission and Analytic account for commission
+  - partner concerned by the profile (used in commission and optionaly on generated credit move)
+  - use a specific credit account (instead of the receivalble/payable default one)
+  - force Partner on the counter-part move (e.g. 100.- debit, Partner: M.Martin; 100.- credit, Partner: HSBC)
+
+ 2) Add a report on bank statement that can be used for checks remittance
+
+ 3) When an error occurs in a bank statement confirmation, go through all line anyway and summarize
+    all the erronous line in a same popup instead of raising and crashing on every step.
+
+ 4) Remove the period on the bank statement, and compute it for each line based on their date instead.
+    It also adds this feature in the voucher in order to compute the period correctly.
+
+ 5) Cancelling a bank statement is much more easy and will cancel all related entries, unreconcile them,
+    and finally delete them.
+
+ 6) Add the ID in entries view so that you can easily filter on a statement ID to reconcile all related
+    entries at once (e.g. one statement (ID 100) for paypal on an intermediate account, and then another for
+    the bank on the bank account. You can then manually reconcile all the line from the first one with
+    one line of the second by finding them through the statement ID.)
+
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'data': ['statement_view.xml',
+          'report/bank_statement_webkit_header.xml',
+          'report.xml',
+          'security/ir.model.access.csv',
+          'security/ir_rule.xml'],
+ 'demo_xml': [],
+ 'test': ['test/test_profile_related_fields.yml'],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'active': False,
+ }

=== added file 'account_statement_ext/account.py'
--- account_statement_ext/account.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/account.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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
+from openerp.osv import fields
+
+
+class account_move(Model):
+    _inherit = 'account.move'
+
+    def unlink(self, cr, uid, ids, context=None):
+        """
+        Delete the reconciliation when we delete the moves. This
+        allow an easier way of cancelling the bank statement.
+        """
+        reconcile_to_delete = []
+        reconcile_obj = self.pool.get('account.move.reconcile')
+        for move in self.browse(cr, uid, ids, context=context):
+            for move_line in move.line_id:
+                if move_line.reconcile_id:
+                    reconcile_to_delete.append(move_line.reconcile_id.id)
+        reconcile_obj.unlink(cr, uid, reconcile_to_delete, context=context)
+        return super(account_move, self).unlink(cr, uid, ids, context=context)

=== added directory 'account_statement_ext/i18n'
=== added file 'account_statement_ext/i18n/fr.po'
--- account_statement_ext/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_statement_ext/i18n/fr.po	2014-03-27 09:24:37 +0000
@@ -0,0 +1,301 @@
+#. module: account_statement_ext
+#: model:ir.actions.act_window,name:account_statement_ext.action_treasury_statement_profile_tree
+#: model:ir.ui.menu,name:account_statement_ext.menu_treasury_statement_profile_tree
+msgid "Bank Statements Profile"
+msgstr "Profil de relevé bancaire"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:423
+#, python-format
+msgid "Can not determine account"
+msgstr "Impossible de trouver le compte"
+
+#. module: account_statement_ext
+#: constraint:account.move:0
+msgid "You can not create more than one move per period on centralized journal"
+msgstr ""
+"Vous ne pouvez pas créer plus d'un mouvement par période dans un journal "
+"centralisateur"
+
+#. module: account_statement_ext
+#: view:account.statement.profile:0
+msgid "Import statement"
+msgstr "Importation du relevé"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,bank_statement_prefix:0
+msgid "Bank Statement Prefix"
+msgstr "Préfixe du N° de Relevé"
+
+#. module: account_statement_ext
+#: field:account.bank.statement,profile_id:0
+msgid "Profil"
+msgstr "Profil"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:362
+#, python-format
+msgid "Please verify that an account is defined in the journal."
+msgstr "Veuillez vérifier que ce compte est défini au niveau du journal."
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:361
+#, python-format
+msgid "Configuration Error!"
+msgstr "Erreur de configuration !"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,receivable_account_id:0
+msgid "Force Receivable/Payable Account"
+msgstr "Remplacer le compte client/fournisseur par défaut par "
+
+#. module: account_statement_ext
+#: field:account.statement.profile,commission_account_id:0
+msgid "Commission account"
+msgstr "Compte de commission"
+
+#. module: account_statement_ext
+#: view:account.bank.statement:0
+#: field:account.bank.statement,credit_partner_id:0
+msgid "Financial Partner"
+msgstr "Banque ou Organisme financier"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:307
+#: code:addons/account_statement_ext/statement.py:372
+#, python-format
+msgid "Error!"
+msgstr "Erreur !"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,partner_id:0
+msgid "Bank/Payment Office partner"
+msgstr "Banque ou Organisme financier"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:373
+#, python-format
+msgid "The account entries lines are not in valid state."
+msgstr "Les écritures comptables ne sont pas équilibrées."
+
+#. module: account_statement_ext
+#: constraint:account.statement.profile:0
+msgid "You need to put a partner if you tic the 'Force partner on bank move' !"
+msgstr ""
+"Vous devez choisir un partenaire si vous cochez 'Remplacer le compte client/fournisseur' !"
+
+#. module: account_statement_ext
+#: help:account.statement.profile,force_partner_on_bank:0
+msgid ""
+"Tic that box if you want to use the credit insitute "
+"partner                                                    in the "
+"counterpart of the intermediat/banking move."
+msgstr ""
+"Cochez cette case si vous voulez utiliser le partenaire financier dans "
+"la contrepartie de l'écriture."
+
+#. module: account_statement_ext
+#: report:addons/account_statement_ext/report/bank_statement_report.mako:20
+msgid "Date"
+msgstr "Date"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:308
+#, python-format
+msgid "Journal item \"%s\" is not valid."
+msgstr "L'écriture \"%s\" n'est pas équilibrée."
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:424
+#, python-format
+msgid "Please ensure that minimal properties are set"
+msgstr "Veuillez vérifiez que les propriétés minimales sont bien paramétrées"
+
+#. module: account_statement_ext
+#: view:account.bank.statement:0
+msgid "Balance Check"
+msgstr "Contrôle sur solde final"
+
+#. module: account_statement_ext
+#: view:account.bank.statement:0
+msgid "Profile Details"
+msgstr "Détails du profil"
+
+#. module: account_statement_ext
+#: model:ir.model,name:account_statement_ext.model_account_statement_profile
+msgid "Statement Profil"
+msgstr "Profil du relevé"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,name:0
+msgid "Name"
+msgstr "Nom"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,commission_analytic_id:0
+msgid "Commission analytic account"
+msgstr "Compte analytique où affecter la commission"
+
+#. module: account_statement_ext
+#: constraint:account.move:0
+msgid "The date of your Journal Entry is not in the defined period!"
+msgstr "La date de l'écriture n'est pas dans la période définie!"
+
+#. module: account_statement_ext
+#: help:account.statement.profile,balance_check:0
+msgid ""
+"Tic that box if you want OpenERP to control the start/"
+"end                                                     balance before "
+"confirming a bank statement. If don't ticked, "
+"no                                                     balance control will "
+"be done."
+msgstr ""
+"Cochez cette case si vous voulez qu'OpenERP fasse "
+"une vérification au niveau du solde final avant confirmation."
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/report/bank_statement_report.py:40
+#: code:addons/account_statement_ext/report/bank_statement_report.py:48
+#, python-format
+msgid "BORDEREAU DE REMISE DE CHEQUES"
+msgstr "BORDEREAU DE REMISE DE CHEQUES"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:400
+#, python-format
+msgid "Statement %s is confirmed, journal items are created."
+msgstr "Le relevé %s est confirmé, les écritures comptables ont été générées."
+
+#. module: account_statement_ext
+#: report:addons/account_statement_ext/report/bank_statement_report.mako:37
+msgid "Montant"
+msgstr "Montant"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:394
+#, python-format
+msgid "Error"
+msgstr "Erreur"
+
+#. module: account_statement_ext
+#: help:account.statement.profile,partner_id:0
+msgid ""
+"Put a partner if you want to have it on the commission "
+"move                                       (and optionaly on the counterpart "
+"of the intermediate/banking move                                       if "
+"you tic the corresponding checkbox)."
+msgstr ""
+"Sélectionnez un partenaire si vous voulez l'avoir dans l'écriture comptable "
+"au niveau de la commision (et du compte de trésorerie selon les cas si vous cochez "
+"la case 'Indiquer un partenaire sur la ligne d'écriture de la banque ou organisme')."
+
+#. module: account_statement_ext
+#: constraint:account.bank.statement.line:0
+msgid ""
+"The amount of the voucher must be the same amount as the one on the "
+"statement line"
+msgstr ""
+"Le montant du justificatif doit être identique à celui de la ligne le "
+"concernant sur le relevé"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/report/bank_statement_report.py:57
+#, python-format
+msgid "Page"
+msgstr "Page"
+
+#. module: account_statement_ext
+#: field:account.bank.statement,balance_check:0
+#: field:account.statement.profile,balance_check:0
+msgid "Balance check"
+msgstr "Activation contrôle du solde final"
+
+#. module: account_statement_ext
+#: model:ir.model,name:account_statement_ext.model_account_bank_statement_line
+msgid "Bank Statement Line"
+msgstr "Ligne de relevé bancaire"
+
+#. module: account_statement_ext
+#: model:ir.model,name:account_statement_ext.model_account_move
+msgid "Account Entry"
+msgstr "Écriture comptable"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,force_partner_on_bank:0
+msgid "Force partner on bank move"
+msgstr "Indiquer un partenaire sur la ligne d'écriture de la banque"
+
+#. module: account_statement_ext
+#: report:addons/account_statement_ext/report/bank_statement_report.mako:33
+msgid "Reference"
+msgstr "Référence"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:380
+#, python-format
+msgid "No Analytic Journal !"
+msgstr "Pas de journal analytique trouvé !"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/report/bank_statement_report.py:57
+#, python-format
+msgid "of"
+msgstr "de"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,bank_statement_ids:0
+msgid "Bank Statement Imported"
+msgstr "Relevé importé"
+
+#. module: account_statement_ext
+#: field:account.bank.statement.line,period_id:0
+msgid "Period"
+msgstr "Période"
+
+#. module: account_statement_ext
+#: constraint:account.bank.statement:0
+msgid "The journal and period chosen have to belong to the same company."
+msgstr "Le journal et la période doivent appartenir à la même société."
+
+#. module: account_statement_ext
+#: model:ir.actions.report.xml,name:account_statement_ext.report_bank_statement_webkit
+#: model:ir.model,name:account_statement_ext.model_account_bank_statement
+msgid "Bank Statement"
+msgstr "Relevé bancaire"
+
+#. module: account_statement_ext
+#: report:addons/account_statement_ext/report/bank_statement_report.mako:35
+msgid "Partenaire"
+msgstr "Partenaire"
+
+#. module: account_statement_ext
+#: help:account.statement.profile,receivable_account_id:0
+msgid ""
+"Choose a receivable account to force the "
+"default                                                        debit/credit "
+"account (eg. an intermediat bank account instead "
+"of                                                        default debitors)."
+msgstr ""
+"Sélectionnez un compte de type client ou fournisseur afin de remplacer "
+"le compte client ou fournisseur par défaut"
+
+#. module: account_statement_ext
+#: code:addons/account_statement_ext/statement.py:381
+#, python-format
+msgid "You have to assign an analytic journal on the '%s' journal!"
+msgstr "Vous devez associer un journal analytique au journal comptable '%s'."
+
+#. module: account_statement_ext
+#: model:ir.actions.act_window,name:account_statement_ext.act_bank_statement_from_profile
+msgid "Open Statements"
+msgstr "Relevés ouverts"
+
+#. module: account_statement_ext
+#: field:account.statement.profile,journal_id:0
+msgid "Financial journal to use for transaction"
+msgstr "Journal à utiliser pour cette écriture"
+
+#. module: account_statement_ext
+#: report:addons/account_statement_ext/report/bank_statement_report.mako:19
+msgid "Bordereau"
+msgstr "Bordereau"

=== added directory 'account_statement_ext/report'
=== added file 'account_statement_ext/report.xml'
--- account_statement_ext/report.xml	1970-01-01 00:00:00 +0000
+++ account_statement_ext/report.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0" ?>
+<openerp>
+    <data>
+
+        <report auto="False"
+            id="report_bank_statement_webkit"
+            model="account.bank.statement"
+            name="bank_statement_webkit"
+            file="account_statement_ext/report/bank_statement_report.mako"
+            string="Bank Statement"
+            report_type="webkit"
+            webkit_header="account_statement_ext.bank_statement_landscape_header"
+            header="1"/>
+
+        <record id="action_print_bank_statement_webkit" model="ir.values">
+            <field name="name">Bank Statement</field>
+            <field name="key2">client_print_multi</field>
+            <field name="value_unpickle"
+                eval="'ir.actions.report.xml,' +str(ref('report_bank_statement_webkit'))"/>
+            <field name="key">action</field>
+            <field name="model">account.bank.statement</field>
+        </record>
+
+    </data>
+</openerp>

=== added file 'account_statement_ext/report/__init__.py'
--- account_statement_ext/report/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/report/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import bank_statement_report

=== added file 'account_statement_ext/report/bank_statement_report.mako'
--- account_statement_ext/report/bank_statement_report.mako	1970-01-01 00:00:00 +0000
+++ account_statement_ext/report/bank_statement_report.mako	2014-03-27 09:24:37 +0000
@@ -0,0 +1,70 @@
+## -*- coding: utf-8 -*-
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+    <head>
+        <style type="text/css">
+            ${css}
+        </style>
+    </head>
+    <body>
+           <%!
+            def amount(text):
+                return text.replace('-', '&#8209;')  # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
+            %>
+
+            <%setLang(user.partner_id.lang)%>
+           %for statement in objects:
+
+            <div class="act_as_table data_table">
+                <div class="act_as_row labels">
+                    <div class="act_as_cell">${_('Bordereau')}</div>
+                    <div class="act_as_cell">${_('Date')}</div>
+                </div>
+                <div class="act_as_row">
+                    <div class="act_as_cell">${ statement.name }</div>
+                    <div class="act_as_cell">${ formatLang(statement.date,date=True)  }</div>
+                </div>
+            </div>
+
+            <!-- we use div with css instead of table for tabular data because div do not cut rows at half at page breaks -->
+                <div class="act_as_table list_table" style="margin-top: 10px;">
+                    <div class="act_as_thead">
+                        <div class="act_as_row labels">
+                            ## date
+                            <div class="act_as_cell first_column" style="width: 100px;">${_('Reference')}</div>
+                            ## period
+                            <div class="act_as_cell" style="width: 175px;">${_('Partenaire')}</div>
+                            ## move
+                            <div class="act_as_cell" style="width: 60px;">${_('Montant')}</div>
+                            ## journal
+                        </div>
+                    </div>
+                <% sum_statement = 0.0 %>
+    	        %for statementline in statement.line_ids:
+                    <div class="act_as_tbody">
+                       ## curency code
+                       <div class="act_as_cell">${statementline.name or '' }</div>
+                       ## currency balance
+                       <div class="act_as_cell">${statementline.partner_id.name or '' }</div>
+                       ## currency balance cumulated
+                       <div class="act_as_cell amount">${formatLang(statementline.amount) | amount }</div>
+                       <% sum_statement += statementline.amount %>
+                    </div>
+    	        %endfor
+                    <div class="act_as_tbody">
+                       ## curency code
+                       <div class="act_as_cell"></div>
+                       ## currency balance
+                       <div class="act_as_cell">Total</div>
+                       ## currency balance cumulated
+                       <div class="act_as_cell amount_total">${formatLang(sum_statement) }</div>
+                    </div>
+
+              </div>
+          %endfor
+
+     
+
+
+    </body>
+</html>

=== added file 'account_statement_ext/report/bank_statement_report.py'
--- account_statement_ext/report/bank_statement_report.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/report/bank_statement_report.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,71 @@
+# -*- coding utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi. 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.report import report_sxw
+from openerp.tools.translate import _
+from openerp import pooler
+from datetime import datetime
+from report_webkit import webkit_report
+
+
+class BankStatementWebkit(report_sxw.rml_parse):
+
+    def __init__(self, cr, uid, name, context):
+        super(BankStatementWebkit, self).__init__(cr, uid, name, context=context)
+        self.pool = pooler.get_pool(self.cr.dbname)
+        self.cursor = self.cr
+
+        company = self.pool.get('res.users').browse(
+                self.cr, uid, uid, context=context).company_id
+        header_report_name = ' - '.join((_('BORDEREAU DE REMISE DE CHEQUES'),
+                                         company.name, company.currency_id.name))
+        footer_date_time = self.formatLang(str(datetime.today())[:19], date_time=True)
+        self.localcontext.update({
+            'cr': cr,
+            'uid': uid,
+            'get_bank_statement': self._get_bank_statement_data,
+            'report_name': _('BORDEREAU DE REMISE DE CHEQUES'),
+            'additional_args': [
+                ('--header-font-name', 'Helvetica'),
+                ('--footer-font-name', 'Helvetica'),
+                ('--header-font-size', '10'),
+                ('--footer-font-size', '6'),
+                ('--header-left', header_report_name),
+                ('--header-spacing', '2'),
+                ('--footer-left', footer_date_time),
+                ('--footer-right', ' '.join((_('Page'), '[page]', _('of'), '[topage]'))),
+                ('--footer-line',),
+            ],
+        })
+
+    def _get_bank_statement_data(self, statement):
+        statement_obj = self.pool.get('account.bank.statement.line')
+        statement_line_ids = statement_obj.search(
+                self.cr,
+                self.uid,
+                [('statement_id', '=', statement.id)])
+        statement_lines = statement_obj.browse(
+                self.cr, self.uid, statement_line_ids)
+        return statement_lines
+
+webkit_report.WebKitParser('report.bank_statement_webkit',
+                           'account.bank.statement',
+                           'addons/account_statement_ext/report/bank_statement_report.mako',
+                           parser=BankStatementWebkit)

=== added file 'account_statement_ext/report/bank_statement_webkit_header.xml'
--- account_statement_ext/report/bank_statement_webkit_header.xml	1970-01-01 00:00:00 +0000
+++ account_statement_ext/report/bank_statement_webkit_header.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,180 @@
+<?xml version="1.0" ?>
+<openerp>
+    <data>
+        <record id="bank_statement_landscape_header" model="ir.header_webkit">
+            <field name="footer_html"><![CDATA[
+<html>
+    <head>
+        <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+        <script>
+            function subst() {
+            var vars={};
+            var x=document.location.search.substring(1).split('&');
+            for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+            var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+            for(var i in x) {
+            var y = document.getElementsByClassName(x[i]);
+            for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+                }
+            }
+        </script>
+    </head>
+    <% import datetime %>
+    <body style="border:0; margin: 0;" onload="subst()">
+        <table style="border-top: 1px solid black; width: 1080px">
+            <tr style="border-collapse:collapse;">
+                <td style="text-align:left;font-size:10;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td>
+                <td style="text-align:center;font-size:10;width:350px;">${user.name}</td>
+                <td style="text-align:right;font-size:10;width:350px;">Page&nbsp;<span class="page"/></td>
+                <td style="text-align:left;font-size:10;width:30px">&nbsp;of&nbsp;<span class="topage"/></td>
+            </tr>
+        </table>
+    </body>
+</html>]]></field>
+            <field name="orientation">Portrait</field>
+            <field name="format">A4</field>
+            <field name="html"><![CDATA[
+<html>
+    <head>
+        <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+        <script>
+            function subst() {
+            var vars={};
+            var x=document.location.search.substring(1).split('&');
+            for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+            var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+            for(var i in x) {
+            var y = document.getElementsByClassName(x[i]);
+            for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+                }
+            }
+        </script>
+        <style type="text/css">
+            ${css}
+        </style>
+    </head>
+    <body style="border:0; margin: 0;" onload="subst()">
+        <table class="header" style="border-bottom: 0px solid black; width: 100%">
+            <tr>
+                <td style="text-align:left; font-size:11px; font-weight: bold;"><span style="text-transform:uppercase; font-size:12px;">${report_name}</span> - ${company.partner_id.name | entity} - ${company.currency_id.name | entity}</td>
+            </tr>
+        </table> ${_debug or ''|n} </body>
+</html>]]>
+            </field>
+            <field eval="0.0" name="margin_top"/>
+            <field name="css"><![CDATA[
+
+body, table, td, span, div {
+    font-family: Helvetica, Arial;
+}
+
+.act_as_table {
+    display: table;
+}
+.act_as_row  {
+    display: table-row;
+}
+.act_as_cell {
+    display: table-cell;
+}
+.act_as_thead {
+    display: table-header-group;
+}
+.act_as_tbody {
+    display: table-row-group;
+}
+.act_as_tfoot {
+    display: table-footer-group;
+}
+.act_as_caption {
+    display: table-caption;
+}
+act_as_colgroup {
+    display: table-column-group;
+}
+
+.list_table, .data_table {
+    width: 720px;
+    table-layout: fixed
+}
+
+.bg, .act_as_row.labels {
+    background-color:#F0F0F0;
+}
+
+.list_table, .data_table, .list_table .act_as_row {
+    border-left:0px;
+    border-right:0px;
+    text-align:left;
+    font-size:9px;
+    padding-right:3px;
+    padding-left:3px;
+    padding-top:2px;
+    padding-bottom:2px;
+    border-collapse:collapse;
+}
+
+.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines {
+    border-color:gray;
+    border-bottom:1px solid lightGrey;
+}
+
+.data_table .act_as_cell {
+    border: 1px solid lightGrey;
+    text-align: center;
+}
+
+.data_table .act_as_cell, .list_table .lines .act_as_cell {
+    word-wrap: break-word;
+}
+
+.nobreak {
+    word-wrap: normal;
+}
+
+.data_table .act_as_row.labels {
+    font-weight: bold;
+}
+
+.initial_balance .act_as_cell {
+    font-style:italic;
+}
+
+.account_title {
+    font-size:10px;
+    font-weight:bold;
+    page-break-after: avoid;
+}
+
+.act_as_cell.amount {
+    word-wrap:normal;
+    text-align:right;
+}
+
+.act_as_cell.amount_total {
+    word-wrap:normal;
+    text-align:right;
+    font-weight: bold;
+}
+
+
+.list_table .act_as_cell{
+    padding-left: 5px;
+/*    border-right:1px solid lightGrey;  uncomment to active column lines */
+}
+.list_table .act_as_cell.first_column {
+    padding-left: 0px;
+/*    border-left:1px solid lightGrey; uncomment to active column lines */
+}
+
+.sep_left {
+    border-left: 1px solid lightGrey;
+}
+
+
+]]>
+            </field>
+            <field name="name">Bank Statement Landscape Header</field>
+        </record>
+    </data>
+</openerp>

=== added directory 'account_statement_ext/security'
=== added file 'account_statement_ext/security/ir.model.access.csv'
--- account_statement_ext/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ account_statement_ext/security/ir.model.access.csv	2014-03-27 09:24:37 +0000
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_account_bank_st_profile_user,account.statement.profile,model_account_statement_profile,account.group_account_user,1,1,0,0
+access_account_bank_st_profile_manager,account.statement.profile,model_account_statement_profile,account.group_account_manager,1,1,1,1

=== added file 'account_statement_ext/security/ir_rule.xml'
--- account_statement_ext/security/ir_rule.xml	1970-01-01 00:00:00 +0000
+++ account_statement_ext/security/ir_rule.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,10 @@
+<openerp>
+    <data noupdate="1">
+        <record id="account_bank_statement_profile_rule" model="ir.rule">
+            <field name="name">Bank statement profile multi-company</field>
+            <field name="model_id" ref="model_account_statement_profile"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
+        </record>
+    </data>
+</openerp> 
\ No newline at end of file

=== added file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,745 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+import openerp.addons.account.account_bank_statement as stat_mod
+from openerp.osv.orm import Model
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+
+# Monkey patch to fix bad write implementation...
+def fixed_write(self, cr, uid, ids, vals, context=None):
+    """ Fix performance desing of original function
+    Ideally we should use a real PostgreSQL sequence or serial fields.
+    I will do it when I have time."""
+    res = super(stat_mod.account_bank_statement, self).write(cr, uid, ids,
+                                                             vals, context=context)
+    if ids: # will be false for an new empty bank statement
+        cr.execute("UPDATE account_bank_statement_line"
+                   " SET sequence = account_bank_statement_line.id + 1"
+                   " where statement_id in %s", (tuple(ids),))
+    return res
+stat_mod.account_bank_statement.write = fixed_write
+
+
+class AccountStatementProfile(Model):
+    """
+    A Profile will contain all infos related to the type of
+    bank statement, and related generated entries. It defines the
+    journal to use, the partner and commision account and so on.
+    """
+    _name = "account.statement.profile"
+    _inherit = ['mail.thread']
+
+    _description = "Statement Profile"
+    _order = 'sequence'
+
+    _columns = {
+        'name': fields.char('Name', required=True),
+        'sequence': fields.integer('Sequence', help="Gives a sequence in lists, the first profile will be used as default"),
+        'partner_id': fields.many2one(
+            'res.partner',
+            'Bank/Payment Office partner',
+             help="Put a partner if you want to have it on the "
+                  "commission move (and optionaly on the counterpart "
+                  "of the intermediate/banking move if you tick the "
+                  "corresponding checkbox)."),
+
+        'journal_id': fields.many2one(
+            'account.journal',
+             'Financial journal to use for transaction',
+             required=True),
+
+        'commission_account_id': fields.many2one(
+            'account.account',
+             'Commission account',
+             required=True),
+
+        'commission_analytic_id': fields.many2one(
+            'account.analytic.account',
+            'Commission analytic account'),
+
+        'receivable_account_id': fields.many2one(
+            'account.account',
+            'Force Receivable/Payable Account',
+            help="Choose a receivable account to force the default "
+                 "debit/credit account (eg. an intermediat bank account "
+                 "instead of default debitors)."),
+
+        'force_partner_on_bank': fields.boolean(
+            'Force partner on bank move',
+            help="Tick that box if you want to use the credit "
+                 "institute partner in the counterpart of the "
+                 "intermediate/banking move."),
+
+        'balance_check': fields.boolean(
+            'Balance check',
+            help="Tick that box if you want OpenERP to control "
+                 "the start/end balance before confirming a bank statement. "
+                 "If don't ticked, no balance control will be done."),
+
+        'bank_statement_prefix': fields.char('Bank Statement Prefix', size=32),
+
+        'bank_statement_ids': fields.one2many('account.bank.statement',
+                                              'profile_id',
+                                              'Bank Statement Imported'),
+        'company_id': fields.many2one('res.company', 'Company'),
+    }
+
+    def _check_partner(self, cr, uid, ids, context=None):
+        obj = self.browse(cr, uid, ids[0], context=context)
+        if obj.partner_id is False and obj.force_partner_on_bank:
+            return False
+        return True
+
+    _constraints = [
+        (_check_partner, "You need to put a partner if you tic the 'Force partner on bank move'!", []),
+    ]
+    
+    _sql_constraints = [
+        ('name_uniq', 'unique (name, company_id)', 'The name of the bank statement must be unique !')
+    ]
+
+
+
+class AccountBankStatement(Model):
+    """
+    We improve the bank statement class mostly for :
+    - Removing the period and compute it from the date of each line.
+    - Allow to remove the balance check depending on the chosen profile
+    - Report errors on confirmation all at once instead of crashing onr by one
+    - Add a profile notion that can change the generated entries on statement
+      confirmation.
+     For this, we had to override quite some long method and we'll need to maintain
+     them up to date. Changes are point up by '#Chg' comment.
+     """
+
+    _inherit = "account.bank.statement"
+
+    def _default_period(self, cr, uid, context=None):
+        """
+        Statement default period
+        """
+        if context is None:
+            context = {}
+        period_obj = self.pool.get('account.period')
+        periods = period_obj.find(cr, uid, dt=context.get('date'), context=context)
+        return periods and periods[0] or False
+
+    def _default_profile(self, cr, uid, context=None):
+        """
+        Returns the default statement profile
+        Default profile is the one with the lowest sequence of user's company
+
+        :return profile_id or False
+        """
+        if context is None:
+            context = {}
+        user_obj = self.pool.get('res.users')
+        profile_obj = self.pool.get('account.statement.profile')
+        user = user_obj.browse(cr, uid, uid, context=context)
+        profile_ids = profile_obj.search(cr, uid, [('company_id', '=', user.company_id.id)], context=context)
+
+        return profile_ids[0] if profile_ids else False
+
+    def _get_statement_from_profile(self, cr, uid, profile_ids, context=None):
+        """Stored function field trigger.
+
+        Weirdness warning: we are in the class account.bank.statement, but
+        when the ORM calls this, self is an account.statement.profile.
+
+        Returns a list of account.bank.statement ids to recompute.
+
+        """
+        triggered = []
+        for profile in self.browse(cr, uid, profile_ids, context=context):
+            triggered += [st.id for st in profile.bank_statement_ids]
+        return triggered
+
+    def _us(self, cr, uid, ids, context=None):
+        return ids
+
+    _columns = {
+        'profile_id': fields.many2one(
+            'account.statement.profile',
+            'Bank Account Profile',
+            required=True,
+            states={'draft': [('readonly', False)]}),
+        'credit_partner_id': fields.related(
+            'profile_id',
+            'partner_id',
+            type='many2one',
+            relation='res.partner',
+            string='Financial Partner',
+            store={
+                'account.bank.statement': (_us, ['profile_id'], 10),
+                'account.statement.profile': (
+                    _get_statement_from_profile, ['partner_id'], 10),
+            },
+            readonly=True),
+        'balance_check': fields.related(
+            'profile_id',
+            'balance_check',
+            type='boolean',
+            string='Balance check',
+            store={
+                'account.bank.statement': (_us, ['profile_id'], 10),
+                'account.statement.profile': (
+                    _get_statement_from_profile, ['balance_check'], 10),
+            },
+            readonly=True
+        ),
+        'journal_id': fields.related(
+            'profile_id',
+            'journal_id',
+            type='many2one',
+            relation='account.journal',
+            string='Journal',
+            store={
+                'account.bank.statement': (_us, ['profile_id'], 10),
+                'account.statement.profile': (
+                    _get_statement_from_profile, ['journal_id'], 10),
+            },
+            readonly=True),
+        'period_id': fields.many2one(
+                        'account.period',
+                        'Period',
+                        required=False,
+                        readonly=False,
+                        invisible=True),
+    }
+
+    _defaults = {
+        'period_id': _default_period,
+        'profile_id': _default_profile,
+    }
+
+    def create(self, cr, uid, vals, context=None):
+        """Need to pass the journal_id in vals anytime because of account.cash.statement
+        need it."""
+        if 'profile_id' in vals:
+            profile_obj = self.pool.get('account.statement.profile')
+            profile = profile_obj.browse(cr, uid, vals['profile_id'], context=context)
+            vals['journal_id'] = profile.journal_id.id
+        return super(AccountBankStatement, self
+                     ).create(cr, uid, vals, context=context)
+
+    def _get_period(self, cr, uid, date, context=None):
+        """Return matching period for a date."""
+        if context is None:
+            context = {}
+        period_obj = self.pool.get('account.period')
+        local_context = context.copy()
+        local_context['account_period_prefer_normal'] = True
+        periods = period_obj.find(cr, uid, dt=date, context=local_context)
+        return periods and periods[0] or False
+
+    def _check_company_id(self, cr, uid, ids, context=None):
+        """
+        Adapt this constraint method from the account module to reflect the
+        move of period_id to the statement line
+        """
+        for statement in self.browse(cr, uid, ids, context=context):
+            # statement.company_id is a related store=True that for some
+            # reason doesn't work in YAML tests. As a workaround, I unwind it
+            # to statement.journal_id.company_id here.
+            if (statement.period_id and
+                    statement.journal_id.company_id.id !=
+                    statement.period_id.company_id.id):
+                return False
+            for line in statement.line_ids:
+                if (line.period_id and
+                        statement.journal_id.company_id.id
+                        != line.period_id.company_id.id):
+                    return False
+        return True
+
+    _constraints = [
+        (_check_company_id,
+         'The journal and period chosen have to belong to the same company.',
+         ['journal_id', 'period_id']),
+    ]
+
+    def _prepare_move(self, cr, uid, st_line, st_line_number, context=None):
+        """Add the period_id from the statement line date to the move preparation.
+           Originaly, it was taken from the statement period_id
+           :param browse_record st_line: account.bank.statement.line record to
+                  create the move from.
+           :param char st_line_number: will be used as the name of the generated account move
+           :return: dict of value to create() the account.move
+        """
+        if context is None:
+            context = {}
+        res = super(AccountBankStatement, self
+                    )._prepare_move(cr, uid, st_line, st_line_number,
+                                    context=context)
+        ctx = context.copy()
+        ctx['company_id'] = st_line.company_id.id
+        period_id = self._get_period(cr, uid, st_line.date, context=ctx)
+        res.update({'period_id': period_id})
+        return res
+
+    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):
+        """Add the period_id from the statement line date to the move preparation.
+           Originaly, it was taken from the statement period_id
+
+           :param browse_record st_line: account.bank.statement.line record to
+                  create the move from.
+           :param int/long move_id: ID of the account.move to link the move line
+           :param float debit: debit amount of the move line
+           :param float credit: credit amount of the move line
+           :param int/long currency_id: ID of currency of the move line to create
+           :param float amount_currency: amount of the debit/credit expressed in the currency_id
+           :param int/long account_id: ID of the account to use in the move line if different
+                  from the statement line account ID
+           :param int/long analytic_id: ID of analytic account to put on the move line
+           :param int/long partner_id: ID of the partner to put on the move line
+           :return: dict of value to create() the account.move.line
+        """
+        if context is None:
+            context = {}
+        res = super(AccountBankStatement, 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)
+        ctx = context.copy()
+        ctx['company_id'] = st_line.company_id.id
+        period_id = self._get_period(cr, uid, st_line.date, context=ctx)
+        res.update({'period_id': period_id})
+        return res
+
+    def _get_counter_part_partner(self, cr, uid, st_line, context=None):
+        """
+        We change the move line generated from the lines depending on the profile:
+          - If partner_id is set and force_partner_on_bank is ticked, we'll let the partner of each line
+            for the debit line, but we'll change it on the credit move line for the choosen partner_id
+            => This will ease the reconciliation process with the bank as the partner will match the bank
+            statement line
+           :param browse_record st_line: account.bank.statement.line record to
+                  create the move from.
+           :return: int/long of the res.partner to use as counterpart
+        """
+        bank_partner_id = super(AccountBankStatement, self
+                                )._get_counter_part_partner(cr, uid, st_line,
+                                                            context=context)
+        # get the right partner according to the chosen profile
+        if st_line.statement_id.profile_id.force_partner_on_bank:
+            bank_partner_id = st_line.statement_id.profile_id.partner_id.id
+        return bank_partner_id
+
+    def _get_st_number_period_profile(self, cr, uid, date, profile_id):
+        """
+        Retrieve the name of bank statement from sequence, according to the period
+        corresponding to the date passed in args. Add a prefix if set in the profile.
+
+        :param: date: date of the statement used to compute the right period
+        :param: int/long: profile_id: the account.statement.profile ID from which to take the
+                          bank_statement_prefix for the name
+        :return: char: name of the bank statement (st_number)
+
+        """
+        year = self.pool.get('account.period').browse(
+                cr, uid, self._get_period(cr, uid, date)).fiscalyear_id.id
+        profile = self.pool.get('account.statement.profile').browse(cr, uid, profile_id)
+        c = {'fiscalyear_id': year}
+        obj_seq = self.pool.get('ir.sequence')
+        journal_sequence_id = (profile.journal_id.sequence_id and
+                               profile.journal_id.sequence_id.id or False)
+        if journal_sequence_id:
+            st_number = obj_seq.next_by_id(cr, uid, journal_sequence_id, context=c)
+        else:
+            st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c)
+        if profile.bank_statement_prefix:
+            st_number = profile.bank_statement_prefix + st_number
+        return st_number
+
+    def button_confirm_bank(self, cr, uid, ids, context=None):
+        """
+        Completely override the method in order to have
+        an error message which displays all the messages
+        instead of having them pop one by one.
+        We have to copy paste a big block of code, changing the error
+        stack + managing period from date.
+
+        TODO: Log the error in a bank statement field instead of using a popup!
+        """
+        for st in self.browse(cr, uid, ids, context=context):
+
+            j_type = st.journal_id.type
+            company_currency_id = st.journal_id.company_id.currency_id.id
+            if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
+                continue
+
+            self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
+            if (not st.journal_id.default_credit_account_id) \
+                    or (not st.journal_id.default_debit_account_id):
+                raise osv.except_osv(_('Configuration Error!'),
+                                     _('Please verify that an account is defined in the journal.'))
+
+            if not st.name == '/':
+                st_number = st.name
+            else:
+# Begin Changes
+                st_number = self._get_st_number_period_profile(cr, uid, st.date, st.profile_id.id)
+# End Changes
+            for line in st.move_line_ids:
+                if line.state != 'valid':
+                    raise osv.except_osv(_('Error!'),
+                                         _('The account entries lines are not in valid state.'))
+# begin changes
+            errors_stack = []
+            for st_line in st.line_ids:
+                try:
+                    if st_line.analytic_account_id:
+                        if not st.journal_id.analytic_journal_id:
+                            raise osv.except_osv(_('No Analytic Journal!'),
+                                                 _("You have to assign an analytic"
+                                                   " journal on the '%s' journal!") % st.journal_id.name)
+                    if not st_line.amount:
+                        continue
+                    st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)
+                    self.create_move_from_st_line(cr, uid, st_line.id,
+                                                  company_currency_id,
+                                                  st_line_number,
+                                                  context)
+                except osv.except_osv, exc:
+                    msg = "Line ID %s with ref %s had following error: %s" % (st_line.id, st_line.ref, exc.value)
+                    errors_stack.append(msg)
+                except Exception, exc:
+                    msg = "Line ID %s with ref %s had following error: %s" % (st_line.id, st_line.ref, str(exc))
+                    errors_stack.append(msg)
+            if errors_stack:
+                msg = u"\n".join(errors_stack)
+                raise osv.except_osv(_('Error'), msg)
+#end changes
+            self.write(cr, uid, [st.id],
+                       {'name': st_number,
+                        'balance_end_real': st.balance_end},
+                       context=context)
+            body = _('Statement %s confirmed, journal items were created.') % st_number
+            self.message_post(cr, uid, [st.id],
+                              body,
+                              context=context)
+        return self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
+
+    def get_account_for_counterpart(self, cr, uid, amount, account_receivable, account_payable):
+        """For backward compatibility."""
+        account_id, type = self.get_account_and_type_for_counterpart(cr, uid, amount,
+                                                                     account_receivable,
+                                                                     account_payable)
+        return account_id
+
+    def _compute_type_from_partner_profile(self, cr, uid, partner_id,
+                                           default_type, context=None):
+        """Compute the statement line type
+           from partner profile (customer, supplier)"""
+        obj_partner = self.pool.get('res.partner')
+        part = obj_partner.browse(cr, uid, partner_id, context=context)
+        if part.supplier == part.customer:
+            return default_type
+        if part.supplier:
+            return 'supplier'
+        else:
+            return 'customer'
+
+    def _compute_type_from_amount(self, cr, uid, amount):
+        """Compute the statement type based on amount"""
+        if amount in (None, False):
+            return 'general'
+        if amount < 0:
+            return 'supplier'
+        return 'customer'
+
+    def get_type_for_counterpart(self, cr, uid, amount, partner_id=False):
+        """Give the amount and receive the type to use for the line.
+        The rules are:
+         - If the customer checkbox is checked on the found partner, type customer
+         - If the supplier checkbox is checked on the found partner, typewill be supplier
+         - If both checkbox are checked or none of them, it'll be based on the amount :
+              If amount is positif the type customer,
+              If amount is negativ, the type supplier
+        :param float: amount of the line
+        :param int/long: partner_id the partner id
+        :return: type as string: the default type to use: 'customer' or 'supplier'.
+        """
+        s_line_type = self._compute_type_from_amount(cr, uid, amount)
+        if partner_id:
+            s_line_type = self._compute_type_from_partner_profile(cr, uid,
+                                                                  partner_id, s_line_type)
+        return s_line_type
+
+    def get_account_and_type_for_counterpart(self, cr, uid, amount, account_receivable,
+                                             account_payable, partner_id=False):
+        """
+        Give the amount, payable and receivable account (that can be found using
+        get_default_pay_receiv_accounts method) and receive the one to use. This method
+        should be use when there is no other way to know which one to take.
+        The rules are:
+         - If the customer checkbox is checked on the found partner, type and account will be customer and receivable
+         - If the supplier checkbox is checked on the found partner, type and account will be supplier and payable
+         - If both checkbox are checked or none of them, it'll be based on the amount :
+              If amount is positive, the type and account will be customer and receivable,
+              If amount is negative, the type and account will be supplier and payable
+        Note that we return the payable or receivable account from agrs and not from the optional partner_id
+        given!
+
+        :param float: amount of the line
+        :param int/long: account_receivable the  receivable account
+        :param int/long: account_payable the payable account
+        :param int/long: partner_id the partner id
+        :return: dict with [account_id as int/long,type as string]: the default account to be used by
+            statement line as the counterpart of the journal account depending on the amount and the type
+            as 'customer' or 'supplier'.
+        """
+        account_id = False
+        ltype = self.get_type_for_counterpart(cr, uid, amount, partner_id=partner_id)
+        if ltype == 'supplier':
+            account_id = account_payable
+        else:
+            account_id = account_receivable
+        if not account_id:
+            raise osv.except_osv(
+                _('Can not determine account'),
+                _('Please ensure that minimal properties are set')
+            )
+        return [account_id, ltype]
+
+    def get_default_pay_receiv_accounts(self, cr, uid, context=None):
+        """
+        We try to determine default payable/receivable accounts to be used as counterpart
+        from the company default propoerty. This is to be used if there is no otherway to
+        find the good one, or to find a default value that will be overriden by a completion
+        method (rules of account_statement_base_completion) afterwards.
+
+        :return: tuple of int/long ID that give account_receivable, account_payable based on
+                 company default.
+        """
+        account_receivable = False
+        account_payable = False
+        property_obj = self.pool.get('ir.property')
+        model_fields_obj = self.pool.get('ir.model.fields')
+        model_fields_ids = model_fields_obj.search(
+            cr,
+            uid,
+            [('name', 'in', ['property_account_receivable',
+                             'property_account_payable']),
+             ('model', '=', 'res.partner')],
+            context=context
+        )
+        property_ids = property_obj.search(cr,
+                                           uid,
+                                           [('fields_id', 'in', model_fields_ids),
+                                            ('res_id', '=', False)],
+                                           context=context)
+
+        for erp_property in property_obj.browse(
+                cr, uid, property_ids, context=context):
+            if erp_property.fields_id.name == 'property_account_receivable':
+                account_receivable = erp_property.value_reference.id
+            elif erp_property.fields_id.name == 'property_account_payable':
+                account_payable = erp_property.value_reference.id
+        return account_receivable, account_payable
+
+    def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
+        """
+        Balance check depends on the profile. If no check for this profile is required,
+        return True and do nothing, otherwise call super.
+
+        :param int/long st_id: ID of the concerned account.bank.statement
+        :param char: journal_type that concern the bank statement
+        :return: True
+        """
+        st = self.browse(cr, uid, st_id, context=context)
+        if st.balance_check:
+            return super(AccountBankStatement, self
+                         ).balance_check(cr, uid, st_id, journal_type,
+                                         context=context)
+        else:
+            return True
+
+    def onchange_imp_config_id(self, cr, uid, ids, profile_id, context=None):
+        """
+        Compute values on the change of the profile.
+
+        :param: int/long: profile_id that changed
+        :return dict of dict with key = name of the field
+        """
+        if not profile_id:
+            return {}
+        import_config = self.pool.get("account.statement.profile").browse(
+                cr, uid, profile_id, context=context)
+        journal_id = import_config.journal_id.id
+        return {'value': {'journal_id': journal_id,
+                          'balance_check': import_config.balance_check}}
+
+
+class AccountBankStatementLine(Model):
+    """
+    Override to compute the period from the date of the line, add a method to retrieve
+    the values for a line from the profile. Override the on_change method to take care of
+    the profile when fullfilling the bank statement manually. Set the reference to 64
+    Char long instead 32.
+    """
+    _inherit = "account.bank.statement.line"
+
+    def _get_period(self, cr, uid, context=None):
+        """Return matching period for a date."""
+        if context is None:
+            context = {}
+        period_obj = self.pool['account.period']
+        date = context.get('date')
+        local_context = context.copy()
+        local_context['account_period_prefer_normal'] = True
+        try:
+            periods = period_obj.find(cr, uid, dt=date, context=local_context)
+        except osv.except_osv:
+            # if no period defined, we are certainly at installation time
+            return False
+        return periods and periods[0] or False
+
+    def _get_default_account(self, cr, uid, context=None):
+        return self.get_values_for_line(cr, uid, context=context)['account_id']
+
+    _columns = {
+        # Set them as required + 64 char instead of 32
+        'ref': fields.char('Reference', size=64, required=True),
+        'period_id': fields.many2one('account.period', 'Period', required=True),
+    }
+    _defaults = {
+        'period_id': _get_period,
+        'account_id': _get_default_account,
+    }
+
+    def get_values_for_line(self, cr, uid, profile_id=False, partner_id=False, line_type=False, amount=False, master_account_id=None, context=None):
+        """
+        Return the account_id to be used in the line of a bank statement. It'll base the result as follow:
+            - If a receivable_account_id is set in the profile, return this value and type = general
+            # TODO
+            - Elif how_get_type_account is set to force_supplier or force_customer, will take respectively payable and type=supplier,
+              receivable and type=customer otherwise
+            # END TODO
+            - Elif line_type is given, take the partner receivable/payable property (payable if type=supplier, receivable
+              otherwise)
+            - Elif amount is given:
+                 - If the customer checkbox is checked on the found partner, type and account will be customer and receivable
+                 - If the supplier checkbox is checked on the found partner, type and account will be supplier and payable
+                 - If both checkbox are checked or none of them, it'll be based on the amount :
+                      If amount is positive, the type and account will be customer and receivable,
+                      If amount is negative, the type and account will be supplier an payable
+            - Then, if no partner are given we look and take the property from the company so we always give a value
+              for account_id. Note that in that case, we return the receivable one.
+        :param int/long profile_id of the related bank statement
+        :param int/long partner_id of the line
+        :param char line_type: a value from: 'general', 'supplier', 'customer'
+        :param float: amount of the line
+        :return: A dict of value that can be passed directly to the write method of
+                 the statement line:
+                     {'partner_id': value,
+                      'account_id' : value,
+                      'type' : value,
+                       ...
+                     }
+        """
+        res = {}
+        obj_partner = self.pool.get('res.partner')
+        obj_stat = self.pool.get('account.bank.statement')
+        receiv_account = pay_account = account_id = False
+        # If profile has a receivable_account_id, we return it in any case
+        if master_account_id:
+            res['account_id'] = master_account_id
+            # We return general as default instead of get_type_for_counterpart
+            # for perfomance reasons as line_type is not a meaningfull value
+            # as account is forced
+            res['type'] = line_type if line_type else 'general'
+            return res
+        # To optimize we consider passing false means there is no account
+        # on profile
+        if profile_id and master_account_id is None:
+            profile = self.pool.get("account.statement.profile").browse(
+                                       cr, uid, profile_id, context=context)
+            if profile.receivable_account_id:
+                res['account_id'] = profile.receivable_account_id.id
+                # We return general as default instead of get_type_for_counterpart
+                # for perfomance reasons as line_type is not a meaningfull value
+                # as account is forced
+                res['type'] = line_type if line_type else 'general'
+                return res
+        # If no account is available on profile you have to do the lookup
+        # This can be quite a performance killer as we read ir.properity fields
+        if partner_id:
+            part = obj_partner.browse(cr, uid, partner_id, context=context)
+            part = part.commercial_partner_id
+            # When the method is called from bank statement completion,
+            # ensure that the line's partner is a commercial
+            # (accounting) entity
+            res['partner_id'] = part.id
+            pay_account = part.property_account_payable.id
+            receiv_account = part.property_account_receivable.id
+        # If no value, look on the default company property
+        if not pay_account or not receiv_account:
+            receiv_account, pay_account = obj_stat.get_default_pay_receiv_accounts(cr, uid, context=None)
+        account_id, comp_line_type = obj_stat.get_account_and_type_for_counterpart(cr, uid, amount,
+                                                                                   receiv_account, pay_account,
+                                                                                   partner_id=partner_id)
+        res['account_id'] = account_id if account_id else receiv_account
+        res['type'] = line_type if line_type else comp_line_type
+        return res
+
+    def onchange_partner_id(self, cr, uid, ids, partner_id, profile_id=None, context=None):
+        """
+        Override of the basic method as we need to pass the profile_id in the on_change_type
+        call.
+        Moreover, we now call the get_account_and_type_for_counterpart method now to get the
+        type to use.
+        """
+        obj_stat = self.pool.get('account.bank.statement')
+        if not partner_id:
+            return {}
+        line_type = obj_stat.get_type_for_counterpart(cr, uid, 0.0, partner_id=partner_id)
+        res_type = self.onchange_type(cr, uid, ids, partner_id, line_type, profile_id, context=context)
+        if res_type['value'] and res_type['value'].get('account_id', False):
+            return {'value': {'type': line_type,
+                              'account_id': res_type['value']['account_id'],
+                              'voucher_id': False}}
+        return {'value': {'type': line_type}}
+
+    def onchange_type(self, cr, uid, line_id, partner_id, line_type, profile_id, context=None):
+        """
+        Keep the same features as in standard and call super. If an account is returned,
+        call the method to compute line values.
+        """
+        res = super(AccountBankStatementLine, self
+                    ).onchange_type(cr, uid, line_id, partner_id,
+                                    line_type, context=context)
+        if 'account_id' in res['value']:
+            result = self.get_values_for_line(cr, uid,
+                                              profile_id=profile_id,
+                                              partner_id=partner_id,
+                                              line_type=line_type,
+                                              context=context)
+            if result:
+                res['value'].update({'account_id': result['account_id']})
+        return res

=== added file 'account_statement_ext/statement_view.xml'
--- account_statement_ext/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_ext/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <record id="statement_importer_view_form" model="ir.ui.view">
+        <field name="name">account.statement.profile.view</field>
+        <field name="model">account.statement.profile</field>
+        <field name="type">form</field>
+        <field name="arch" type="xml">
+            <form string="Import statement">
+                <separator string="" colspan="4"/>
+                <field name="name" select="1" />
+                <field name="partner_id" select="1"/>
+                <field name="company_id" select="1" groups="base.group_multi_company"/>
+                <field name="journal_id" select="1"/>
+                <field name="commission_account_id" />
+                <field name="commission_analytic_id" />
+                <field name="receivable_account_id" />
+                <field name="force_partner_on_bank"/>
+                <field name="balance_check"/>
+                <field name="bank_statement_prefix"/>
+                <field name="message_ids" widget="mail_thread" placeholder="Share a note..." colspan="4"/>
+            </form>
+        </field>
+    </record>
+
+    <record id="statement_importer_view_tree" model="ir.ui.view">
+        <field name="name">account.statement.profile.view</field>
+        <field name="model">account.statement.profile</field>
+        <field name="type">tree</field>
+        <field name="arch" type="xml">
+            <tree string="Import statement">
+                <field name="name" />
+                <field name="partner_id" />
+                <field name="company_id" groups="base.group_multi_company"/>
+                <field name="journal_id" />
+                <field name="commission_account_id" />
+                <field name="commission_analytic_id" />
+                <field name="receivable_account_id" />
+                <field name="force_partner_on_bank"/>
+                <field name="balance_check"/>
+            </tree>
+        </field>
+    </record>
+    <record id="action_treasury_statement_profile_tree" model="ir.actions.act_window">
+        <field name="name">Bank Statements Profile</field>
+        <field name="res_model">account.statement.profile</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+    </record>
+
+    <menuitem string="Bank Statements Profile" action="action_treasury_statement_profile_tree" id="menu_treasury_statement_profile_tree" parent="account.menu_configuration_misc" sequence="30"/>
+
+
+
+    <record id="view_treasury_statement_search" model="ir.ui.view">
+        <field name="name">account.bank.statement.search</field>
+        <field name="model">account.bank.statement</field>
+        <field name="inherit_id" ref="account.view_bank_statement_search"/>
+        <field name="arch" type="xml">
+             <xpath expr="/search/field[@name='name']" position="before">
+                    <field name="id"/>
+                    <field name="profile_id"/>
+                    <field name="credit_partner_id"/>
+                    <separator orientation="vertical"/>
+            </xpath>
+            <xpath expr="/search/field[@name='period_id']" position="replace">
+            </xpath>
+            <xpath expr="/search/group/filter[@string='Period']" position="replace">
+                <filter string="Financial Partner" context="{'group_by': 'credit_partner_id'}" icon="terp-partner"/>
+            </xpath>
+        </field>
+    </record>
+
+    <record id="view_treasury_statement_tree" model="ir.ui.view">
+        <field name="name">account.bank.statement.tree</field>
+        <field name="model">account.bank.statement</field>
+        <field name="inherit_id" ref="account.view_bank_statement_tree"/>
+        <field name="type">tree</field>
+        <field name="arch" type="xml">
+            <xpath expr="/tree/field[@name='name']" position="before">
+                 <field name="id"/>
+            </xpath>
+            <xpath expr="/tree/field[@name='name']" position="after">
+                <field name="profile_id"/>
+            </xpath>
+            <xpath expr="/tree/field[@name='period_id']" position="replace">
+                <field name="credit_partner_id"/>
+            </xpath>
+        </field>
+    </record>
+
+
+  <record id="view_treasury_statement_form" model="ir.ui.view">
+      <field name="name">account.bank.statement.form</field>
+      <field name="model">account.bank.statement</field>
+      <field name="inherit_id" ref="account.view_bank_statement_form"/>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+
+          <!-- Add before the group : profile and related infos -->
+          <field name="journal_id" position="attributes">
+              <attribute name="invisible">True</attribute>
+          </field>
+
+          <label for="name" position="before">
+              <group>
+                  <field name="profile_id" select="1" required="1" on_change="onchange_imp_config_id(profile_id)" widget="selection"/>
+                  <field name="balance_check" invisible="1"/>
+              </group>
+          </label>
+
+          # Make balance visible or not depending on profile
+          <field name="balance_start" position="attributes">
+              <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
+          </field>
+          <field name="balance_end_real" position="attributes">
+              <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
+          </field>
+          <field name="balance_end_real" position="after">
+               <field name="balance_end" widget="monetary" options='{"currency_field" : "currency"}' attrs="{'invisible':[('balance_check','=',False)]}"/>
+          </field>
+
+          <xpath expr="//field[@name='line_ids']/tree/field[@name='sequence']" position="after">
+              <field name="id" readonly="1" />
+          </xpath>
+
+          <xpath expr="//field[@name='line_ids']/form//field[@name='date']" position="before">
+              <field name="id" readonly="1" />
+          </xpath>
+          # Adapt onchange signature
+          <xpath expr="//field[@name='line_ids']/tree/field[@name='partner_id']" position="replace">
+              <field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
+          </xpath>
+
+          <xpath expr="//field[@name='line_ids']/form//field[@name='partner_id']" position="replace">
+             <field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
+          </xpath>
+          <xpath expr="//field[@name='line_ids']/form//field[@name='type']" position="replace">
+               <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
+          </xpath>
+          # also set type hidden as it has no impact on reconciliation
+          <xpath expr="//field[@name='line_ids']/tree/field[@name='type']" position="replace">
+               <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)" invisible="1"/>
+          </xpath>
+
+      </field>
+  </record>
+
+
+        <act_window id="act_bank_statement_from_profile"
+            name="Open Statements"
+            res_model="account.bank.statement"
+            src_model="account.statement.profile"
+            domain="[('profile_id','=',active_id),]"
+            view_type="form"/>
+
+
+</data>
+</openerp>

=== added directory 'account_statement_ext/test'
=== added file 'account_statement_ext/test/test_profile_related_fields.yml'
--- account_statement_ext/test/test_profile_related_fields.yml	1970-01-01 00:00:00 +0000
+++ account_statement_ext/test/test_profile_related_fields.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,78 @@
+-
+  In order to test the related fields in the profile, I first need to create a profile
+-
+  !record {model: account.statement.profile, id: profile_test1}:
+    name: Bank EUR Profile
+    journal_id: account.bank_journal
+    commission_account_id: account.a_expense
+    company_id: base.main_company
+    partner_id: base.res_partner_1
+    journal_id: account.check_journal
+    balance_check: True
+-
+  I create a second profile
+-
+  !record {model: account.statement.profile, id: profile_test2}:
+    name: Second profile
+    journal_id: account.bank_journal
+    commission_account_id: account.a_expense
+    company_id: base.main_company
+    partner_id: base.res_partner_3
+    journal_id: account.bank_journal
+    balance_check: True
+-
+  Now I create a statement.
+-
+  !record {model: account.bank.statement, id: statement_test1}:
+    name: Statement 1
+    profile_id: profile_test1
+    company_id: base.main_company
+-
+  Now I check that the related data come from the profile
+-
+  !assert {model: account.bank.statement, id: statement_test1, string: Initial data should come from the profile}:
+    - balance_check is True
+    - credit_partner_id.id == _ref('base.res_partner_1')
+    - journal_id.id == _ref('account.check_journal')
+-
+  Now I set the balance flag to False in the profile
+-
+  !record {model: account.statement.profile, id: profile_test1}:
+    balance_check: False
+-
+  It should be false in the statement as well.
+-
+  !assert {model: account.bank.statement, id: statement_test1, string: We should not check the balance}:
+    - balance_check is False
+-
+  Now I change the journal in the profile
+-
+  !record {model: account.statement.profile, id: profile_test1}:
+    journal_id: account.cash_journal
+-
+  The journal should propagate to the statement
+-
+  !assert {model: account.bank.statement, id: statement_test1, string: The journal should be updated}:
+    - journal_id.id == _ref('account.cash_journal')
+-
+  Now I change the partner in the profile
+-
+  !record {model: account.statement.profile, id: profile_test1}:
+    partner_id: base.res_partner_2
+-
+  The partner should propagate to the statement
+-
+  !assert {model: account.bank.statement, id: statement_test1, string: The partner should be updated}:
+    - credit_partner_id.id == _ref('base.res_partner_2')
+-
+  Now I change the profile associated to the statement.
+-
+  !record {model: account.bank.statement, id: statement_test1}:
+    profile_id: profile_test2
+-
+  The statement should receive information from the new statement.
+-
+  !assert {model: account.bank.statement, id: statement_test1, string: All information should be probagated from the new profile}:
+    - balance_check is True
+    - credit_partner_id.id == _ref('base.res_partner_3')
+    - journal_id.id == _ref('account.bank_journal')

=== added file 'account_statement_ext/voucher.py'
--- account_statement_ext/voucher.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext/voucher.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-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
+
+
+class AccountVoucher(Model):
+
+    _inherit = 'account.voucher'
+
+    def _get_period(self, cr, uid, context=None):
+        """If period not in context, take it from the move lines"""
+        if not context.get('period_id') and context.get('move_line_ids'):
+            res = self.pool.get('account.move.line').browse(
+                    cr, uid, context.get('move_line_ids'), context=context)[0].period_id.id
+            context['period_id'] = res
+        elif context.get('date'):
+            periods = self.pool.get('account.period').find(
+                    cr, uid, dt=context['date'], context=context)
+            if periods:
+                context['period_id'] = periods[0]
+        return super(AccountVoucher, self)._get_period(cr, uid, context)
+
+    def create(self, cr, uid, values, context=None):
+        """If no period defined in values, ask it from moves."""
+        if context is None:
+            context = {}
+        if not values.get('period_id'):
+            ctx = dict(context, date=values.get('date'))
+            values['period_id'] = self._get_period(cr, uid, ctx)
+        return super(AccountVoucher, self).create(cr, uid, values, context)

=== added directory 'account_statement_ext_point_of_sale'
=== added file 'account_statement_ext_point_of_sale/__init__.py'
--- account_statement_ext_point_of_sale/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext_point_of_sale/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Alexandre Fayolle
+#    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 . import point_of_sale

=== added file 'account_statement_ext_point_of_sale/__openerp__.py'
--- account_statement_ext_point_of_sale/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext_point_of_sale/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi, Joel Grand-Guillaume
+#    Copyright 2011-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/>.
+#
+##############################################################################
+
+{'name': "Bank statement extension and profiles for Point of Sale",
+ 'version': '1.0.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Point Of Sale',
+ 'complexity': 'normal',
+ 'depends': ['point_of_sale',
+             'account_statement_ext',
+             ],
+ 'description': """
+ Update the point of sale code to work with improved bank statements.
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'data': [],
+ 'demo': [],
+ 'test': [],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': True,
+ 'license': 'AGPL-3',
+ 'active': False,
+ }

=== added file 'account_statement_ext_point_of_sale/point_of_sale.py'
--- account_statement_ext_point_of_sale/point_of_sale.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext_point_of_sale/point_of_sale.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,123 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Alexandre Fayolle
+#    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.addons.point_of_sale.point_of_sale import pos_session as std_pos_session
+from openerp.osv import orm, osv
+from openerp.tools.translate import _
+
+if not hasattr(std_pos_session, '_prepare_bank_statement'):
+    # monkey patch to fix lp:1245375
+    #
+    # We replace pos_session.create with the implementation in
+    # mp_create below which is essentially the same, only with a call
+    # to self._prepare_bank_statement.
+    #
+    # The default implementation has been extracted in
+    # mp_prepare_bank_statement below, and can be overridden in models
+    # which _inherit pos.session
+    #
+    # This change has been proposed for merging to fix lp:125375
+    def mp_prepare_bank_statement(self, cr, uid, pos_config, journal, context=None):
+        bank_values = {
+            'journal_id' : journal.id,
+            'user_id' : uid,
+            'company_id' : pos_config.shop_id.company_id.id
+            }
+        return bank_values
+
+    def mp_create(self, cr, uid, values, context=None):
+        context = context or {}
+        config_id = values.get('config_id', False) or context.get('default_config_id', False)
+        if not config_id:
+            raise osv.except_osv( _('Error!'),
+                _("You should assign a Point of Sale to your session."))
+
+        # journal_id is not required on the pos_config because it does not
+        # exists at the installation. If nothing is configured at the
+        # installation we do the minimal configuration. Impossible to do in
+        # the .xml files as the CoA is not yet installed.
+        jobj = self.pool.get('pos.config')
+        pos_config = jobj.browse(cr, uid, config_id, context=context)
+        context.update({'company_id': pos_config.shop_id.company_id.id})
+        if not pos_config.journal_id:
+            jid = jobj.default_get(cr, uid, ['journal_id'], context=context)['journal_id']
+            if jid:
+                jobj.write(cr, uid, [pos_config.id], {'journal_id': jid}, context=context)
+            else:
+                raise osv.except_osv( _('error!'),
+                    _("Unable to open the session. You have to assign a sale journal to your point of sale."))
+
+        # define some cash journal if no payment method exists
+        if not pos_config.journal_ids:
+            journal_proxy = self.pool.get('account.journal')
+            cashids = journal_proxy.search(cr, uid, [('journal_user', '=', True), ('type','=','cash')], context=context)
+            if not cashids:
+                cashids = journal_proxy.search(cr, uid, [('type', '=', 'cash')], context=context)
+                if not cashids:
+                    cashids = journal_proxy.search(cr, uid, [('journal_user','=',True)], context=context)
+
+            jobj.write(cr, uid, [pos_config.id], {'journal_ids': [(6,0, cashids)]})
+
+
+        pos_config = jobj.browse(cr, uid, config_id, context=context)
+        bank_statement_ids = []
+        for journal in pos_config.journal_ids:
+            bank_values = self._prepare_bank_statement(cr, uid, pos_config, journal, context)
+            statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
+            bank_statement_ids.append(statement_id)
+
+        values.update({
+            'name' : pos_config.sequence_id._next(),
+            'statement_ids' : [(6, 0, bank_statement_ids)],
+            'config_id': config_id
+        })
+        return super(std_pos_session, self).create(cr, uid, values, context=context)
+
+    std_pos_session._prepare_bank_statement = mp_prepare_bank_statement
+    std_pos_session.create = mp_create
+
+
+class pos_session(orm.Model):
+    _inherit = 'pos.session'
+
+    def _prepare_bank_statement(self, cr, uid, pos_config, journal, context=None):
+        """ Override the function _mp_create. To add the bank profile to the statement
+
+        Function That was previously added to pos.session model using monkey patching
+
+        """
+
+        bank_values = super(pos_session, self)._prepare_bank_statement(cr, uid,
+                                                                       pos_config,
+                                                                       journal, context)
+        user_obj = self.pool.get('res.users')
+        profile_obj = self.pool.get('account.statement.profile')
+        user = user_obj.browse(cr, uid, uid, context=context)
+        defaults = self.pool['account.bank.statement'].default_get(cr, uid,
+                                                                   ['profile_id', 'period_id'],
+                                                                   context=context)
+        profile_ids = profile_obj.search(cr, uid,
+                                         [('company_id', '=', user.company_id.id),
+                                          ('journal_id', '=', bank_values['journal_id'])],
+                                         context=context)
+        if profile_ids:
+            defaults['profile_id'] = profile_ids[0]
+        bank_values.update(defaults)
+        return bank_values

=== added directory 'account_statement_ext_voucher'
=== added file 'account_statement_ext_voucher/__init__.py'
--- account_statement_ext_voucher/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext_voucher/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################

=== added file 'account_statement_ext_voucher/__openerp__.py'
--- account_statement_ext_voucher/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext_voucher/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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': "Bank statement extension with voucher",
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': [
+     'account_statement_ext',
+     'account_voucher'
+     ],
+ 'description': """
+ This module is deprecated. It was only needed when using account_bank_statement_ext with voucher in order to compute the period
+ correctly. This is mainly because with account_bank_statement_ext, the period is computed for each line.
+ 
+ Now, we include this in the account_statement_ext module and added a dependencies on account_voucher (mainly cause we can't get
+ rid of the voucher in version 7.0).
+ 
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'init_xml': [],
+ 'update_xml': [
+        "statement_voucher_view.xml",
+ ],
+ 'demo_xml': [],
+ 'test': [],
+ 'installable': False,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 
+}

=== added file 'account_statement_ext_voucher/statement_voucher.py'
--- account_statement_ext_voucher/statement_voucher.py	1970-01-01 00:00:00 +0000
+++ account_statement_ext_voucher/statement_voucher.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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
+
+
+class AccountVoucher(Model):
+
+    _inherit = 'account.voucher'
+
+    def _get_period(self, cr, uid, context=None):
+        """If period not in context, take it from the move lines"""
+        if context is None:
+            context = {}
+        if not context.get('period_id') and context.get('move_line_ids'):
+            res = self.pool.get('account.move.line').browse(
+                    cr, uid, context.get('move_line_ids'), context=context)[0].period_id.id
+            context['period_id'] = res
+        elif context.get('date'):
+            periods = self.pool.get('account.period').find(
+                    cr, uid, dt=context['date'], context=context)
+            if periods:
+                context['period_id'] = periods[0]
+        return super(AccountVoucher, self)._get_period(cr, uid, context)
+
+    def create(self, cr, uid, values, context=None):
+        """If no period defined in values, ask it from moves."""
+        if context is None:
+            context = {}
+        if not values.get('period_id'):
+            ctx = dict(context, date=values.get('date'))
+            values['period_id'] = self._get_period(cr, uid, ctx)
+        return super(AccountVoucher, self).create(cr, uid, values, context)

=== added directory 'account_statement_no_invoice_import'
=== added file 'account_statement_no_invoice_import/__init__.py'
--- account_statement_no_invoice_import/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_no_invoice_import/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   module for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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/>.
+#
+###############################################################################
+

=== added file 'account_statement_no_invoice_import/__openerp__.py'
--- account_statement_no_invoice_import/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_no_invoice_import/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   module for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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': 'account bank statement no invoice import',
+    'version': '0.1',
+    'category': 'Generic Modules/Others',
+    'license': 'AGPL-3',
+    'description': """Module that remove the 'Import invoices' button on bank statement""",
+    'author': 'Akretion',
+    'website': 'http://www.akretion.com/',
+    'depends': [
+        'account_voucher',
+        ], 
+    'data': [ 
+        'statement_view.xml',
+    ],
+    'demo': [],
+    'installable': True,
+    'active': False,
+}

=== added file 'account_statement_no_invoice_import/statement_view.xml'
--- account_statement_no_invoice_import/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_no_invoice_import/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<openerp>
+    <data>
+    
+        <!-- INHERITED VIEW FOR THE OBJECT : account_bank_statement -->
+
+        <record id="account_bank_statement_view_form" model="ir.ui.view">
+            <field name="name">account_bank_statement_simple_view.account_bank_statement.view_form</field>
+            <field name="model">account.bank.statement</field>
+            <field name="inherit_id" ref="account_voucher.view_bank_statement_form_invoice" />
+            <field eval="100" name="priority"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <button string="Import Invoices" position="replace">
+                </button>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added directory 'account_statement_ofx_import'
=== added file 'account_statement_ofx_import/__init__.py'
--- account_statement_ofx_import/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ofx_import/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Pedro Manuel Baeza Romero
+#    Copyright 2013 Servicios Tecnológicos Avanzados
+#
+#    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/>.
+#
+##############################################################################
+import statement
+import parser

=== added file 'account_statement_ofx_import/__openerp__.py'
--- account_statement_ofx_import/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ofx_import/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Pedro Manuel Baeza Romero
+#    Copyright 2013 Servicios Tecnológicos Avanzados
+#    Financed by AB Internet (http://www.abinternet.co.uk/)
+#
+#    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': "Bank statement OFX import",
+    'version': '1.0',
+    'author': 'Servicios Tecnológicos Avanzados - Pedro M. Baeza',
+    'maintainer': 'Pedro M. Baeza',
+    'category': 'Finance',
+    'complexity': 'normal',
+    'depends': [
+        'account_statement_base_import',
+    ],
+    'external_dependencies': {
+        'python': ['ofxparse'],
+    },
+    'description': """
+    Allows to import OFX (Open Financial Exchange) statement files, using
+    *account_statement_base_import* generic inheritance mechanism to import 
+    statements.
+    
+    It requires ofxparse library to work.
+    """,
+    'website': 'http://www.serviciosbaeza.com',
+    'data': [],
+    'test': [],
+    'installable': True,
+    'images': [],
+    'auto_install': False,
+    'license': 'AGPL-3',
+}

=== added directory 'account_statement_ofx_import/i18n'
=== added file 'account_statement_ofx_import/i18n/account_statement_ofx_import.pot'
--- account_statement_ofx_import/i18n/account_statement_ofx_import.pot	1970-01-01 00:00:00 +0000
+++ account_statement_ofx_import/i18n/account_statement_ofx_import.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,34 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_ofx_import
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:05+0000\n"
+"PO-Revision-Date: 2014-01-21 12:05+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_statement_ofx_import
+#: code:addons/account_statement_ofx_import/statement.py:34
+#, python-format
+msgid "OFX - Open Financial Exchange"
+msgstr ""
+
+#. module: account_statement_ofx_import
+#: code:addons/account_statement_ofx_import/parser/ofx_parser.py:29
+#, python-format
+msgid "Please install python lib ofxparse"
+msgstr ""
+
+#. module: account_statement_ofx_import
+#: model:ir.model,name:account_statement_ofx_import.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+

=== added directory 'account_statement_ofx_import/parser'
=== added file 'account_statement_ofx_import/parser/__init__.py'
--- account_statement_ofx_import/parser/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_ofx_import/parser/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Pedro Manuel Baeza Romero
+#    Copyright 2013 Servicios Tecnológicos Avanzados
+#
+#    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 ofx_parser
+

=== added file 'account_statement_ofx_import/parser/ofx_parser.py'
--- account_statement_ofx_import/parser/ofx_parser.py	1970-01-01 00:00:00 +0000
+++ account_statement_ofx_import/parser/ofx_parser.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Pedro Manuel Baeza Romero
+#    Copyright 2013 Servicios Tecnológicos Avanzados
+#
+#    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.tools.translate import _
+from account_statement_base_import.parser import BankStatementImportParser
+import tempfile
+import datetime
+
+try:
+    import ofxparse
+except:
+    raise Exception(_('Please install python lib ofxparse'))
+
+class OfxParser(BankStatementImportParser):
+    """
+    Class for defining parser for OFX file format.
+    """
+    
+    def __init__(self, parser_name, *args, **kwargs):
+        """
+        """
+        super(OfxParser, self).__init__(parser_name, *args, **kwargs)
+
+    @classmethod
+    def parser_for(cls, parser_name):
+        """
+        Used by the new_bank_statement_parser class factory. Return true if
+        the providen name is 'ofx_so'.
+        """
+        return parser_name == 'ofx_so'
+
+    def _custom_format(self, *args, **kwargs):
+        """
+        No other work on data are needed in this parser.
+        """
+        return True
+
+    def _pre(self, *args, **kwargs):
+        """
+        No pre-treatment needed for this parser.
+        """
+        return True
+
+    def _parse(self, *args, **kwargs):
+        """
+        Launch the parsing itself.
+        """
+        ofx_file = tempfile.NamedTemporaryFile()
+        ofx_file.seek(0)
+        ofx_file.write(self.filebuffer)
+        ofx_file.flush()
+        ofx = ofxparse.OfxParser.parse(file(ofx_file.name))
+        ofx_file.close()
+        res = []
+        for transaction in ofx.account.statement.transactions:
+            res.append({
+                'date': transaction.date,
+                'amount': transaction.amount,
+                'ref': transaction.type,
+                'label': transaction.payee,
+            })
+        self.result_row_list = res
+        return True
+
+    def _validate(self, *args, **kwargs):
+        """
+        Nothing to do here. ofxparse trigger possible format errors.
+        """
+        return True
+
+    def _post(self, *args, **kwargs):
+        """
+        Nothing is needed to do after parsing.
+        """
+        return True
+
+    def _post(self, *args, **kwargs):
+        """
+        Nothing to do.
+        """
+        return True
+
+    def get_st_line_vals(self, line, *args, **kwargs):
+        """
+        This method must return a dict of vals that can be passed to create
+        method of statement line in order to record it. It is the
+        responsibility of every parser to give this dict of vals, so each one
+        can implement his own way of recording the lines.
+            :param: line: a dict of vals that represent a line of
+                result_row_list
+            :return: dict of values to give to the create method of statement
+                line
+        """
+        return {
+            'name': line.get('label', line.get('ref', '/')),
+            'date': line.get('date', datetime.datetime.now().date()),
+            'amount': line.get('amount', 0.0),
+            'ref': line.get('ref', '/'),
+            'label': line.get('label', ''),
+        }
+

=== added file 'account_statement_ofx_import/statement.py'
--- account_statement_ofx_import/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_ofx_import/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Pedro Manuel Baeza Romero
+#    Copyright 2013 Servicios Tecnológicos Avanzados
+#
+#    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.tools.translate import _
+from openerp.osv import fields, orm
+
+class AccountStatementProfil(orm.Model):
+    _inherit = "account.statement.profile"
+
+    def get_import_type_selection(self, cr, uid, context=None):
+        """
+        Inherited from parent to add parser.
+        """
+        selection = super(AccountStatementProfil, self
+                          ).get_import_type_selection(cr, uid,
+                                                      context=context)
+        selection.append(('ofx_so', _('OFX - Open Financial Exchange')))
+        return selection

=== added directory 'account_statement_one_move'
=== added file 'account_statement_one_move/__init__.py'
--- account_statement_one_move/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_one_move/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   account_statement_one_move for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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 statement

=== added file 'account_statement_one_move/__openerp__.py'
--- account_statement_one_move/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_one_move/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   account_statement_one_move for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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': 'Bank statement one move',
+    'version': '0.1',
+    'category': 'Generic Modules/Others',
+    'license': 'AGPL-3',
+    'description': """
+    This module allows to group all lines of a bank statement in only one move.
+    This feature is optional and can be activated with a checkbox in the bank
+    statement's profile. This is very useful for credit card deposit for
+    example, you won't have a move for each line.
+
+    """,
+    'author': 'Akretion',
+    'website': 'http://www.akretion.com/',
+    'depends': ['account_statement_ext'],
+    'data': [
+        'statement_view.xml'
+    ],
+    'demo': [],
+    'installable': True,
+    'auto_install': False,
+    'active': False,
+}

=== added file 'account_statement_one_move/statement.py'
--- account_statement_one_move/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_one_move/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,225 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   account_statement_one_move for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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 fields, orm, osv
+
+
+class AccountStatementProfile(orm.Model):
+    _inherit = "account.statement.profile"   
+    _columns = {
+        'one_move': fields.boolean(
+            'Group Journal Items',
+            help="Only one Journal Entry will be generated on the "
+                 "validation of the bank statement."),
+        'split_transfer_line': fields.boolean(
+            'Split Transfer Line',
+            help="Two transfer lines will be automatically generated : one "
+                 "for the refunds and one for the payments.")
+    }
+
+class account_bank_statement(orm.Model):
+    _inherit = "account.bank.statement"
+
+    def _prepare_move_line_vals(self, cr, uid, st_line, *args, **kwargs):
+        res = super(account_bank_statement, self)._prepare_move_line_vals(cr, uid, st_line,
+                                                                          *args, **kwargs)
+        period_id = self._get_period(cr, uid, st_line.statement_id.date,
+                                     context=kwargs.get('context'))
+        if st_line.statement_id.profile_id.one_move:
+            res.update({
+                'period_id': period_id,
+                'date': st_line.statement_id.date,
+                'name': st_line.ref,
+                })
+        return res
+
+
+        return res
+
+    def _prepare_move(self, cr, uid, st_line, st_line_number, context=None):
+        res = super(account_bank_statement, self).\
+                _prepare_move(cr, uid, st_line, st_line_number, context=context)
+        res.update({
+            'ref': st_line.statement_id.name,
+            'name': st_line.statement_id.name,
+            'date': st_line.statement_id.date,
+            })
+        return res
+
+
+    def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id,
+                                 st_line_number, context=None):
+        if context is None:
+            context = {}
+        context['from_parent_object'] = True #For compability with module account_constraints
+        account_move_obj = self.pool.get('account.move')
+        account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
+        st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id,
+                                                         context=context)
+        st = st_line.statement_id
+
+        if st.profile_id.one_move:
+            if not context.get('move_id'):
+                move_vals = self._prepare_move(cr, uid, st_line, st_line_number, context=context)
+                context['move_id'] = account_move_obj.create(cr, uid, move_vals, context=context)
+            self.create_move_line_from_st_line(cr, uid, context['move_id'], 
+                                              st_line_id, company_currency_id,
+                                              context=context)
+            return context['move_id']
+        else:
+            return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line_id, 
+                                                                                company_currency_id, 
+                                                                                st_line_number,
+                                                                                context=context)
+    
+    def create_move_line_from_st_line(self, cr, uid, move_id, st_line_id,
+                                     company_currency_id, context=None):
+        """Create the account move line from the statement line.
+           
+           :param int/long move_id: ID of the account.move
+           :param int/long st_line_id: ID of the account.bank.statement.line to create the move line from.
+           :param int/long company_currency_id: ID of the res.currency of the company
+           :return: ID of the account.move created
+        """
+        if context is None:
+            context = {}
+        res_currency_obj = self.pool.get('res.currency')
+        account_move_line_obj = self.pool.get('account.move.line')
+        account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
+        st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context)
+        st = st_line.statement_id
+
+        context.update({'date': st_line.date})
+        acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id
+
+        context.update({
+                'res.currency.compute.account': acc_cur,
+            })
+        amount = res_currency_obj.compute(cr, uid, st.currency.id,
+                                          company_currency_id, 
+                                          st_line.amount, 
+                                          context=context)
+
+        bank_move_vals = self._prepare_bank_move_line(cr, uid, st_line, move_id, amount,
+            company_currency_id, context=context)
+        return account_move_line_obj.create(cr, uid, bank_move_vals, context=context)
+
+    def _valid_move(self, cr, uid, move_id, context=None):
+        move_obj = self.pool.get('account.move')
+        move = move_obj.browse(cr, uid, move_id, context=context)
+        move_obj.post(cr, uid, [move_id], context=context)
+        return True
+
+
+    def _prepare_transfer_move_line_vals(self, cr, uid, st, name, amount, move_id, context=None):
+        """
+            Prepare the dict of values to create the transfer move lines.
+        """
+        account_id = st.profile_id.journal_id.default_debit_account_id.id
+        partner_id = st.profile_id.partner_id and profile.partner_id.id or False
+        if amount < 0.0:
+            debit = 0.0
+            credit = -amount
+        else:
+            debit = amount
+            credit = 0.0
+        vals = {
+            'name': name,
+            'date': st.date,
+            'partner_id': partner_id,
+            'statement_id': st.id,
+            'account_id': account_id,
+            'ref': name,
+            'move_id': move_id,
+            'credit': credit,
+            'debit': debit,
+            'journal_id': st.journal_id.id,
+            'period_id': st.period_id.id,
+        }
+        return vals
+
+
+    def create_move_transfer_lines(self, cr, uid, move, st, context=None):
+        move_line_obj = self.pool.get('account.move.line')
+        move_id = move.id
+        refund = 0.0
+        payment = 0.0
+        transfer_lines = []
+        transfer_line_ids = []
+        #Calculate the part of the refund amount and the payment amount
+        for move_line in move.line_id:
+            refund -= move_line.debit
+            payment += move_line.credit
+        #Create 2 Transfer lines or One global tranfer line
+        if st.profile_id.split_transfer_line:
+            if refund:
+                transfer_lines.append(['Refund Transfer', refund])
+            if payment:
+                transfer_lines.append(['Payment Transfer', payment])
+        else:
+            amount = payment + refund
+            if amount:
+                transfer_lines.append(['Transfer', amount])
+        for transfer_line in transfer_lines:
+            vals = self._prepare_transfer_move_line_vals(cr, uid, st, 
+                                                         transfer_line[0],
+                                                         transfer_line[1], 
+                                                         move_id,
+                                                         context=context)
+            transfer_line_ids.append(move_line_obj.create(cr, uid, vals, context=context))
+        return transfer_line_ids
+
+           
+    def button_confirm_bank(self, cr, uid, ids, context=None):
+        st_line_obj = self.pool.get('account.bank.statement.line')
+        move_obj = self.pool.get('account.move')
+        if context is None:
+            context = {}
+        for st in self.browse(cr, uid, ids, context=context):
+            super(account_bank_statement, self).button_confirm_bank(cr, uid, ids,
+                                                                    context=context)
+            if st.profile_id.one_move and context.get('move_id', False):
+                move_id = context['move_id']
+                move = move_obj.browse(cr, uid, move_id, context=context)
+                transfe_line_ids = self.create_move_transfer_lines(cr, uid, move, st, context=context)
+                self._valid_move(cr, uid, move_id, context=context)
+                lines_ids = [x.id for x in st.line_ids]
+                st_line_obj.write(cr, uid, lines_ids,
+                        {'move_ids': [(4, move_id, False)]},
+                        context=context)
+        return True
+
+    def button_cancel(self, cr, uid, ids, context=None):
+        done = []
+        for st in self.browse(cr, uid, ids, context=context):
+            if st.profile_id.one_move and st.line_ids:
+                for move in st.line_ids[0].move_ids:
+                    if move.state != 'draft':
+                        move.button_cancel(context=context)
+                    move.unlink(context=context)
+                st.write({'state':'draft'}, context=context)
+            else:
+                super(account_bank_statement, self).button_cancel(cr, uid, ids, 
+                                                                 context=context)
+        return True
+
+

=== added file 'account_statement_one_move/statement_view.xml'
--- account_statement_one_move/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_one_move/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  account_statement_one_move for OpenERP
+  Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+  The licence is in the file __openerp__.py
+-->
+
+<openerp>
+    <data>
+    
+        <!-- INHERITED VIEW FOR THE OBJECT : account_statement -->
+    
+        <record id="account_statement_view_form" model="ir.ui.view">
+            <field name="name">account_statement_one_move.account_statement.view_form</field>
+            <field name="model">account.statement.profile</field>
+            <field name="inherit_id" ref="account_statement_ext.statement_importer_view_form" />
+            <field name="arch" type="xml">
+                <field name="balance_check" position="after">
+                    <field name="one_move"/>
+                    <field name="split_transfer_line" attrs="{'invisible': [('one_move', '=', False)]}"/>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added directory 'account_statement_regex_account_completion'
=== added file 'account_statement_regex_account_completion/__init__.py'
--- account_statement_regex_account_completion/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Authors: Laetitia Gangloff
+#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+#    All Rights Reserved
+#
+#    WARNING: This program as such is intended to be used by professional
+#    programmers who take the whole responsibility of assessing all potential
+#    consequences resulting from its eventual inadequacies and bugs.
+#    End users who are looking for a ready-to-use solution with commercial
+#    guarantees and support are strongly advised to contact a Free Software
+#    Service Company.
+#
+#    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 statement
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_statement_regex_account_completion/__openerp__.py'
--- account_statement_regex_account_completion/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Authors: Laetitia Gangloff
+#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+#    All Rights Reserved
+#
+#    WARNING: This program as such is intended to be used by professional
+#    programmers who take the whole responsibility of assessing all potential
+#    consequences resulting from its eventual inadequacies and bugs.
+#    End users who are looking for a ready-to-use solution with commercial
+#    guarantees and support are strongly advised to contact a Free Software
+#    Service Company.
+#
+#    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": "Account Statement Regex Account Completion addon",
+    "version": "0.1",
+    "author": "ACSONE SA/NV",
+    "category": "Other",
+    "website": "http://www.acsone.eu";,
+    "depends": ["account_statement_base_completion",
+                ],
+    "description": """
+
+Account Statement Regex Account Completion addon
+=========================
+
+- Add a completion method based on a specified regular expression
+    and update account to use in the bank statement line with the specified account.
+""",
+    "data": ['statement_view.xml',
+              ],
+    "demo": [],
+    "test": [],
+    "active": False,
+    "license": "AGPL-3",
+    "installable": True,
+    "auto_install": False,
+    "application": False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added directory 'account_statement_regex_account_completion/i18n'
=== added file 'account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot'
--- account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,32 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_regex_account_completion
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-22 10:59+0000\n"
+"PO-Revision-Date: 2014-01-22 10:59+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_statement_regex_account_completion
+#: field:account.statement.completion.rule,regex:0
+msgid "Regular Expression"
+msgstr ""
+
+#. module: account_statement_regex_account_completion
+#: field:account.statement.completion.rule,account_id:0
+msgid "Account to set"
+msgstr ""
+
+#. module: account_statement_regex_account_completion
+#: model:ir.model,name:account_statement_regex_account_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr ""
+ 

=== added file 'account_statement_regex_account_completion/i18n/fr.po'
--- account_statement_regex_account_completion/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/i18n/fr.po	2014-03-27 09:24:37 +0000
@@ -0,0 +1,32 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#   * account_statement_regex_account_completion
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-22 10:59+0000\n"
+"PO-Revision-Date: 2014-01-23 17:42+0000\n"
+"Last-Translator: Laetitia Gangloff (Acsone) <laetitia.gangloff@xxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-03-14 07:02+0000\n"
+"X-Generator: Launchpad (build 16963)\n"
+
+#. module: account_statement_regex_account_completion
+#: field:account.statement.completion.rule,regex:0
+msgid "Regular Expression"
+msgstr "Expression Régulière"
+
+#. module: account_statement_regex_account_completion
+#: field:account.statement.completion.rule,account_id:0
+msgid "Account to set"
+msgstr "Compte à utiliser"
+
+#. module: account_statement_regex_account_completion
+#: model:ir.model,name:account_statement_regex_account_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr "account.statement.completion.rule"

=== added file 'account_statement_regex_account_completion/statement.py'
--- account_statement_regex_account_completion/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Authors: Laetitia Gangloff
+#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+#    All Rights Reserved
+#
+#    WARNING: This program as such is intended to be used by professional
+#    programmers who take the whole responsibility of assessing all potential
+#    consequences resulting from its eventual inadequacies and bugs.
+#    End users who are looking for a ready-to-use solution with commercial
+#    guarantees and support are strongly advised to contact a Free Software
+#    Service Company.
+#
+#    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
+from openerp.osv import fields
+
+import re
+
+
+class AccountStatementCompletionRule(Model):
+    """Add a rule to complete account based on a regular expression"""
+
+    _inherit = "account.statement.completion.rule"
+
+    def _get_functions(self, cr, uid, context=None):
+        res = super(AccountStatementCompletionRule, self)._get_functions(
+            cr, uid, context=context)
+        res.append(('set_account',
+                    'Set account for line labels matching a regular expression'))
+        return res
+
+    _columns = {
+        'function_to_call': fields.selection(_get_functions, 'Method'),
+        'regex': fields.char('Regular Expression', size=128),
+        'account_id': fields.many2one('account.account', string="Account to set"),
+    }
+
+    def set_account(self, cr, uid, id, st_line, context=None):
+        """
+        If line name match regex, update account_id
+        Then, call the generic st_line method to complete other values.
+        :param dict st_line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id' : value,
+            ...}
+        """
+        name = st_line['name']
+        res = {}
+        if name:
+            rule = self.browse(cr, uid, id, context=context)
+            if re.match(rule.regex, name):
+                res['account_id'] = rule.account_id.id
+        return res
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_statement_regex_account_completion/statement_view.xml'
--- account_statement_regex_account_completion/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+         <record id="statement_st_completion_rule_view_form" model="ir.ui.view">
+             <field name="name">account.statement.completion.rule.view (account_statement_regex_account_completion)</field>
+             <field name="model">account.statement.completion.rule</field>
+             <field name="inherit_id" ref="account_statement_base_completion.statement_st_completion_rule_view_form" />
+             <field name="type">form</field>
+             <field name="arch" type="xml">
+                <field name="function_to_call" position="after">
+                    <group colspan="2">
+                        <field name="regex" attrs="{'invisible':[('function_to_call','!=','set_account')],'required':[('function_to_call','=','set_account')]}"/>
+                        <field name="account_id" attrs="{'invisible':[('function_to_call','!=','set_account')],'required':[('function_to_call','=','set_account')]}"/>
+                    </group>
+                </field>
+             </field>
+         </record>
+
+</data>
+</openerp>

=== added directory 'account_statement_regex_account_completion/tests'
=== added file 'account_statement_regex_account_completion/tests/__init__.py'
--- account_statement_regex_account_completion/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/tests/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Authors: Laetitia Gangloff
+#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+#    All Rights Reserved
+#
+#    WARNING: This program as such is intended to be used by professional
+#    programmers who take the whole responsibility of assessing all potential
+#    consequences resulting from its eventual inadequacies and bugs.
+#    End users who are looking for a ready-to-use solution with commercial
+#    guarantees and support are strongly advised to contact a Free Software
+#    Service Company.
+#
+#    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 test_regex_account_completion
+
+checks = [
+    test_regex_account_completion
+]
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_statement_regex_account_completion/tests/test_regex_account_completion.py'
--- account_statement_regex_account_completion/tests/test_regex_account_completion.py	1970-01-01 00:00:00 +0000
+++ account_statement_regex_account_completion/tests/test_regex_account_completion.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Authors: Laetitia Gangloff
+#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
+#    All Rights Reserved
+#
+#    WARNING: This program as such is intended to be used by professional
+#    programmers who take the whole responsibility of assessing all potential
+#    consequences resulting from its eventual inadequacies and bugs.
+#    End users who are looking for a ready-to-use solution with commercial
+#    guarantees and support are strongly advised to contact a Free Software
+#    Service Company.
+#
+#    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.tests import common
+import time
+
+ACC_NUMBER = "BE38733040385372"
+
+
+class test_regex_account_completion(common.TransactionCase):
+
+    def prepare(self):
+        self.account_bank_statement_obj = self.registry("account.bank.statement")
+        self.account_bank_statement_line_obj = self.registry("account.bank.statement.line")
+        self.account_id = self.ref('account.a_expense')
+        # create the completion rule
+        rule_vals = {'function_to_call': 'set_account',
+                     'regex': '^My statement',
+                     'account_id': self.account_id}
+        completion_rule_id = self.registry("account.statement.completion.rule").create(self.cr, self.uid, rule_vals)
+
+        # Create the profile
+        journal_id = self.ref("account.bank_journal")
+        profile_id = self.registry("account.statement.profile").create(self.cr, self.uid, {
+            "name": "TEST",
+            "commission_account_id": self.ref("account.a_recv"),
+            "journal_id": journal_id,
+            "rule_ids": [(6, 0, [completion_rule_id])]})
+
+        # Create a bank statement
+        self.statement_id = self.account_bank_statement_obj.create(self.cr, self.uid, {
+            "balance_end_real": 0.0,
+            "balance_start": 0.0,
+            "date": time.strftime('%Y-%m-%d'),
+            "journal_id": journal_id,
+            "profile_id": profile_id
+        })
+
+        # Create two bank statement lines
+        self.statement_line1_id = self.account_bank_statement_line_obj.create(self.cr, self.uid, {
+            'amount': 1000.0,
+            'name': 'My statement',
+            'ref': 'My ref',
+            'statement_id': self.statement_id,
+            'partner_acc_number': ACC_NUMBER
+        })
+
+        self.statement_line2_id = self.account_bank_statement_line_obj.create(self.cr, self.uid, {
+            'amount': 2000.0,
+            'name': 'My second statement',
+            'ref': 'My second ref',
+            'statement_id': self.statement_id,
+            'partner_acc_number': ACC_NUMBER
+        })
+
+    def test_00(self):
+        """Test the automatic completion on account
+        """
+        self.prepare()
+        statement_obj = self.account_bank_statement_obj.browse(self.cr, self.uid, self.statement_id)
+        statement_obj.button_auto_completion()
+        statement_line1 = self.account_bank_statement_line_obj.browse(self.cr, self.uid, self.statement_line1_id)
+        self.assertEquals(self.account_id, statement_line1.account_id.id, "The account should be the account of the completion")
+        statement_line2 = self.account_bank_statement_line_obj.browse(self.cr, self.uid, self.statement_line2_id)
+        self.assertNotEqual(self.account_id, statement_line2.account_id.id, "The account should be not the account of the completion")

=== added directory 'account_statement_so_completion'
=== added file 'account_statement_so_completion/__init__.py'
--- account_statement_so_completion/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_so_completion/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#                                                                             #
+#   Author: Joel Grand-Guillaume
+#   Copyright 2011-2012 Camptocamp SA
+#                                                                             #
+#   Author: Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxxxx>                #
+#   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 . import statement

=== added file 'account_statement_so_completion/__openerp__.py'
--- account_statement_so_completion/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_so_completion/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#                                                                             #
+#   Author: Joel Grand-Guillaume
+#   Copyright 2011-2012 Camptocamp SA
+#                                                                             #
+#   Author: Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxxxx>                #
+#   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/>.     #
+#                                                                             #
+###############################################################################
+
+{'name': "Bank statement Sale Order completion",
+ 'version': '0.1',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'easy',
+ 'depends': ['account_statement_base_completion', 'sale'],
+ 'description': """
+ This module improve the module account_statement_base_completion to add
+ support for completion rules based on Sale Orders. This was initially part of
+ the module account_statement_base_completion, but is now separate to keep
+ dependencies separate.
+
+ This module provides the following rule:
+
+  1) Match from statement line reference (based on SO number)
+""",
+ 'website': 'http://www.camptocamp.com',
+ 'data': [
+     'data.xml',
+ ],
+ 'test': [
+     'test/completion_so_test.yml'],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': True,
+ 'license': 'AGPL-3',
+ }

=== added file 'account_statement_so_completion/data.xml'
--- account_statement_so_completion/data.xml	1970-01-01 00:00:00 +0000
+++ account_statement_so_completion/data.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <record id="bank_statement_completion_rule_1" model="account.statement.completion.rule">
+            <field name="name">Match from line reference (based on SO number)</field>
+            <field name="sequence">50</field>
+            <field name="function_to_call">get_from_ref_and_so</field>
+        </record>
+
+    </data>
+</openerp>

=== added directory 'account_statement_so_completion/i18n'
=== added file 'account_statement_so_completion/i18n/account_statement_so_completion.pot'
--- account_statement_so_completion/i18n/account_statement_so_completion.pot	1970-01-01 00:00:00 +0000
+++ account_statement_so_completion/i18n/account_statement_so_completion.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,28 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_so_completion
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:04+0000\n"
+"PO-Revision-Date: 2014-01-21 12:04+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_statement_so_completion
+#: code:addons/account_statement_so_completion/statement.py:77
+#, python-format
+msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on SO by ref."
+msgstr ""
+
+#. module: account_statement_so_completion
+#: model:ir.model,name:account_statement_so_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr ""
+

=== added file 'account_statement_so_completion/statement.py'
--- account_statement_so_completion/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_so_completion/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#                                                                             #
+#   Author: Joel Grand-Guillaume                                              #
+#   Copyright 2011-2012 Camptocamp SA                                         #
+#                                                                             #
+#   Author: Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxxxx>                #
+#   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 fields, orm
+from tools.translate import _
+
+from openerp.addons.account_statement_base_completion.statement import ErrorTooManyPartner
+
+
+class account_statement_completion_rule(orm.Model):
+
+    _name = "account.statement.completion.rule"
+    _inherit = "account.statement.completion.rule"
+
+    def _get_functions(self, cr, uid, context=None):
+        res = super(account_statement_completion_rule, self)._get_functions(
+            cr, uid, context=context)
+        res.append(
+            ('get_from_ref_and_so', 'From line reference (based on SO number)')
+        )
+        return res
+
+    # Should be private but data are initialised with no update XML
+    def get_from_ref_and_so(self, cr, uid, st_line, context=None):
+        """
+        Match the partner based on the SO number and the reference of the
+        statement line. Then, call the generic get_values_for_line method to
+        complete other values. If more than one partner matched, raise the
+        ErrorTooManyPartner error.
+
+        :param int/long st_line: read of the concerned
+        account.bank.statement.line
+
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id': value,
+
+            ...}
+        """
+        st_obj = self.pool.get('account.bank.statement.line')
+        res = {}
+        if st_line:
+            so_obj = self.pool.get('sale.order')
+            so_id = so_obj.search(cr,
+                                  uid,
+                                  [('name', '=', st_line['ref'])],
+                                  context=context)
+            if so_id:
+                if so_id and len(so_id) == 1:
+                    so = so_obj.browse(cr, uid, so_id[0], context=context)
+                    res['partner_id'] = so.partner_id.id
+                elif so_id and len(so_id) > 1:
+                    raise ErrorTooManyPartner(
+                        _('Line named "%s" (Ref:%s) was matched by more '
+                          'than one partner while looking on SO by ref.') %
+                        (st_line['name'], st_line['ref']))
+                st_vals = st_obj.get_values_for_line(
+                    cr,
+                    uid,
+                    profile_id=st_line['profile_id'],
+                    master_account_id=st_line['master_account_id'],
+                    partner_id=res.get('partner_id', False),
+                    line_type='customer',
+                    amount=st_line['amount'] if st_line['amount'] else 0.0,
+                    context=context)
+                res.update(st_vals)
+        return res
+
+    _columns = {
+        'function_to_call': fields.selection(_get_functions, 'Method'),
+    }

=== added directory 'account_statement_so_completion/test'
=== added file 'account_statement_so_completion/test/completion_so_test.yml'
--- account_statement_so_completion/test/completion_so_test.yml	1970-01-01 00:00:00 +0000
+++ account_statement_so_completion/test/completion_so_test.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,44 @@
+-
+  In order to test the banking framework for Sale Orders, I first need to
+  create a profile
+-
+  !record {model: account.statement.profile, id: profile_test_so}:
+    name: Bank EUR Profile for SO
+    journal_id: account.bank_journal
+    commission_account_id: account.a_expense
+    company_id: base.main_company
+    balance_check: True
+    rule_ids:
+      - account_statement_base_completion.bank_statement_completion_rule_4
+      - account_statement_base_completion.bank_statement_completion_rule_5
+      - account_statement_base_completion.bank_statement_completion_rule_2
+      - account_statement_base_completion.bank_statement_completion_rule_3
+      - bank_statement_completion_rule_1
+-
+  Now I create a statement. I create statment lines separately because I need
+  to find each one by XML id
+-
+  !record {model: account.bank.statement, id: statement_test_sale1}:
+    name: Statement for SO
+    profile_id: profile_test_so
+    company_id: base.main_company
+-
+  I create a statement line for a SO
+-
+  !record {model: account.bank.statement.line, id: statement_line_so}:
+    name: Test autocompletion based on Sale Order Number
+    statement_id: statement_test_sale1
+    ref: SO007
+    date: '2013-12-20'
+    amount: 14981.0
+-
+  I run the auto complete
+-
+  !python {model: account.bank.statement}: |
+    result = self.button_auto_completion(cr, uid, [ref("statement_test_sale1")])
+-
+  Now I can check that all is nice and shiny, line 1. I expect the Sale Order
+  Number to be recognised.
+-
+  !assert {model: account.bank.statement.line, id: statement_line_so, string: Check completion by SO number}:
+    - partner_id.name == u'Luminous Technologies'

=== added directory 'account_statement_transactionid_completion'
=== added file 'account_statement_transactionid_completion/__init__.py'
--- account_statement_transactionid_completion/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+
+import statement

=== added file 'account_statement_transactionid_completion/__openerp__.py'
--- account_statement_transactionid_completion/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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': "Bank statement completion from transaction ID",
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': [
+     'account_statement_base_completion',
+     'base_transaction_id'
+     ],
+ 'description': """
+  Add a completion method based on transaction ID providen by the bank/office.
+
+  This transaction ID has been recorded on the SO (by a mapping
+  through the e-commerce connector, or manually). Completion will look
+  in the SO with that transaction ID to match the partner, then it
+  will fill in the bank statement line with it,  as well as
+  the reference with the found SO name to ease the reconciliation.
+
+  This way, the reconciliation always happen on the SO name stored in ref.
+
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'init_xml': [],
+ 'update_xml': [
+    "statement_view.xml",
+    "data.xml",
+ ],
+ 'demo_xml': [],
+ 'test': [
+     'test/sale.yml',
+     'test/completion_transactionid_test.yml',
+ ],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': True,
+ 'license': 'AGPL-3',
+}

=== added file 'account_statement_transactionid_completion/data.xml'
--- account_statement_transactionid_completion/data.xml	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/data.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="1">
+
+    <record id="bank_statement_completion_rule_4" model="account.statement.completion.rule">
+         <field name="name">Match from line reference (based on transaction ID)</field>
+         <field name="sequence">30</field>
+         <field name="function_to_call">get_from_transaction_id_and_so</field>
+     </record>
+    
+</data>
+</openerp>

=== added directory 'account_statement_transactionid_completion/i18n'
=== added file 'account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot'
--- account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,43 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_statement_transactionid_completion
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:02+0000\n"
+"PO-Revision-Date: 2014-01-21 12:02+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_statement_transactionid_completion
+#: code:addons/account_statement_transactionid_completion/statement.py:65
+#, python-format
+msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner."
+msgstr ""
+
+#. module: account_statement_transactionid_completion
+#: model:ir.model,name:account_statement_transactionid_completion.model_account_bank_statement_line
+msgid "Bank Statement Line"
+msgstr ""
+
+#. module: account_statement_transactionid_completion
+#: help:account.bank.statement.line,transaction_id:0
+msgid "Transaction id from the financial institute"
+msgstr ""
+
+#. module: account_statement_transactionid_completion
+#: model:ir.model,name:account_statement_transactionid_completion.model_account_statement_completion_rule
+msgid "account.statement.completion.rule"
+msgstr ""
+
+#. module: account_statement_transactionid_completion
+#: field:account.bank.statement.line,transaction_id:0
+msgid "Transaction ID"
+msgstr ""
+

=== added file 'account_statement_transactionid_completion/statement.py'
--- account_statement_transactionid_completion/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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.tools.translate import _
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.addons.account_statement_base_completion.statement import ErrorTooManyPartner
+
+
+class AccountStatementCompletionRule(Model):
+    """Add a rule based on transaction ID"""
+
+    _inherit = "account.statement.completion.rule"
+
+    def _get_functions(self, cr, uid, context=None):
+        res = super(AccountStatementCompletionRule, self)._get_functions(
+                                                           cr, uid, context=context)
+        res.append(('get_from_transaction_id_and_so',
+                    'From line reference (based on SO transaction ID)'))
+        return res
+
+    _columns = {
+        'function_to_call': fields.selection(_get_functions, 'Method'),
+    }
+
+    def get_from_transaction_id_and_so(self, cr, uid, st_line, context=None):
+        """
+        Match the partner based on the transaction ID field of the SO.
+        Then, call the generic st_line method to complete other values.
+        In that case, we always fullfill the reference of the line with the SO name.
+        :param dict st_line: read of the concerned account.bank.statement.line
+        :return:
+            A dict of value that can be passed directly to the write method of
+            the statement line or {}
+           {'partner_id': value,
+            'account_id' : value,
+            ...}
+            """
+        st_obj = self.pool.get('account.bank.statement.line')
+        res = {}
+        so_obj = self.pool.get('sale.order')
+        so_id = so_obj.search(cr,
+                              uid,
+                              [('transaction_id', '=', st_line['transaction_id'])],
+                              context=context)
+        if len(so_id) > 1:
+            raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more than '
+                                        'one partner.') % (st_line['name'], st_line['ref']))
+        if len(so_id) == 1:
+            so = so_obj.browse(cr, uid, so_id[0], context=context)
+            res['partner_id'] = so.partner_id.id
+            res['ref'] = so.name
+            st_vals = st_obj.get_values_for_line(cr,
+                                                 uid,
+                                                 profile_id=st_line['profile_id'],
+                                                 master_account_id=st_line['master_account_id'],
+                                                 partner_id=res.get('partner_id', False),
+                                                 line_type=st_line['type'],
+                                                 amount=st_line['amount'] if st_line['amount'] else 0.0,
+                                                 context=context)
+            res.update(st_vals)
+        return res
+
+
+class AccountStatementLine(Model):
+    _inherit = "account.bank.statement.line"
+
+    _columns = {
+        # 'additionnal_bank_fields' : fields.serialized('Additionnal infos from bank', help="Used by completion and import system."),
+        'transaction_id': fields.sparse(
+            type='char',
+            string='Transaction ID',
+            size=128,
+            serialization_field='additionnal_bank_fields',
+            help="Transaction id from the financial institute"),
+    }

=== added file 'account_statement_transactionid_completion/statement_view.xml'
--- account_statement_transactionid_completion/statement_view.xml	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <record id="bank_statement_view_form" model="ir.ui.view">
+         <field name="name">account_bank_statement_import_base.bank_statement.view_form</field>
+         <field name="model">account.bank.statement</field>
+         <field name="inherit_id" ref="account.view_bank_statement_form" />
+         <field eval="20" name="priority"/>
+         <field name="type">form</field>
+         <field name="arch" type="xml">
+             <data>
+                 <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='label']" position="after">
+                     <field name="transaction_id" />
+                 </xpath>
+             </data>
+         </field>
+     </record>
+
+
+</data>
+</openerp>

=== added directory 'account_statement_transactionid_completion/test'
=== added file 'account_statement_transactionid_completion/test/completion_transactionid_test.yml'
--- account_statement_transactionid_completion/test/completion_transactionid_test.yml	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/test/completion_transactionid_test.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,44 @@
+-
+  In order to test the banking framework, I first need to create a profile
+-
+  !record {model: account.statement.profile, id: statement_profile_transactionid}:
+    name: Bank EUR Profile (transaction ID)
+    journal_id: account.bank_journal
+    commission_account_id: account.a_expense
+    company_id: base.main_company
+    balance_check: True
+    rule_ids:
+      - bank_statement_completion_rule_4
+      - account_statement_base_completion.bank_statement_completion_rule_4
+      - account_statement_base_completion.bank_statement_completion_rule_5
+      - account_statement_base_completion.bank_statement_completion_rule_2
+      - account_statement_base_completion.bank_statement_completion_rule_3
+-
+  Now I create a statement. I create statment lines separately because I need
+  to find each one by XML id
+-
+  !record {model: account.bank.statement, id: statement_transactionid_test1}:
+    name: Statement with transaction ID
+    profile_id: statement_profile_transactionid
+    company_id: base.main_company
+-
+  I create a statement line for a SO with transaction ID
+-
+  !record {model: account.bank.statement.line, id: statement_line_transactionid}:
+    name: Test autocompletion based on SO with transaction ID
+    statement_id: statement_transactionid_test1
+    transaction_id: XXX66Z
+    ref: 6
+    date: '2014-01-06'
+    amount: 118.4
+-
+  I run the auto complete
+-
+  !python {model: account.bank.statement}: |
+    result = self.button_auto_completion(cr, uid, [ref("statement_profile_transactionid")])
+-
+  Now I can check that all is nice and shiny, line 1. I expect the SO has been
+  recognised from the transaction ID.
+-
+  !assert {model: account.bank.statement.line, id: statement_line_transactionid, string: Check completion by SO transaction ID}:
+    - partner_id.name == u'Agrolait'

=== added file 'account_statement_transactionid_completion/test/sale.yml'
--- account_statement_transactionid_completion/test/sale.yml	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_completion/test/sale.yml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,11 @@
+-
+  I create a new Sale Order with transaction ID
+-
+  !record {model: sale.order, id: so_with_transaction_id}:
+    partner_id: base.res_partner_2
+    note: Invoice after delivery
+    payment_term: account.account_payment_term
+    transaction_id: XXX66Z
+    order_line: 
+      - product_id: product.product_product_7
+        product_uom_qty: 8

=== added directory 'account_statement_transactionid_import'
=== added file 'account_statement_transactionid_import/__init__.py'
--- account_statement_transactionid_import/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+import parser
+import statement

=== added file 'account_statement_transactionid_import/__openerp__.py'
--- account_statement_transactionid_import/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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': "Bank statement transactionID import",
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': 'normal',
+ 'depends': [
+     'account_statement_base_import',
+     'account_statement_transactionid_completion'
+     ],
+ 'description': """
+ This module brings generic methods and fields on bank statement to deal with
+ the importation of different bank and offices that uses transactionID.
+
+ This module allows you to import your bank transactions with a standard .csv or .xls file
+ (you'll find samples in the 'data' folder). It respects the chosen profile
+ (model provided by the account_statement_ext module) to generate the entries.
+
+ This module can handle a commission taken by the payment office and has the following format:
+
+ * transaction_id:    the transaction ID given by the bank/office. It is used as reference
+                       in the generated entries and is useful for reconciliation process
+ * date:              date of the payment
+ * amount:            amount paid in the currency of the journal used in the importation profile
+ * commission_amount: amount of the comission for each line
+ * label:             the comunication given by the payment office, used as communication in the
+                       generated entries.
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'init_xml': [],
+ 'update_xml': [
+ ],
+ 'demo_xml': [],
+ 'test': [],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+}

=== added directory 'account_statement_transactionid_import/data'
=== added file 'account_statement_transactionid_import/data/statement.csv'
--- account_statement_transactionid_import/data/statement.csv	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/data/statement.csv	2014-03-27 09:24:37 +0000
@@ -0,0 +1,4 @@
+"transaction_id";"date";"amount";"commission_amount";"label"
+50969286;2011-03-07 13:45:14;118.4;-11.84;"label a"
+51065326;2011-03-05 13:45:14;189;-15.12;"label b"
+51179306;2011-03-02 17:45:14;189;-15.12;"label c"

=== added file 'account_statement_transactionid_import/data/statement.xls'
Binary files account_statement_transactionid_import/data/statement.xls	1970-01-01 00:00:00 +0000 and account_statement_transactionid_import/data/statement.xls	2014-03-27 09:24:37 +0000 differ
=== added directory 'account_statement_transactionid_import/i18n'
=== added file 'account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot'
--- account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:02+0000\n"
+"PO-Revision-Date: 2014-01-21 12:02+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_statement_transactionid_import
+#: model:ir.model,name:account_statement_transactionid_import.model_account_statement_profile
+msgid "Statement Profile"
+msgstr ""
+

=== added directory 'account_statement_transactionid_import/parser'
=== added file 'account_statement_transactionid_import/parser/__init__.py'
--- account_statement_transactionid_import/parser/__init__.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/parser/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi
+#    Copyright 2011-2012 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/>.
+#
+##############################################################################
+
+import transactionid_file_parser

=== added file 'account_statement_transactionid_import/parser/transactionid_file_parser.py'
--- account_statement_transactionid_import/parser/transactionid_file_parser.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/parser/transactionid_file_parser.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright Camptocamp SA
+#    Author Joel Grand-Guillaume
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU 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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import datetime
+from account_statement_base_import.parser.file_parser import FileParser
+
+
+class TransactionIDFileParser(FileParser):
+    """
+    TransactionID parser that use a define format in csv or xls to import
+    bank statement.
+    """
+
+    def __init__(self, parse_name, ftype='csv', extra_fields=None, header=None, **kwargs):
+        """
+        Add transaction_id in header keys
+            :param char: parse_name: The name of the parser
+            :param char: ftype: extension of the file (could be csv or xls)
+            :param dict: extra_fields: extra fields to add to the conversion dict. In the format
+                                     {fieldname: fieldtype}
+            :param list: header : specify header fields if the csv file has no header
+            """
+        extra_fields = {'transaction_id': unicode}
+        super(TransactionIDFileParser, self).__init__(parse_name, extra_fields=extra_fields,
+                                                      ftype=ftype, header=header, **kwargs)
+        # ref is replaced by transaction_id thus we delete it from check
+        self.keys_to_validate = [k for k in self.keys_to_validate if k != 'ref']
+        del self.conversion_dict['ref']
+
+    @classmethod
+    def parser_for(cls, parser_name):
+        """
+        Used by the new_bank_statement_parser class factory. Return true if
+        the providen name is generic_csvxls_transaction
+        """
+        return parser_name == 'generic_csvxls_transaction'
+
+    def get_st_line_vals(self, line, *args, **kwargs):
+        """
+        This method must return a dict of vals that can be passed to create
+        method of statement line in order to record it. It is the responsibility
+        of every parser to give this dict of vals, so each one can implement his
+        own way of recording the lines.
+            :param:  line: a dict of vals that represent a line of result_row_list
+            :return: dict of values to give to the create method of statement line,
+                     it MUST contain at least:
+                {
+                    'name':value,
+                    'date':value,
+                    'amount':value,
+                    'ref':value,
+                    'label':value,
+                    'commission_amount':value,
+                }
+        In this generic parser, the commission is given for every line, so we store it
+        for each one.
+        """
+        return {'name': line.get('label', line.get('ref', '/')),
+                'date': line.get('date', datetime.datetime.now().date()),
+                'amount': line.get('amount', 0.0),
+                'ref': line.get('transaction_id', '/'),
+                'label': line.get('label', ''),
+                'transaction_id': line.get('transaction_id', '/'),
+                'commission_amount': line.get('commission_amount', 0.0)}

=== added file 'account_statement_transactionid_import/statement.py'
--- account_statement_transactionid_import/statement.py	1970-01-01 00:00:00 +0000
+++ account_statement_transactionid_import/statement.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Joel Grand-Guillaume
+#    Copyright 2011-2012 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
+from openerp.osv import fields
+
+
+class AccountStatementProfil(Model):
+    _inherit = "account.statement.profile"
+
+    def get_import_type_selection(self, cr, uid, context=None):
+        """
+        Has to be inherited to add parser
+        """
+        res = super(AccountStatementProfil, self).get_import_type_selection(
+                cr, uid, context=context)
+        res.append(('generic_csvxls_transaction',
+                    'Generic .csv/.xls based on SO transaction ID'))
+        return res
+
+    _columns = {
+        'import_type': fields.selection(
+            get_import_type_selection,
+            'Type of import',
+            required=True,
+            help="Choose here the method by which you want to import "
+                 "bank statement for this profile."),
+
+    }

=== added directory 'base_transaction_id'
=== added file 'base_transaction_id/__init__.py'
--- base_transaction_id/__init__.py	1970-01-01 00:00:00 +0000
+++ base_transaction_id/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher (Camptocamp)
+#    Copyright 2012 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 invoice
+from . import sale
+from . import stock

=== added file 'base_transaction_id/__openerp__.py'
--- base_transaction_id/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_transaction_id/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher (Camptocamp)
+#    Copyright 2012 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': 'Base transaction id for financial institutes',
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Hidden/Dependency',
+ 'complexity': 'easy',
+ 'depends': [
+     'account',
+     'sale',
+     'stock'
+     ],
+ 'description': """
+ Adds transaction id to invoice and sale models and views.
+ On Sales order, you can specify the transaction ID used
+ for the payment and it will be propagated to the invoice
+ (even if made from packing).
+ This is mostly used for e-commerce handling.
+ You can then add a mapping on that SO field to save
+ the e-commerce financial Transaction ID into the
+ OpenERP sale order field.
+ The main purpose is to ease the reconciliation process and
+ be able to find the partner when importing the bank statement.
+ """,
+ 'website': 'http://www.openerp.com',
+ 'init_xml': [],
+ 'update_xml': [
+     'invoice_view.xml',
+     'sale_view.xml'
+     ],
+ 'demo_xml': [],
+ 'test': [],
+ 'installable': True,
+ 'images': [],
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+}

=== added directory 'base_transaction_id/i18n'
=== added file 'base_transaction_id/i18n/base_transaction_id.pot'
--- base_transaction_id/i18n/base_transaction_id.pot	1970-01-01 00:00:00 +0000
+++ base_transaction_id/i18n/base_transaction_id.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,58 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* base_transaction_id
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:03+0000\n"
+"PO-Revision-Date: 2014-01-21 12:03+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: base_transaction_id
+#: field:account.invoice,transaction_id:0
+#: field:sale.order,transaction_id:0
+msgid "Transaction id"
+msgstr ""
+
+#. module: base_transaction_id
+#: view:account.invoice:0
+msgid "Transactions datas"
+msgstr ""
+
+#. module: base_transaction_id
+#: help:sale.order,transaction_id:0
+msgid "Transaction id from the financial institute"
+msgstr ""
+
+#. module: base_transaction_id
+#: help:account.invoice,transaction_id:0
+msgid "Transction id from the financial institute"
+msgstr ""
+
+#. module: base_transaction_id
+#: model:ir.actions.act_window,name:base_transaction_id.prm_act
+msgid "Packing"
+msgstr ""
+
+#. module: base_transaction_id
+#: model:ir.model,name:base_transaction_id.model_account_invoice
+msgid "Invoice"
+msgstr ""
+
+#. module: base_transaction_id
+#: model:ir.model,name:base_transaction_id.model_stock_picking
+msgid "Picking List"
+msgstr ""
+
+#. module: base_transaction_id
+#: model:ir.model,name:base_transaction_id.model_sale_order
+msgid "Sales Order"
+msgstr ""
+

=== added file 'base_transaction_id/invoice.py'
--- base_transaction_id/invoice.py	1970-01-01 00:00:00 +0000
+++ base_transaction_id/invoice.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi
+#    Copyright 2011-2012 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
+from openerp.osv import fields
+
+
+class AccountInvoice(Model):
+    _inherit = 'account.invoice'
+
+    _columns = {
+        'transaction_id': fields.char(
+            'Transaction id',
+            size=128,
+            required=False,
+            select=1,
+            help="Transction id from the financial institute"),
+    }

=== added file 'base_transaction_id/invoice_view.xml'
--- base_transaction_id/invoice_view.xml	1970-01-01 00:00:00 +0000
+++ base_transaction_id/invoice_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record model="ir.ui.view" id="invoice_view_custom">
+            <field name="name">customer.invoice.transaction.inherit</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <notebook position="inside">
+                    <page string="Transactions datas">
+                        <field name="transaction_id" select="2"/>
+                    </page>
+                </notebook>
+            </field>
+        </record>
+
+        <record model="ir.ui.view" id="invoice_tree_custom">
+            <field name="name">account.invoice.tree.inherit</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_tree"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <field name="origin" position="after">
+                    <field name="transaction_id" select="2"/>
+                </field>
+            </field>
+        </record>
+    </data>
+</openerp>

=== added file 'base_transaction_id/sale.py'
--- base_transaction_id/sale.py	1970-01-01 00:00:00 +0000
+++ base_transaction_id/sale.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi
+#    Copyright 2011-2012 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
+from openerp.osv import fields
+
+
+class SaleOrder(Model):
+    _inherit = 'sale.order'
+
+    _columns = {
+        'transaction_id': fields.char(
+            'Transaction id',
+            size=128,
+            required=False,
+            help="Transaction id from the financial institute"),
+    }
+
+    def _prepare_invoice(self, cr, uid, order, lines, context=None):
+        #we put the transaction id in the generated invoices
+        invoice_vals = super(SaleOrder, self)._prepare_invoice(
+                cr, uid, order, lines, context=context)
+        invoice_vals.update({
+            'transaction_id': order.transaction_id})
+        return invoice_vals

=== added file 'base_transaction_id/sale_view.xml'
--- base_transaction_id/sale_view.xml	1970-01-01 00:00:00 +0000
+++ base_transaction_id/sale_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+<openerp>
+    <data>
+        <record id="view_order_form_transaction" model="ir.ui.view">
+            <field name="name">sale.order.form.transaction</field>
+            <field name="model">sale.order</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="sale.view_order_form"/>
+            <field name="arch" type="xml">
+                <field name="payment_term" position="after">
+                    <field name="transaction_id" select="2"/>
+                </field>
+            </field>
+        </record>
+         <act_window
+            domain="[('origin', '=', name)]" 
+            id="prm_act" 
+            name="Packing" 
+            res_model="stock.picking" 
+            src_model="sale.order"/>
+    </data>
+</openerp>
\ No newline at end of file

=== added file 'base_transaction_id/stock.py'
--- base_transaction_id/stock.py	1970-01-01 00:00:00 +0000
+++ base_transaction_id/stock.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Nicolas Bessi
+#    Copyright 2011-2012 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
+
+
+class StockPicking(Model):
+    _inherit = "stock.picking"
+
+    def action_invoice_create(
+            self, cr, uid, ids, journal_id=False, group=False,
+            type='out_invoice', context=None):
+        res = super(StockPicking, self).action_invoice_create(
+                cr, uid, ids, journal_id, group, type, context)
+        for pick_id in res:
+            pick = self.browse(cr, uid, pick_id, context=context)
+            if pick.sale_id and pick.sale_id.transaction_id:
+                self.pool.get('account.invoice').write(
+                        cr,
+                        uid,
+                        res[pick_id],
+                        {'transaction_id': pick.sale_id.transaction_id},
+                        context=context)
+        return res

=== added directory 'invoicing_voucher_killer'
=== added file 'invoicing_voucher_killer/__init__.py'
--- invoicing_voucher_killer/__init__.py	1970-01-01 00:00:00 +0000
+++ invoicing_voucher_killer/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#   Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
+#   @author Nicolas Bessi
+#
+#    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/>.
+#
+##############################################################################

=== added file 'invoicing_voucher_killer/__openerp__.py'
--- invoicing_voucher_killer/__openerp__.py	1970-01-01 00:00:00 +0000
+++ invoicing_voucher_killer/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#   Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
+#   @author Nicolas Bessi
+#
+#    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': 'Invoicing voucher killer',
+ 'version': '1.0.0',
+ 'category': 'other',
+ 'description': """
+Prevent the usage of voucher from invoices
+##########################################
+This add-on will disable "Register Payment" button
+""",
+ 'author': 'Camptocamp',
+ 'website': 'http://www.camptocamp.com',
+ 'depends': ['account_voucher'],
+ 'data': ['invoice_data.xml',
+          'invoice_view.xml'],
+ 'demo_xml': [],
+ 'test': [],
+ 'installable': True,
+ 'active': False,
+ }

=== added directory 'invoicing_voucher_killer/i18n'
=== added file 'invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot'
--- invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot	1970-01-01 00:00:00 +0000
+++ invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,32 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* invoicing_voucher_killer
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:00+0000\n"
+"PO-Revision-Date: 2014-01-21 12:00+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: invoicing_voucher_killer
+#: view:account.invoice:0
+msgid "Pay"
+msgstr ""
+
+#. module: invoicing_voucher_killer
+#: model:res.groups,name:invoicing_voucher_killer.invoice_voucher_user
+msgid "Use voucher in Invoices"
+msgstr ""
+
+#. module: invoicing_voucher_killer
+#: view:account.invoice:0
+msgid "Register Payment"
+msgstr ""
+

=== added file 'invoicing_voucher_killer/invoice_data.xml'
--- invoicing_voucher_killer/invoice_data.xml	1970-01-01 00:00:00 +0000
+++ invoicing_voucher_killer/invoice_data.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,7 @@
+<openerp>
+  <data>
+    <record id="invoice_voucher_user" model="res.groups">
+      <field name="name">Use voucher in Invoices</field>
+    </record>
+  </data>
+</openerp>

=== added file 'invoicing_voucher_killer/invoice_view.xml'
--- invoicing_voucher_killer/invoice_view.xml	1970-01-01 00:00:00 +0000
+++ invoicing_voucher_killer/invoice_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,48 @@
+<openerp>
+  <data>
+    <record id="invoice_voucher_group" model="ir.ui.view">
+      <field name="name">Hide voucher in invoice</field>
+      <field name="model">account.invoice</field>
+      <field name="inherit_id" ref="account_voucher.view_invoice_customer" />
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+        <xpath expr="//button[@name='invoice_pay_customer'][last()]"
+               position="replace">
+          <button name="invoice_pay_customer"
+                  type="object"
+                  string="Register Payment"
+                  attrs="{'invisible': ['|', ('state','!=','open'), ('sent','=',True)]}"
+                  groups="invoicing_voucher_killer.invoice_voucher_user"/>
+        </xpath>
+        <xpath expr="//button[@name='invoice_pay_customer'][1]"
+               position="replace">
+          <button name="invoice_pay_customer"
+                  type="object"
+                  string="Register Payment"
+                  attrs="{'invisible': ['|', ('state','!=','open'), ('sent','=',False)]}"
+                  class="oe_highlight"
+                  groups="invoicing_voucher_killer.invoice_voucher_user"/>
+        </xpath>
+      </field>
+    </record>
+
+    <record id="invoice_voucher_group_supp_inv" model="ir.ui.view">
+      <field name="name">Hide voucher in supplier invoice</field>
+      <field name="model">account.invoice</field>
+      <field name="inherit_id" ref="account_voucher.view_invoice_supplier" />
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+        <xpath expr="//button[@name='invoice_pay_customer'][last()]"
+               position="replace">
+          <button name="invoice_pay_customer"
+                  type="object"
+                  string="Pay"
+                  states="open"
+                  class="oe_highlight"
+                  groups="invoicing_voucher_killer.invoice_voucher_user"/>
+        </xpath>
+      </field>
+    </record>
+
+  </data>
+</openerp>

=== added directory 'statement_voucher_killer'
=== added file 'statement_voucher_killer/__init__.py'
--- statement_voucher_killer/__init__.py	1970-01-01 00:00:00 +0000
+++ statement_voucher_killer/__init__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#   Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
+#   @author Nicolas Bessi
+#
+#    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 voucher

=== added file 'statement_voucher_killer/__openerp__.py'
--- statement_voucher_killer/__openerp__.py	1970-01-01 00:00:00 +0000
+++ statement_voucher_killer/__openerp__.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#   Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
+#   @author Nicolas Bessi
+#
+#    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': 'Satement voucher killer',
+ 'version': '1.0.0',
+ 'category': 'other',
+ 'description': """
+Prevent voucher creation when importing lines into statement.
+#############################################################
+
+When importing invoice or payment into a bank statement or a payment order, normally a
+draft voucher is created on the line. This module will disable this voucher creation.
+When importing payment line, date used to populate statement
+line will be take from imported line in this order:
+
+ * Date
+ * Maturity date
+ * Related statement date
+
+""",
+ 'author': 'Camptocamp',
+ 'website': 'http://www.camptocamp.com',
+ 'depends': ['account_voucher', 'account_payment'],
+ 'data': [
+     'statement_view.xml',
+     ],
+ 'test': [],
+ 'installable': True,
+ 'active': False,
+ }

=== added directory 'statement_voucher_killer/i18n'
=== added file 'statement_voucher_killer/i18n/statement_voucher_killer.pot'
--- statement_voucher_killer/i18n/statement_voucher_killer.pot	1970-01-01 00:00:00 +0000
+++ statement_voucher_killer/i18n/statement_voucher_killer.pot	2014-03-27 09:24:37 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* statement_voucher_killer
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-21 12:00+0000\n"
+"PO-Revision-Date: 2014-01-21 12:00+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: statement_voucher_killer
+#: model:ir.model,name:statement_voucher_killer.model_account_statement_from_invoice_lines
+msgid "Entries by Statement from Invoices"
+msgstr ""
+
+#. module: statement_voucher_killer
+#: model:ir.model,name:statement_voucher_killer.model_account_payment_populate_statement
+msgid "Account Payment Populate Statement"
+msgstr ""
+

=== added file 'statement_voucher_killer/statement_view.xml'
--- statement_voucher_killer/statement_view.xml	1970-01-01 00:00:00 +0000
+++ statement_voucher_killer/statement_view.xml	2014-03-27 09:24:37 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<openerp>
+    <data>
+    
+        <!-- INHERITED VIEW FOR THE OBJECT : account_bank_statement -->
+
+        <record id="account_bank_statement_view_form" model="ir.ui.view">
+            <field name="model">account.bank.statement</field>
+            <field name="inherit_id" ref="account.view_bank_statement_form" />
+            <field eval="100" name="priority"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <field name="voucher_id" position="replace">
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added file 'statement_voucher_killer/voucher.py'
--- statement_voucher_killer/voucher.py	1970-01-01 00:00:00 +0000
+++ statement_voucher_killer/voucher.py	2014-03-27 09:24:37 +0000
@@ -0,0 +1,129 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#   Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
+#   @author Nicolas Bessi
+#
+#    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
+
+import time
+
+
+class AccountStatementFromInvoiceLines(orm.TransientModel):
+
+    _inherit = "account.statement.from.invoice.lines"
+
+    def populate_statement(self, cr, uid, ids, context=None):
+        """Taken from account voucher as no hook is available. No function
+        no refactoring, just trimming the part that generates voucher"""
+        if context is None:
+            context = {}
+        statement_id = context.get('statement_id', False)
+        if not statement_id:
+            return {'type': 'ir.actions.act_window_close'}
+        data = self.read(cr, uid, ids, context=context)[0]
+        line_ids = data['line_ids']
+        if not line_ids:
+            return {'type': 'ir.actions.act_window_close'}
+
+        line_obj = self.pool.get('account.move.line')
+        statement_obj = self.pool.get('account.bank.statement')
+        statement_line_obj = self.pool.ge