From 69b28c9ed37db6b4b37ee1cf9f489ac602561114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Beau?= Date: Fri, 14 Jun 2013 18:09:31 +0200 Subject: [PATCH 01/25] [INIT] add module account_statement_simple_view --- account_statement_simple_view/__init__.py | 22 ++++++++++ account_statement_simple_view/__openerp__.py | 41 +++++++++++++++++++ .../statement_view.xml | 29 +++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 account_statement_simple_view/__init__.py create mode 100644 account_statement_simple_view/__openerp__.py create mode 100644 account_statement_simple_view/statement_view.xml diff --git a/account_statement_simple_view/__init__.py b/account_statement_simple_view/__init__.py new file mode 100644 index 00000000..b50f6309 --- /dev/null +++ b/account_statement_simple_view/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# account_bank_statement_simple_view for OpenERP +# Copyright (C) 2013-TODAY Akretion . +# @author 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 . +# +############################################################################### + diff --git a/account_statement_simple_view/__openerp__.py b/account_statement_simple_view/__openerp__.py new file mode 100644 index 00000000..ee75594a --- /dev/null +++ b/account_statement_simple_view/__openerp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# account_statement_simple_view for OpenERP +# Copyright (C) 2013-TODAY Akretion . +# @author 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 . +# +############################################################################### + +{ + 'name': 'account_bank_statement_simple_view', + 'version': '0.1', + 'category': 'Generic Modules/Others', + 'license': 'AGPL-3', + 'description': """Module that remove the useless import button on bank statement and also the useless red icon on bank statement line""", + 'author': 'Akretion', + 'website': 'http://www.akretion.com/', + 'depends': [ + 'account_statement_base_import', + ], + 'init_xml': [], + 'update_xml': [ + 'statement_view.xml', + ], + 'demo_xml': [], + 'installable': True, + 'active': False, +} diff --git a/account_statement_simple_view/statement_view.xml b/account_statement_simple_view/statement_view.xml new file mode 100644 index 00000000..682d93b2 --- /dev/null +++ b/account_statement_simple_view/statement_view.xml @@ -0,0 +1,29 @@ + + + + + + + + + + account_bank_statement_simple_view.account_bank_statement.view_form + account.bank.statement + + + form + +
+
+ + + +
+
+ +
+
From 0164efeae71a14f040bedad7a61d3a910db32817 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 11 Dec 2013 17:18:58 +0100 Subject: [PATCH 02/25] [IMP] hide useless red button of voucher_id on the statement line --- statement_voucher_killer/__openerp__.py | 6 ++--- statement_voucher_killer/statement_view.xml | 25 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 statement_voucher_killer/statement_view.xml diff --git a/statement_voucher_killer/__openerp__.py b/statement_voucher_killer/__openerp__.py index 2460cd9a..1e5f2f1d 100644 --- a/statement_voucher_killer/__openerp__.py +++ b/statement_voucher_killer/__openerp__.py @@ -39,9 +39,9 @@ line will be take from imported line in this order: 'author': 'Camptocamp', 'website': 'http://www.camptocamp.com', 'depends': ['account_voucher', 'account_payment'], - 'init_xml': [], - 'update_xml': [], - 'demo_xml': [], + 'data': [ + 'statement_view.xml', + ], 'test': [], 'installable': True, 'active': False, diff --git a/statement_voucher_killer/statement_view.xml b/statement_voucher_killer/statement_view.xml new file mode 100644 index 00000000..5aee5c28 --- /dev/null +++ b/statement_voucher_killer/statement_view.xml @@ -0,0 +1,25 @@ + + + + + + + + + + account.bank.statement + + + form + + + + + + + + From fcdfe6ac6ccc8f3e8653e2831aa93f25d40df3df Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 11 Dec 2013 17:19:03 +0100 Subject: [PATCH 03/25] [REF] move the replace of the voucher_id into the statement_voucher_killer and rename simple_view in no_invoice_import' --- .../__init__.py | 2 +- .../__openerp__.py | 8 ++++---- .../statement_view.xml | 3 --- 3 files changed, 5 insertions(+), 8 deletions(-) rename {account_statement_simple_view => account_statement_no_invoice_import}/__init__.py (95%) rename {account_statement_simple_view => account_statement_no_invoice_import}/__openerp__.py (82%) rename {account_statement_simple_view => account_statement_no_invoice_import}/statement_view.xml (91%) diff --git a/account_statement_simple_view/__init__.py b/account_statement_no_invoice_import/__init__.py similarity index 95% rename from account_statement_simple_view/__init__.py rename to account_statement_no_invoice_import/__init__.py index b50f6309..b42d6e1b 100644 --- a/account_statement_simple_view/__init__.py +++ b/account_statement_no_invoice_import/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################### # -# account_bank_statement_simple_view for OpenERP +# module for OpenERP # Copyright (C) 2013-TODAY Akretion . # @author Sébastien BEAU # diff --git a/account_statement_simple_view/__openerp__.py b/account_statement_no_invoice_import/__openerp__.py similarity index 82% rename from account_statement_simple_view/__openerp__.py rename to account_statement_no_invoice_import/__openerp__.py index ee75594a..d2c8be37 100644 --- a/account_statement_simple_view/__openerp__.py +++ b/account_statement_no_invoice_import/__openerp__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################### # -# account_statement_simple_view for OpenERP +# module for OpenERP # Copyright (C) 2013-TODAY Akretion . # @author Sébastien BEAU # @@ -21,15 +21,15 @@ ############################################################################### { - 'name': 'account_bank_statement_simple_view', + 'name': 'account bank statement no invoice import', 'version': '0.1', 'category': 'Generic Modules/Others', 'license': 'AGPL-3', - 'description': """Module that remove the useless import button on bank statement and also the useless red icon on bank statement line""", + 'description': """Module that remove the import button on bank statement""", 'author': 'Akretion', 'website': 'http://www.akretion.com/', 'depends': [ - 'account_statement_base_import', + 'account', ], 'init_xml': [], 'update_xml': [ diff --git a/account_statement_simple_view/statement_view.xml b/account_statement_no_invoice_import/statement_view.xml similarity index 91% rename from account_statement_simple_view/statement_view.xml rename to account_statement_no_invoice_import/statement_view.xml index 682d93b2..3ecd4567 100644 --- a/account_statement_simple_view/statement_view.xml +++ b/account_statement_no_invoice_import/statement_view.xml @@ -19,9 +19,6 @@
- - -
From a346f295ddf904f1500e216f3cbb17892c5418e8 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 11 Dec 2013 17:22:17 +0100 Subject: [PATCH 04/25] [REF] remove useless comment --- account_statement_no_invoice_import/statement_view.xml | 5 ----- statement_voucher_killer/statement_view.xml | 5 ----- 2 files changed, 10 deletions(-) diff --git a/account_statement_no_invoice_import/statement_view.xml b/account_statement_no_invoice_import/statement_view.xml index 3ecd4567..663de0d2 100644 --- a/account_statement_no_invoice_import/statement_view.xml +++ b/account_statement_no_invoice_import/statement_view.xml @@ -1,9 +1,4 @@ - diff --git a/statement_voucher_killer/statement_view.xml b/statement_voucher_killer/statement_view.xml index 5aee5c28..e0ceda0a 100644 --- a/statement_voucher_killer/statement_view.xml +++ b/statement_voucher_killer/statement_view.xml @@ -1,9 +1,4 @@ - From 760a4781becac4dcd5929f87676313231ff3290d Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Mon, 13 Jan 2014 16:14:02 +0100 Subject: [PATCH 05/25] Add new hook to build values of the statement from he parser and the profile --- account_statement_base_import/statement.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 97e8e8ab..51fbb08c 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -90,7 +90,7 @@ class AccountStatementProfil(Model): 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. Overide it to add your + 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 @@ -126,6 +126,13 @@ class AccountStatementProfil(Model): 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. + """ + return {'profile_id': profile_id} + 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 @@ -159,9 +166,11 @@ class AccountStatementProfil(Model): _("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, - {'profile_id': prof.id}, + statement_vals, context=context) + if prof.receivable_account_id: account_receivable = account_payable = prof.receivable_account_id.id else: From bc879326ed542d241c634ca71990a7d97cc6174f Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Tue, 14 Jan 2014 15:37:18 +0100 Subject: [PATCH 06/25] PEP 8 --- account_statement_base_completion/statement.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 96ab741b..d1a028c3 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -182,7 +182,7 @@ class AccountStatementCompletionRule(orm.Model): 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 + # 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 @@ -459,7 +459,7 @@ class AccountStatementLine(orm.Model): """ 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']) + 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() @@ -470,10 +470,9 @@ class AccountStatementLine(orm.Model): 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]) + 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 @@ -497,7 +496,7 @@ class AccountStatementLine(orm.Model): 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 + 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]) From d5ecec5a41f6910e94019d3ca86ae4eb89f039fd Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Tue, 14 Jan 2014 15:39:02 +0100 Subject: [PATCH 07/25] Add the possibility to use instance of account.statement.completion.rule --- account_statement_base_completion/statement.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 96ab741b..b54803e1 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -23,6 +23,7 @@ import traceback import sys import logging import simplejson +import inspect import psycopg2 @@ -79,8 +80,7 @@ class AccountStatementProfil(orm.Model): else: prof = profile # We need to respect the sequence order - sorted_array = sorted(prof.rule_ids, key=attrgetter('sequence')) - return tuple((x.function_to_call for x in sorted_array)) + return sorted(prof.rule_ids, key=attrgetter('sequence')) def _find_values_from_rules(self, cr, uid, calls, line, context=None): """ @@ -103,8 +103,11 @@ class AccountStatementProfil(orm.Model): rule_obj = self.pool.get('account.statement.completion.rule') for call in calls: - method_to_call = getattr(rule_obj, call) - result = method_to_call(cr, uid, line, context) + method_to_call = getattr(rule_obj, call.function_to_call) + if len(inspect.getargspec(method_to_call)) == 5: + 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 From 6ca1e05c966ef1f25e747c6a7e1da4b915286b18 Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Tue, 14 Jan 2014 16:27:23 +0100 Subject: [PATCH 08/25] rename _get_callable in _get_rules. Correct the args len. --- account_statement_base_completion/statement.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index b54803e1..cd5174c3 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -74,7 +74,7 @@ class AccountStatementProfil(orm.Model): rel='as_rul_st_prof_rel'), } - def _get_callable(self, cr, uid, profile, context=None): + def _get_rules(self, cr, uid, profile, context=None): if isinstance(profile, (int, long)): prof = self.browse(cr, uid, profile, context=context) else: @@ -99,12 +99,12 @@ class AccountStatementProfil(orm.Model): if context is None: context = {} if not calls: - calls = self._get_callable(cr, uid, line['profile_id'], context=context) + 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)) == 5: + 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) @@ -573,7 +573,7 @@ class AccountBankSatement(orm.Model): ctx = context.copy() ctx['line_ids'] = tuple((x.id for x in stat.line_ids)) b_profile = stat.profile_id - rules = profile_obj._get_callable(cr, uid, b_profile, context=context) + 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 From e6bb1337c5734ccdb339a4a0f22c7487ca1b198d Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Tue, 14 Jan 2014 16:50:19 +0100 Subject: [PATCH 09/25] add new method to the parser that can be used to provide statement info found in the parsed file --- account_statement_base_import/parser/parser.py | 8 ++++++++ account_statement_base_import/statement.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 377548b2..ad9f6c99 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -110,6 +110,14 @@ class BankStatementImportParser(object): """ 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 {} + 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 diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 51fbb08c..8da3c7b3 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -131,7 +131,9 @@ class AccountStatementProfil(Model): Hook to build the values of the statement from the parser and the profile. """ - return {'profile_id': profile_id} + 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): """ From 220eef50ec7c8b51eca6139d4970a82dad27c159 Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Tue, 14 Jan 2014 19:16:23 +0100 Subject: [PATCH 10/25] Add new completion rules to set a specific account in function of regex on name --- .../__init__.py | 21 +++++ .../__openerp__.py | 56 +++++++++++ .../data.xml | 12 +++ .../statement.py | 75 +++++++++++++++ .../statement_view.xml | 21 +++++ .../tests/__init__.py | 36 ++++++++ .../tests/test_regex_account_completion.py | 92 +++++++++++++++++++ 7 files changed, 313 insertions(+) create mode 100644 account_statement_regex_account_completion/__init__.py create mode 100644 account_statement_regex_account_completion/__openerp__.py create mode 100644 account_statement_regex_account_completion/data.xml create mode 100644 account_statement_regex_account_completion/statement.py create mode 100644 account_statement_regex_account_completion/statement_view.xml create mode 100644 account_statement_regex_account_completion/tests/__init__.py create mode 100644 account_statement_regex_account_completion/tests/test_regex_account_completion.py diff --git a/account_statement_regex_account_completion/__init__.py b/account_statement_regex_account_completion/__init__.py new file mode 100644 index 00000000..133223b9 --- /dev/null +++ b/account_statement_regex_account_completion/__init__.py @@ -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 . +# +# +import statement diff --git a/account_statement_regex_account_completion/__openerp__.py b/account_statement_regex_account_completion/__openerp__.py new file mode 100644 index 00000000..b8f937c9 --- /dev/null +++ b/account_statement_regex_account_completion/__openerp__.py @@ -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 . +# +############################################################################## + +{ + "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: diff --git a/account_statement_regex_account_completion/data.xml b/account_statement_regex_account_completion/data.xml new file mode 100644 index 00000000..a6a84429 --- /dev/null +++ b/account_statement_regex_account_completion/data.xml @@ -0,0 +1,12 @@ + + + + + + Match from bank account number (Nomal or IBAN)) + 10 + get_from_bank_account + + + + diff --git a/account_statement_regex_account_completion/statement.py b/account_statement_regex_account_completion/statement.py new file mode 100644 index 00000000..72213e30 --- /dev/null +++ b/account_statement_regex_account_completion/statement.py @@ -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 . +# +############################################################################## + + +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')) + return res + + _columns = { + 'function_to_call': fields.selection(_get_functions, 'Method'), + 'regexp': 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 regexp, 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.regexp, name): + res['account_id'] = rule.account_id.id + return res + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_statement_regex_account_completion/statement_view.xml b/account_statement_regex_account_completion/statement_view.xml new file mode 100644 index 00000000..2dd4e204 --- /dev/null +++ b/account_statement_regex_account_completion/statement_view.xml @@ -0,0 +1,21 @@ + + + + + + account.statement.completion.rule.view (account_statement_regex_account_completion) + account.statement.completion.rule + + form + + + + + + + + + + + + diff --git a/account_statement_regex_account_completion/tests/__init__.py b/account_statement_regex_account_completion/tests/__init__.py new file mode 100644 index 00000000..826f535a --- /dev/null +++ b/account_statement_regex_account_completion/tests/__init__.py @@ -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 . +# +############################################################################## + +from . import test_regex_account_completion + +checks = [ + test_regex_account_completion +] + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_statement_regex_account_completion/tests/test_regex_account_completion.py b/account_statement_regex_account_completion/tests/test_regex_account_completion.py new file mode 100644 index 00000000..7fa62081 --- /dev/null +++ b/account_statement_regex_account_completion/tests/test_regex_account_completion.py @@ -0,0 +1,92 @@ +# -*- 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 . +# +############################################################################## + +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} + self.completion_rule_id = self.registry("account.statement.completion.rule").create(self.cr, self.uid, rule_vals) + + # Create the profile + self.journal_id = self.ref("account.bank_journal") + self.profile_id = self.registry("account.statement.profile").create(self.cr, self.uid, { + "name": "TEST", + "commission_account_id": self.ref("account.a_recv"), + "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 + }) + + # 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_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") From ac777e58fedb1d49717a75c9544ba8a4fb0dde7a Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Wed, 15 Jan 2014 10:28:54 +0100 Subject: [PATCH 11/25] Remove unused data file. Add view in __openerp__.py. --- .../__init__.py | 19 +++++++++++++++---- .../__openerp__.py | 2 +- .../data.xml | 12 ------------ 3 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 account_statement_regex_account_completion/data.xml diff --git a/account_statement_regex_account_completion/__init__.py b/account_statement_regex_account_completion/__init__.py index 133223b9..41101e40 100644 --- a/account_statement_regex_account_completion/__init__.py +++ b/account_statement_regex_account_completion/__init__.py @@ -1,8 +1,16 @@ # -*- coding: utf-8 -*- +############################################################################## # +# Authors: Laetitia Gangloff +# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu) +# All Rights Reserved # -# Author: Laurent Mignon -# Copyright 2013 'ACSONE SA/NV' +# 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 @@ -17,5 +25,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -# -import statement +############################################################################## + +from . import statement + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_statement_regex_account_completion/__openerp__.py b/account_statement_regex_account_completion/__openerp__.py index b8f937c9..9acb1940 100644 --- a/account_statement_regex_account_completion/__openerp__.py +++ b/account_statement_regex_account_completion/__openerp__.py @@ -43,7 +43,7 @@ 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', + "data": ['statement_view.xml', ], "demo": [], "test": [], diff --git a/account_statement_regex_account_completion/data.xml b/account_statement_regex_account_completion/data.xml deleted file mode 100644 index a6a84429..00000000 --- a/account_statement_regex_account_completion/data.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Match from bank account number (Nomal or IBAN)) - 10 - get_from_bank_account - - - - From cd86039a596c3e57b14a8df92a65b3e9f63a1720 Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Wed, 15 Jan 2014 13:30:10 +0100 Subject: [PATCH 12/25] rename some regexp to regex --- account_statement_regex_account_completion/statement.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_statement_regex_account_completion/statement.py b/account_statement_regex_account_completion/statement.py index 72213e30..179a0c62 100644 --- a/account_statement_regex_account_completion/statement.py +++ b/account_statement_regex_account_completion/statement.py @@ -48,13 +48,13 @@ class AccountStatementCompletionRule(Model): _columns = { 'function_to_call': fields.selection(_get_functions, 'Method'), - 'regexp': fields.char('Regular Expression', size=128), + '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 regexp, update account_id + 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: @@ -68,7 +68,7 @@ class AccountStatementCompletionRule(Model): res = {} if name: rule = self.browse(cr, uid, id, context=context) - if re.match(rule.regexp, name): + if re.match(rule.regex, name): res['account_id'] = rule.account_id.id return res From a29bc87b97fe30775797cbaf1f96b8999d4d91ae Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Wed, 15 Jan 2014 13:54:22 +0100 Subject: [PATCH 13/25] correct test --- .../tests/test_regex_account_completion.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/account_statement_regex_account_completion/tests/test_regex_account_completion.py b/account_statement_regex_account_completion/tests/test_regex_account_completion.py index 7fa62081..64958844 100644 --- a/account_statement_regex_account_completion/tests/test_regex_account_completion.py +++ b/account_statement_regex_account_completion/tests/test_regex_account_completion.py @@ -43,23 +43,23 @@ class test_regex_account_completion(common.TransactionCase): rule_vals = {'function_to_call': 'set_account', 'regex': '^My statement', 'account_id': self.account_id} - self.completion_rule_id = self.registry("account.statement.completion.rule").create(self.cr, self.uid, rule_vals) + completion_rule_id = self.registry("account.statement.completion.rule").create(self.cr, self.uid, rule_vals) # Create the profile - self.journal_id = self.ref("account.bank_journal") - self.profile_id = self.registry("account.statement.profile").create(self.cr, self.uid, { + 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": self.journal_id, - "rule_ids": [(6, 0, [self.completion_rule_id])]}) + "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": self.journal_id, - "profile_id": self.profile_id + "journal_id": journal_id, + "profile_id": profile_id }) # Create two bank statement lines @@ -83,10 +83,9 @@ class test_regex_account_completion(common.TransactionCase): """Test the automatic completion on account """ 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") + 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") From b962fc2669b7773c993634b8dbb87b58ce074f5d Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Mon, 20 Jan 2014 10:06:39 +0100 Subject: [PATCH 14/25] update name of the funtion to 'Set account for line labels matching a regular expression' instead of 'Set account' --- account_statement_regex_account_completion/statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_regex_account_completion/statement.py b/account_statement_regex_account_completion/statement.py index 179a0c62..e54f136e 100644 --- a/account_statement_regex_account_completion/statement.py +++ b/account_statement_regex_account_completion/statement.py @@ -43,7 +43,7 @@ class AccountStatementCompletionRule(Model): res = super(AccountStatementCompletionRule, self)._get_functions( cr, uid, context=context) res.append(('set_account', - 'Set account')) + 'Set account for line labels matching a regular expression')) return res _columns = { From 1e0c40e3a1117de0ab1aa2b2d864ee0eb5a52549 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Tue, 21 Jan 2014 17:50:31 +0100 Subject: [PATCH 15/25] pep8 --- account_statement_commission/commission.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/account_statement_commission/commission.py b/account_statement_commission/commission.py index 09f1fddc..b98227b8 100644 --- a/account_statement_commission/commission.py +++ b/account_statement_commission/commission.py @@ -2,9 +2,11 @@ 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" @@ -36,6 +38,7 @@ class AccountStatementProfil(orm.Model): 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 = { @@ -45,6 +48,7 @@ class AccountStatementLineWithCommission(orm.Model): serialization_field='additionnal_bank_fields'), } + class CreditPartnerStatementImporter(orm.TransientModel): _inherit = "credit.statement.import" From 9c570e8c257014970d9595e9e0e0de5e085156d8 Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Wed, 22 Jan 2014 12:17:19 +0100 Subject: [PATCH 16/25] add translation for account_statement_regex_account_completion module --- ...unt_statement_regex_account_completion.pot | 32 +++++++++++++++++++ .../i18n/fr.po | 32 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot create mode 100644 account_statement_regex_account_completion/i18n/fr.po diff --git a/account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot b/account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot new file mode 100644 index 00000000..42587093 --- /dev/null +++ b/account_statement_regex_account_completion/i18n/account_statement_regex_account_completion.pot @@ -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 "" + diff --git a/account_statement_regex_account_completion/i18n/fr.po b/account_statement_regex_account_completion/i18n/fr.po new file mode 100644 index 00000000..5a06dfa3 --- /dev/null +++ b/account_statement_regex_account_completion/i18n/fr.po @@ -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 "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" + \ No newline at end of file From 05d2948ca561eda395cb3cf56641f5a745df99f6 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of banking-addons-team Date: Fri, 24 Jan 2014 06:27:43 +0000 Subject: [PATCH 17/25] Launchpad automatic translations update. --- account_statement_regex_account_completion/i18n/fr.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/account_statement_regex_account_completion/i18n/fr.po b/account_statement_regex_account_completion/i18n/fr.po index 5a06dfa3..303b085b 100644 --- a/account_statement_regex_account_completion/i18n/fr.po +++ b/account_statement_regex_account_completion/i18n/fr.po @@ -7,13 +7,14 @@ 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" +"PO-Revision-Date: 2014-01-23 17:42+0000\n" +"Last-Translator: Laetitia Gangloff (Acsone) \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-01-24 06:27+0000\n" +"X-Generator: Launchpad (build 16914)\n" #. module: account_statement_regex_account_completion #: field:account.statement.completion.rule,regex:0 @@ -29,4 +30,3 @@ msgstr "Compte à utiliser" #: model:ir.model,name:account_statement_regex_account_completion.model_account_statement_completion_rule msgid "account.statement.completion.rule" msgstr "account.statement.completion.rule" - \ No newline at end of file From de19604dc0926ec4ab516b411950ac4a884c9ffa Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 30 Jan 2014 13:48:51 +0100 Subject: [PATCH 18/25] [fix] on the first/last day on the year, avoid choosing the opening/closing period. --- account_statement_ext/statement.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 80edbfcc..4c249a37 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -213,7 +213,10 @@ class AccountBankSatement(Model): """ Find matching period for date, used in the statement line creation. """ + if context is None: + context = {} period_obj = self.pool.get('account.period') + context['account_period_prefer_normal'] = True periods = period_obj.find(cr, uid, dt=date, context=context) return periods and periods[0] or False From 12c51fa3c47bf2d001ce907ea61571bfdc437ea8 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 30 Jan 2014 14:01:20 +0100 Subject: [PATCH 19/25] [fix] copy the context before modifying it: safer upstream --- account_statement_ext/statement.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 4c249a37..e2c7cddd 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -216,8 +216,9 @@ class AccountBankSatement(Model): if context is None: context = {} period_obj = self.pool.get('account.period') - context['account_period_prefer_normal'] = True - periods = period_obj.find(cr, uid, dt=date, context=context) + 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): From 0eb7bf7825c63bf6d038d72a3c11463db21ca820 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 30 Jan 2014 14:06:24 +0100 Subject: [PATCH 20/25] [imp] docstring --- account_statement_ext/statement.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index e2c7cddd..a41038ea 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -210,9 +210,7 @@ class AccountBankSatement(Model): return super(AccountBankSatement, self).create(cr, uid, vals, context=context) def _get_period(self, cr, uid, date, context=None): - """ - Find matching period for date, used in the statement line creation. - """ + """Return matching period for a date.""" if context is None: context = {} period_obj = self.pool.get('account.period') @@ -575,9 +573,7 @@ class AccountBankSatementLine(Model): _inherit = "account.bank.statement.line" def _get_period(self, cr, uid, context=None): - """ - Return a period from a given date in the context. - """ + """Return matching period for a date.""" if context is None: context = {} date = context.get('date') From 5c728ccd481c087186c5fe5470175d926b8692d7 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 30 Jan 2014 14:11:58 +0100 Subject: [PATCH 21/25] [fix] similarly fix another _get_period --- account_statement_ext/statement.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index a41038ea..3a5a95cf 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -576,9 +576,12 @@ class AccountBankSatementLine(Model): """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 = self.pool.get('account.period').find(cr, uid, dt=date) + 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 From a08c8340a844abbb365f58cb14e3a33d48d89300 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 3 Feb 2014 10:25:07 +0100 Subject: [PATCH 22/25] [FIX]Deprecated stuff --- account_statement_no_invoice_import/__openerp__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/account_statement_no_invoice_import/__openerp__.py b/account_statement_no_invoice_import/__openerp__.py index d2c8be37..645d897e 100644 --- a/account_statement_no_invoice_import/__openerp__.py +++ b/account_statement_no_invoice_import/__openerp__.py @@ -31,11 +31,10 @@ 'depends': [ 'account', ], - 'init_xml': [], - 'update_xml': [ + 'data': [ 'statement_view.xml', ], - 'demo_xml': [], + 'demo': [], 'installable': True, 'active': False, } From 4069e4c9251eb038978ded493c07e81ee0261c5b Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 3 Feb 2014 10:27:42 +0100 Subject: [PATCH 23/25] [FIX] Change description --- account_statement_no_invoice_import/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_no_invoice_import/__openerp__.py b/account_statement_no_invoice_import/__openerp__.py index 645d897e..29d30489 100644 --- a/account_statement_no_invoice_import/__openerp__.py +++ b/account_statement_no_invoice_import/__openerp__.py @@ -25,7 +25,7 @@ 'version': '0.1', 'category': 'Generic Modules/Others', 'license': 'AGPL-3', - 'description': """Module that remove the import button on bank statement""", + 'description': """Module that remove the 'Import invoices' button on bank statement""", 'author': 'Akretion', 'website': 'http://www.akretion.com/', 'depends': [ From 96012530c03643f3ff26fbd441cf6e6cbbcda2f5 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 7 Feb 2014 15:56:14 +0100 Subject: [PATCH 24/25] [FIX] Only remove the invoice import button instead of the whole div --- account_statement_no_invoice_import/__openerp__.py | 2 +- account_statement_no_invoice_import/statement_view.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/account_statement_no_invoice_import/__openerp__.py b/account_statement_no_invoice_import/__openerp__.py index 29d30489..abc1a218 100644 --- a/account_statement_no_invoice_import/__openerp__.py +++ b/account_statement_no_invoice_import/__openerp__.py @@ -29,7 +29,7 @@ 'author': 'Akretion', 'website': 'http://www.akretion.com/', 'depends': [ - 'account', + 'account_voucher', ], 'data': [ 'statement_view.xml', diff --git a/account_statement_no_invoice_import/statement_view.xml b/account_statement_no_invoice_import/statement_view.xml index 663de0d2..67920f41 100644 --- a/account_statement_no_invoice_import/statement_view.xml +++ b/account_statement_no_invoice_import/statement_view.xml @@ -8,12 +8,12 @@ account_bank_statement_simple_view.account_bank_statement.view_form account.bank.statement - + form -
-
+
From 46a09cda0ba5e11a1c862f71b620f212b4fb6a62 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of banking-addons-team Date: Mon, 10 Feb 2014 05:56:29 +0000 Subject: [PATCH 25/25] Launchpad automatic translations update. --- account_statement_regex_account_completion/i18n/fr.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_statement_regex_account_completion/i18n/fr.po b/account_statement_regex_account_completion/i18n/fr.po index 303b085b..4d414f52 100644 --- a/account_statement_regex_account_completion/i18n/fr.po +++ b/account_statement_regex_account_completion/i18n/fr.po @@ -13,8 +13,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-24 06:27+0000\n" -"X-Generator: Launchpad (build 16914)\n" +"X-Launchpad-Export-Date: 2014-02-10 05:56+0000\n" +"X-Generator: Launchpad (build 16916)\n" #. module: account_statement_regex_account_completion #: field:account.statement.completion.rule,regex:0