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 001/114] [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 5e0f9f6b6a4d358c1474422ec423d0949964cb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Beau?= Date: Thu, 11 Jul 2013 02:45:16 +0200 Subject: [PATCH 002/114] [ADD] add module account_statement_one_move --- account_statement_one_move/__init__.py | 24 ++ account_statement_one_move/__openerp__.py | 39 +++ account_statement_one_move/statement.py | 234 ++++++++++++++++++ account_statement_one_move/statement_view.xml | 27 ++ 4 files changed, 324 insertions(+) create mode 100644 account_statement_one_move/__init__.py create mode 100644 account_statement_one_move/__openerp__.py create mode 100644 account_statement_one_move/statement.py create mode 100644 account_statement_one_move/statement_view.xml diff --git a/account_statement_one_move/__init__.py b/account_statement_one_move/__init__.py new file mode 100644 index 00000000..bf2e6751 --- /dev/null +++ b/account_statement_one_move/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# account_statement_one_move 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 . +# +############################################################################### + +import statement + diff --git a/account_statement_one_move/__openerp__.py b/account_statement_one_move/__openerp__.py new file mode 100644 index 00000000..19a8b1f5 --- /dev/null +++ b/account_statement_one_move/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# account_statement_one_move 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_statement_one_move', + 'version': '0.1', + 'category': 'Generic Modules/Others', + 'license': 'AGPL-3', + 'description': """empty""", + 'author': 'Akretion', + 'website': 'http://www.akretion.com/', + 'depends': ['account_statement_ext'], + 'init_xml': [], + 'update_xml': [ + 'statement_view.xml' + ], + 'demo_xml': [], + 'installable': True, + 'active': False, +} diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py new file mode 100644 index 00000000..a36a790b --- /dev/null +++ b/account_statement_one_move/statement.py @@ -0,0 +1,234 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# account_statement_one_move 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 . +# +############################################################################### + +from openerp.osv import fields, orm, osv + + + +class AccountStatementProfil(orm.Model): + _inherit = "account.statement.profile" + _columns = { + 'one_move': fields.boolean('One Move', + help="Tic that box if you want OpenERP to generated only" + "one move when the bank statement is validated") + } + + +class account_bank_statement(orm.Model): + _inherit = "account.bank.statement" + + ##################### START UGLY COPY/PASTE + #REALLY SORRY for the ugly code but the module bank statement should be re-written + #It is impossible to overwrite it correctly + def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): + """ + Override a large portion of the code to compute the periode for each line instead of + taking the period of the whole statement. + Remove the entry posting on generated account moves. + We change the move line generated from the lines depending on the profile: + - If receivable_account_id is set, we'll use it instead of the "partner" one + - If partner_id is set, we'll us it for the commission (when imported throufh the wizard) + - 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 int/long: st_line_id: account.bank.statement.line ID + :param int/long: company_currency_id: res.currency ID + :param char: st_line_number: that will be used as the name of the generated account move + :return: int/long: ID of the created account.move + """ + if context is None: + context = {} + res_currency_obj = self.pool.get('res.currency') + account_move_obj = self.pool.get('account.move') + account_move_line_obj = self.pool.get('account.move.line') + account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') # Chg + st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) # Chg + st = st_line.statement_id + + context.update({'date': st_line.date}) + ctx = context.copy() # Chg + ctx['company_id'] = st_line.company_id.id # Chg + period_id = self._get_period( # Chg + cr, uid, st_line.date, context=ctx) + + if context.get('move_id'): #Chg2 + move_id = context['move_id'] #Chg2 + else: #Chg2 + move_id = account_move_obj.create(cr, uid, { + 'journal_id': st.journal_id.id, + 'period_id': period_id, # Chg + 'date': st_line.date, + 'name': st_line_number, + 'ref': st_line.ref, + }, context=context) + account_bank_statement_line_obj.write(cr, uid, [st_line.id], { # Chg + 'move_ids': [(4, move_id, False)] + }) + + torec = [] + if st_line.amount >= 0: + account_id = st.journal_id.default_credit_account_id.id + else: + account_id = st.journal_id.default_debit_account_id.id + + 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) + + val = { + 'name': st_line.name, + 'date': st_line.date, + 'ref': st_line.ref, + 'move_id': move_id, + 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False, + 'account_id': (st_line.account_id) and st_line.account_id.id, + 'credit': ((amount>0) and amount) or 0.0, + 'debit': ((amount<0) and -amount) or 0.0, + # Replace with the treasury one instead of bank #Chg + 'statement_id': st.id, + 'journal_id': st.journal_id.id, + 'period_id': period_id, #Chg + 'currency_id': st.currency.id, + 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False + } + + if st.currency.id <> company_currency_id: + amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, + st.currency.id, amount, context=context) + val['amount_currency'] = -amount_cur + + if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: + val['currency_id'] = st_line.account_id.currency_id.id + amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, + st_line.account_id.currency_id.id, amount, context=context) + val['amount_currency'] = -amount_cur + + move_line_id = account_move_line_obj.create(cr, uid, val, context=context) + torec.append(move_line_id) + + if context['move_id']: #Chg2 + return move_id #Chg2 + + # Fill the secondary amount/currency + # if currency is not the same than the company + amount_currency = False + currency_id = False + if st.currency.id <> company_currency_id: + amount_currency = st_line.amount + currency_id = st.currency.id + # GET THE RIGHT PARTNER ACCORDING TO THE CHOSEN PROFIL # Chg + if st.profile_id.force_partner_on_bank: # Chg + bank_parrtner_id = st.profile_id.partner_id.id # Chg + else: # Chg + bank_parrtner_id = ((st_line.partner_id) and st_line.partner_id.id) or False # Chg + + account_move_line_obj.create(cr, uid, { + 'name': st_line.name, + 'date': st_line.date, + 'ref': st_line.ref, + 'move_id': move_id, + 'partner_id': bank_parrtner_id, # Chg + 'account_id': account_id, + 'credit': ((amount < 0) and -amount) or 0.0, + 'debit': ((amount > 0) and amount) or 0.0, + # Replace with the treasury one instead of bank #Chg + 'statement_id': st.id, + 'journal_id': st.journal_id.id, + 'period_id': period_id, #Chg + 'amount_currency': amount_currency, + 'currency_id': currency_id, + }, context=context) + + for line in account_move_line_obj.browse(cr, uid, [x.id for x in + account_move_obj.browse(cr, uid, move_id, + context=context).line_id], + context=context): + if line.state <> 'valid': + raise osv.except_osv(_('Error !'), + _('Journal item "%s" is not valid.') % line.name) + + # Bank statements will not consider boolean on journal entry_posted + account_move_obj.post(cr, uid, [move_id], context=context) + return move_id + + + + ####################### END OF UGLY COPY/PASTE + + def _prepare_move(self, cr, uid, st, context=None): + period_id = st.period_id or self._get_period( + cr, uid, st.date, context=context) + return { + 'journal_id': st.journal_id.id, + 'period_id': period_id, + 'date': st.date, + 'name': st.name, + 'ref': st.name, + } + + def _create_move(self, cr, uid, st, context=None): + move_obj = self.pool.get('account.move') + move_vals = self._prepare_move(cr, uid, st, context=context) + return move_obj.create(cr, uid, 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 button_confirm_bank(self, cr, uid, ids, context=None): + st_line_obj = self.pool.get('account.bank.statement.line') + if context is None: + context = {} + for st in self.browse(cr, uid, ids, context=context): + if st.profile_id.one_move: + move_id = self._create_move(cr, uid, st, context=context) + context['move_id'] = move_id + super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context) + if st.profile_id.one_move: + 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: + 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 + + diff --git a/account_statement_one_move/statement_view.xml b/account_statement_one_move/statement_view.xml new file mode 100644 index 00000000..3fb1d23d --- /dev/null +++ b/account_statement_one_move/statement_view.xml @@ -0,0 +1,27 @@ + + + + + + + + + + account_statement_one_move.account_statement.view_form + account.statement.profile + + + form + + + + + + + + + From d9aaf1656f3405a9f63aa06c652bb72ba9e4d1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Beau?= Date: Tue, 23 Jul 2013 00:49:38 +0200 Subject: [PATCH 003/114] [FIX] fix intentation error, and fill the move_line name with the line reference of the bank statement --- account_statement_one_move/statement.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index a36a790b..5d7613fb 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -116,6 +116,11 @@ class account_bank_statement(orm.Model): 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False } + #We use the reference as name as in case of one move #Chg2 + #as field ref is a related we had the same value for all move #Chg2 + if context.get('move_id'): #Chg2 + val['name'] = st_line.ref #Chg2 + if st.currency.id <> company_currency_id: amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, st.currency.id, amount, context=context) @@ -130,7 +135,7 @@ class account_bank_statement(orm.Model): move_line_id = account_move_line_obj.create(cr, uid, val, context=context) torec.append(move_line_id) - if context['move_id']: #Chg2 + if context.get('move_id'): #Chg2 return move_id #Chg2 # Fill the secondary amount/currency @@ -229,6 +234,6 @@ class account_bank_statement(orm.Model): st.write({'state':'draft'}, context=context) else: super(account_bank_statement, self).button_cancel(cr, uid, ids, context=context) - return True + return True From 1de11e7e120b6a0c965850a2963eb38b687e027a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Oct 2013 10:22:48 +0100 Subject: [PATCH 004/114] [FIX] account_statement: crash when creating a new bank statement without any lines --- account_statement_ext/statement.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index f8762054..03e1c31c 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -31,9 +31,10 @@ def fixed_write(self, cr, uid, ids, vals, context=None): I will do it when I have time.""" res = super(stat_mod.account_bank_statement, self).write(cr, uid, ids, vals, context=context) - cr.execute("UPDATE account_bank_statement_line" - " SET sequence = account_bank_statement_line.id + 1" - " where statement_id in %s", (tuple(ids),)) + 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 From 572f28a20196d668d000e65cfb5ccf284bc755c0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Oct 2013 10:23:29 +0100 Subject: [PATCH 005/114] [ADD] new module makine Point Of Sale compatible with bank profiles --- .../__init__.py | 22 +++++ .../__openerp__.py | 43 +++++++++ .../point_of_sale.py | 95 +++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 account_statement_ext_point_of_sale/__init__.py create mode 100644 account_statement_ext_point_of_sale/__openerp__.py create mode 100644 account_statement_ext_point_of_sale/point_of_sale.py diff --git a/account_statement_ext_point_of_sale/__init__.py b/account_statement_ext_point_of_sale/__init__.py new file mode 100644 index 00000000..2f5d1c8e --- /dev/null +++ b/account_statement_ext_point_of_sale/__init__.py @@ -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 . +# +############################################################################## + +import point_of_sale diff --git a/account_statement_ext_point_of_sale/__openerp__.py b/account_statement_ext_point_of_sale/__openerp__.py new file mode 100644 index 00000000..9e06022c --- /dev/null +++ b/account_statement_ext_point_of_sale/__openerp__.py @@ -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 . +# +############################################################################## + +{'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, + } diff --git a/account_statement_ext_point_of_sale/point_of_sale.py b/account_statement_ext_point_of_sale/point_of_sale.py new file mode 100644 index 00000000..a765a596 --- /dev/null +++ b/account_statement_ext_point_of_sale/point_of_sale.py @@ -0,0 +1,95 @@ +# -*- 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 . +# +############################################################################## +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 + 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 = [] + print pos_config.journal_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): + bank_values = super(pos_session, self)._prepare_bank_statement(cr, uid, pos_config, journal, context) + defaults = self.pool['account.bank.statement'].default_get(cr, uid, ['profile_id', 'period_id'], context=context) + bank_values.update(defaults) + return bank_values From 5daaab672332480a1f3dcc827565ab539d627c96 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Sun, 3 Nov 2013 15:37:31 +0100 Subject: [PATCH 006/114] [IMP] port module account_statement_one_move on V7 --- account_statement_one_move/statement.py | 192 +++++------------------- 1 file changed, 40 insertions(+), 152 deletions(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index 5d7613fb..e27c2f20 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -36,171 +36,61 @@ class AccountStatementProfil(orm.Model): class account_bank_statement(orm.Model): _inherit = "account.bank.statement" - ##################### START UGLY COPY/PASTE - #REALLY SORRY for the ugly code but the module bank statement should be re-written - #It is impossible to overwrite it correctly - def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): - """ - Override a large portion of the code to compute the periode for each line instead of - taking the period of the whole statement. - Remove the entry posting on generated account moves. - We change the move line generated from the lines depending on the profile: - - If receivable_account_id is set, we'll use it instead of the "partner" one - - If partner_id is set, we'll us it for the commission (when imported throufh the wizard) - - 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 int/long: st_line_id: account.bank.statement.line ID - :param int/long: company_currency_id: res.currency ID - :param char: st_line_number: that will be used as the name of the generated account move - :return: int/long: ID of the created account.move + 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) + if st_line.statement_id.profile_id.one_move: + res.update({ + 'date': st_line.statement_id.date, + 'name': st_line.ref, + }) + return res + + def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context): + 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): + """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_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') - account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') # Chg - st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) # Chg + 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}) - ctx = context.copy() # Chg - ctx['company_id'] = st_line.company_id.id # Chg - period_id = self._get_period( # Chg - cr, uid, st_line.date, context=ctx) - - if context.get('move_id'): #Chg2 - move_id = context['move_id'] #Chg2 - else: #Chg2 - move_id = account_move_obj.create(cr, uid, { - 'journal_id': st.journal_id.id, - 'period_id': period_id, # Chg - 'date': st_line.date, - 'name': st_line_number, - 'ref': st_line.ref, - }, context=context) - account_bank_statement_line_obj.write(cr, uid, [st_line.id], { # Chg - 'move_ids': [(4, move_id, False)] - }) - - torec = [] - if st_line.amount >= 0: - account_id = st.journal_id.default_credit_account_id.id - else: - account_id = st.journal_id.default_debit_account_id.id - 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) - val = { - 'name': st_line.name, - 'date': st_line.date, - 'ref': st_line.ref, - 'move_id': move_id, - 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False, - 'account_id': (st_line.account_id) and st_line.account_id.id, - 'credit': ((amount>0) and amount) or 0.0, - 'debit': ((amount<0) and -amount) or 0.0, - # Replace with the treasury one instead of bank #Chg - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': period_id, #Chg - 'currency_id': st.currency.id, - 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False - } + 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) - #We use the reference as name as in case of one move #Chg2 - #as field ref is a related we had the same value for all move #Chg2 - if context.get('move_id'): #Chg2 - val['name'] = st_line.ref #Chg2 - - if st.currency.id <> company_currency_id: - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st.currency.id, amount, context=context) - val['amount_currency'] = -amount_cur - - if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: - val['currency_id'] = st_line.account_id.currency_id.id - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st_line.account_id.currency_id.id, amount, context=context) - val['amount_currency'] = -amount_cur - - move_line_id = account_move_line_obj.create(cr, uid, val, context=context) - torec.append(move_line_id) - - if context.get('move_id'): #Chg2 - return move_id #Chg2 - - # Fill the secondary amount/currency - # if currency is not the same than the company - amount_currency = False - currency_id = False - if st.currency.id <> company_currency_id: - amount_currency = st_line.amount - currency_id = st.currency.id - # GET THE RIGHT PARTNER ACCORDING TO THE CHOSEN PROFIL # Chg - if st.profile_id.force_partner_on_bank: # Chg - bank_parrtner_id = st.profile_id.partner_id.id # Chg - else: # Chg - bank_parrtner_id = ((st_line.partner_id) and st_line.partner_id.id) or False # Chg - - account_move_line_obj.create(cr, uid, { - 'name': st_line.name, - 'date': st_line.date, - 'ref': st_line.ref, - 'move_id': move_id, - 'partner_id': bank_parrtner_id, # Chg - 'account_id': account_id, - 'credit': ((amount < 0) and -amount) or 0.0, - 'debit': ((amount > 0) and amount) or 0.0, - # Replace with the treasury one instead of bank #Chg - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': period_id, #Chg - 'amount_currency': amount_currency, - 'currency_id': currency_id, - }, context=context) - - for line in account_move_line_obj.browse(cr, uid, [x.id for x in - account_move_obj.browse(cr, uid, move_id, - context=context).line_id], - context=context): - if line.state <> 'valid': - raise osv.except_osv(_('Error !'), - _('Journal item "%s" is not valid.') % line.name) - - # Bank statements will not consider boolean on journal entry_posted - account_move_obj.post(cr, uid, [move_id], context=context) - return move_id - - - - ####################### END OF UGLY COPY/PASTE - - def _prepare_move(self, cr, uid, st, context=None): - period_id = st.period_id or self._get_period( - cr, uid, st.date, context=context) - return { - 'journal_id': st.journal_id.id, - 'period_id': period_id, - 'date': st.date, - 'name': st.name, - 'ref': st.name, - } - - def _create_move(self, cr, uid, st, context=None): - move_obj = self.pool.get('account.move') - move_vals = self._prepare_move(cr, uid, st, context=context) - return move_obj.create(cr, uid, move_vals, context=context) - - def _valid_move(self, cr, uid, move_id, context=None): + 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) @@ -211,11 +101,9 @@ class account_bank_statement(orm.Model): if context is None: context = {} for st in self.browse(cr, uid, ids, context=context): - if st.profile_id.one_move: - move_id = self._create_move(cr, uid, st, context=context) - context['move_id'] = move_id super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context) if st.profile_id.one_move: + move_id = context['move_id'] 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, From b9da2ba3e1f06d36bf54834bc166497555450a94 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 4 Nov 2013 13:22:39 +0100 Subject: [PATCH 007/114] [ADD] account_statement_ofx_import: Allows to import OFX (Open Financial Exchange) statement files, using 'account_statement_base_import' generic inheritance mechanism to import statements. --- account_statement_ofx_import/__init__.py | 22 ++++ account_statement_ofx_import/__openerp__.py | 49 ++++++++ .../parser/__init__.py | 22 ++++ .../parser/ofx_parser.py | 118 ++++++++++++++++++ account_statement_ofx_import/statement.py | 46 +++++++ 5 files changed, 257 insertions(+) create mode 100644 account_statement_ofx_import/__init__.py create mode 100644 account_statement_ofx_import/__openerp__.py create mode 100644 account_statement_ofx_import/parser/__init__.py create mode 100644 account_statement_ofx_import/parser/ofx_parser.py create mode 100644 account_statement_ofx_import/statement.py diff --git a/account_statement_ofx_import/__init__.py b/account_statement_ofx_import/__init__.py new file mode 100644 index 00000000..19462c05 --- /dev/null +++ b/account_statement_ofx_import/__init__.py @@ -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 . +# +############################################################################## +import statement +import parser diff --git a/account_statement_ofx_import/__openerp__.py b/account_statement_ofx_import/__openerp__.py new file mode 100644 index 00000000..ae06cfbf --- /dev/null +++ b/account_statement_ofx_import/__openerp__.py @@ -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 . +# +############################################################################## + +{'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', +} diff --git a/account_statement_ofx_import/parser/__init__.py b/account_statement_ofx_import/parser/__init__.py new file mode 100644 index 00000000..682e6db7 --- /dev/null +++ b/account_statement_ofx_import/parser/__init__.py @@ -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 . +# +############################################################################## +from . import ofx_parser + diff --git a/account_statement_ofx_import/parser/ofx_parser.py b/account_statement_ofx_import/parser/ofx_parser.py new file mode 100644 index 00000000..65961241 --- /dev/null +++ b/account_statement_ofx_import/parser/ofx_parser.py @@ -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 . +# +############################################################################## +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', ''), + } + diff --git a/account_statement_ofx_import/statement.py b/account_statement_ofx_import/statement.py new file mode 100644 index 00000000..c5b06fe8 --- /dev/null +++ b/account_statement_ofx_import/statement.py @@ -0,0 +1,46 @@ +# -*- 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 . +# +############################################################################## +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 + + _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."), + + } + From 1542a46695ef2efe4e8038467edd66f57df8462b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Nov 2013 16:57:28 +0100 Subject: [PATCH 008/114] [FIX] select the correct profile when creating the bank statement --- account_statement_ext_point_of_sale/point_of_sale.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/account_statement_ext_point_of_sale/point_of_sale.py b/account_statement_ext_point_of_sale/point_of_sale.py index a765a596..06384dd3 100644 --- a/account_statement_ext_point_of_sale/point_of_sale.py +++ b/account_statement_ext_point_of_sale/point_of_sale.py @@ -68,7 +68,6 @@ if not hasattr(std_pos_session, '_prepare_bank_statement'): pos_config = jobj.browse(cr, uid, config_id, context=context) bank_statement_ids = [] - print pos_config.journal_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) @@ -90,6 +89,12 @@ class pos_session(orm.Model): def _prepare_bank_statement(self, cr, uid, pos_config, journal, context=None): 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 From 1c4a105a5f28f734e9e76c40726aef6ccca209b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Nov 2013 08:04:05 +0100 Subject: [PATCH 009/114] [PEP8] --- account_statement_ext_point_of_sale/__init__.py | 2 +- account_statement_ext_point_of_sale/__openerp__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/account_statement_ext_point_of_sale/__init__.py b/account_statement_ext_point_of_sale/__init__.py index 2f5d1c8e..05435f81 100644 --- a/account_statement_ext_point_of_sale/__init__.py +++ b/account_statement_ext_point_of_sale/__init__.py @@ -19,4 +19,4 @@ # ############################################################################## -import point_of_sale +from . import point_of_sale diff --git a/account_statement_ext_point_of_sale/__openerp__.py b/account_statement_ext_point_of_sale/__openerp__.py index 9e06022c..6d4b7a8f 100644 --- a/account_statement_ext_point_of_sale/__openerp__.py +++ b/account_statement_ext_point_of_sale/__openerp__.py @@ -29,7 +29,7 @@ 'account_statement_ext', ], 'description': """ - Update the point of sale code to work with improved bank statements. + Update the point of sale code to work with improved bank statements. """, 'website': 'http://www.camptocamp.com', 'data': [], From 93e04e145ab9d7f357da51b81bbc6f2c75d33d39 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Nov 2013 08:16:39 +0100 Subject: [PATCH 010/114] [IMP] explain what the monkey patching bit is about --- account_statement_ext_point_of_sale/point_of_sale.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/account_statement_ext_point_of_sale/point_of_sale.py b/account_statement_ext_point_of_sale/point_of_sale.py index 06384dd3..729a53b3 100644 --- a/account_statement_ext_point_of_sale/point_of_sale.py +++ b/account_statement_ext_point_of_sale/point_of_sale.py @@ -24,6 +24,16 @@ 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, From 369de56d845502fd7e742d4e065452e0edee4407 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Nov 2013 08:31:36 +0100 Subject: [PATCH 011/114] [IMP][PEP8] fixed + add a doc string to explicit fact _prepare_statement does not originally exist on base model --- .../point_of_sale.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/account_statement_ext_point_of_sale/point_of_sale.py b/account_statement_ext_point_of_sale/point_of_sale.py index 729a53b3..31e23418 100644 --- a/account_statement_ext_point_of_sale/point_of_sale.py +++ b/account_statement_ext_point_of_sale/point_of_sale.py @@ -98,12 +98,25 @@ class pos_session(orm.Model): _inherit = 'pos.session' def _prepare_bank_statement(self, cr, uid, pos_config, journal, context=None): - bank_values = super(pos_session, self)._prepare_bank_statement(cr, uid, pos_config, journal, context) + """ 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) + 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) From e9840da1249f2e0adcea792fcda0666a50bf766c Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Wed, 6 Nov 2013 16:23:06 +0100 Subject: [PATCH 012/114] [IMP] adapt parser __init__ to new signature --- .../parser/transactionid_file_parser.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/account_statement_transactionid_import/parser/transactionid_file_parser.py b/account_statement_transactionid_import/parser/transactionid_file_parser.py index ecc5d054..c3a4a644 100644 --- a/account_statement_transactionid_import/parser/transactionid_file_parser.py +++ b/account_statement_transactionid_import/parser/transactionid_file_parser.py @@ -27,16 +27,21 @@ class TransactionIDFileParser(FileParser): bank statement. """ - def __init__(self, parse_name, ftype='csv'): - conversion_dict = {'transaction_id': unicode, - 'label': unicode, - 'date': datetime.datetime, - 'amount': float, - 'commission_amount': float} - # Order of cols does not matter but first row of the file has to be header - keys_to_validate = ['transaction_id', 'label', 'date', 'amount', 'commission_amount'] - super(TransactionIDFileParser, self).__init__(parse_name, keys_to_validate=keys_to_validate, - ftype=ftype, conversion_dict=conversion_dict) + 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): From 112a4b5b85a1bad8d9dd9cb2388fa0b18e130df2 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Wed, 6 Nov 2013 16:23:49 +0100 Subject: [PATCH 013/114] [REM] commission computation, this has to be done by account_statement_commission --- .../parser/transactionid_file_parser.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/account_statement_transactionid_import/parser/transactionid_file_parser.py b/account_statement_transactionid_import/parser/transactionid_file_parser.py index c3a4a644..0a54b1e5 100644 --- a/account_statement_transactionid_import/parser/transactionid_file_parser.py +++ b/account_statement_transactionid_import/parser/transactionid_file_parser.py @@ -78,14 +78,3 @@ class TransactionIDFileParser(FileParser): 'label': line.get('label', ''), 'transaction_id': line.get('transaction_id', '/'), 'commission_amount': line.get('commission_amount', 0.0)} - - def _post(self, *args, **kwargs): - """ - Compute the commission from value of each line - """ - res = super(TransactionIDFileParser, self)._post(*args, **kwargs) - val = 0.0 - for row in self.result_row_list: - val += row.get('commission_amount', 0.0) - self.commission_global_amount = val - return res From ed263e083dcb49bdd3f2d6cc707008cb5fe8ce1b Mon Sep 17 00:00:00 2001 From: Vincent Renaville Date: Mon, 11 Nov 2013 13:33:43 +0100 Subject: [PATCH 014/114] [FIX] remove account.reconcile before deleting a account.move --- account_statement_ext/account.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/account.py b/account_statement_ext/account.py index 8dab9449..97f1103f 100644 --- a/account_statement_ext/account.py +++ b/account_statement_ext/account.py @@ -31,8 +31,11 @@ class account_move(Model): 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: - move_line.reconcile_id.unlink(context=context) + 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) From f622212dbec02ddd10cd7f90b345e9b16a740830 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Mon, 18 Nov 2013 12:19:02 +0100 Subject: [PATCH 015/114] [FIX] fix period id on move line --- account_statement_one_move/statement.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index e27c2f20..41706d72 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -38,13 +38,28 @@ class account_bank_statement(orm.Model): 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): account_move_obj = self.pool.get('account.move') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') @@ -68,7 +83,6 @@ class account_bank_statement(orm.Model): :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') @@ -90,7 +104,7 @@ class account_bank_statement(orm.Model): 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): + 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) From dda096de3780a4a2a267e05f09a9acab510899ab Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Thu, 21 Nov 2013 17:07:27 +0100 Subject: [PATCH 016/114] [FIX] account_statement_ext - add encoding on mako template to fix translation extraction --- account_statement_ext/report/bank_statement_report.mako | 1 + 1 file changed, 1 insertion(+) diff --git a/account_statement_ext/report/bank_statement_report.mako b/account_statement_ext/report/bank_statement_report.mako index 7d1875b7..4a21333b 100644 --- a/account_statement_ext/report/bank_statement_report.mako +++ b/account_statement_ext/report/bank_statement_report.mako @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- From 5c0e625e11f3b1c84beb25a1c1bbae037223fbf6 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 3 Dec 2013 16:04:25 +0100 Subject: [PATCH 017/114] [imp] account_statement_base_completion: put what depends on sale on a separate module --- .../__openerp__.py | 1 - account_statement_base_completion/data.xml | 6 -- .../statement.py | 44 --------- account_statement_so_completion/__init__.py | 25 +++++ .../__openerp__.py | 53 ++++++++++ account_statement_so_completion/data.xml | 12 +++ .../partner_view.xml | 22 +++++ account_statement_so_completion/statement.py | 98 +++++++++++++++++++ 8 files changed, 210 insertions(+), 51 deletions(-) create mode 100644 account_statement_so_completion/__init__.py create mode 100644 account_statement_so_completion/__openerp__.py create mode 100644 account_statement_so_completion/data.xml create mode 100644 account_statement_so_completion/partner_view.xml create mode 100644 account_statement_so_completion/statement.py diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py index d868a314..2d795534 100644 --- a/account_statement_base_completion/__openerp__.py +++ b/account_statement_base_completion/__openerp__.py @@ -35,7 +35,6 @@ 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 SO number) 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 diff --git a/account_statement_base_completion/data.xml b/account_statement_base_completion/data.xml index 59a75228..595a4af3 100644 --- a/account_statement_base_completion/data.xml +++ b/account_statement_base_completion/data.xml @@ -14,12 +14,6 @@ get_from_label_and_partner_name - - Match from line reference (based on SO number) - 50 - get_from_ref_and_so - - Match from line reference (based on Invoice number) 40 diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 96ab741b..aacb7068 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -132,7 +132,6 @@ class AccountStatementCompletionRule(orm.Model): 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_ref_and_so', 'From line reference (based on SO 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)')] @@ -232,49 +231,6 @@ class AccountStatementCompletionRule(orm.Model): """ return self._from_invoice(cr, uid, line, 'customer', context=context) - # 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 - # 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): """ diff --git a/account_statement_so_completion/__init__.py b/account_statement_so_completion/__init__.py new file mode 100644 index 00000000..5c28ebc2 --- /dev/null +++ b/account_statement_so_completion/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Joel Grand-Guillaume +# Copyright 2011-2012 Camptocamp SA +# # +# Author: Leonardo Pistone # +# 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 . # +# # +############################################################################### + +import statement diff --git a/account_statement_so_completion/__openerp__.py b/account_statement_so_completion/__openerp__.py new file mode 100644 index 00000000..9028d535 --- /dev/null +++ b/account_statement_so_completion/__openerp__.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Joel Grand-Guillaume +# Copyright 2011-2012 Camptocamp SA +# # +# Author: Leonardo Pistone # +# 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 . # +# # +############################################################################### + +{'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', + 'init_xml': [], + 'update_xml': [ + 'data.xml', + ], + 'demo_xml': [], + 'test': [], + 'installable': True, + 'images': [], + 'auto_install': False, + 'license': 'AGPL-3', + } diff --git a/account_statement_so_completion/data.xml b/account_statement_so_completion/data.xml new file mode 100644 index 00000000..89fedef2 --- /dev/null +++ b/account_statement_so_completion/data.xml @@ -0,0 +1,12 @@ + + + + + + Match from line reference (based on SO number) + 50 + get_from_ref_and_so + + + + diff --git a/account_statement_so_completion/partner_view.xml b/account_statement_so_completion/partner_view.xml new file mode 100644 index 00000000..c7ec3f1a --- /dev/null +++ b/account_statement_so_completion/partner_view.xml @@ -0,0 +1,22 @@ + + + + + + + + account_bank_statement_import.view.partner.form + res.partner + form + 20 + + + + + + + + + + + diff --git a/account_statement_so_completion/statement.py b/account_statement_so_completion/statement.py new file mode 100644 index 00000000..03d0a2b3 --- /dev/null +++ b/account_statement_so_completion/statement.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Author: Joel Grand-Guillaume +# Copyright 2011-2012 Camptocamp SA +# # +# Author: Leonardo Pistone # +# Copyright 2013 Camptocamp SA # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +from openerp.osv import fields, orm +from tools.translate import _ + +from openerp.addons.account_statement_base_completion.statement import ErrorTooManyPartner + + +class account_statement_profile(orm.Model): + + _inherit = "account.statement.profile" + + # 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 + + +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) + return res.append( + ('get_from_ref_and_so', 'From line reference (based on SO number)') + ) + + _columns = { + 'function_to_call': fields.selection(_get_functions, 'Method'), + } From 95242cd44b93fbae301230813e57514694c231cb Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 3 Dec 2013 16:08:34 +0100 Subject: [PATCH 018/114] [del] unused file --- .../partner_view.xml | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 account_statement_so_completion/partner_view.xml diff --git a/account_statement_so_completion/partner_view.xml b/account_statement_so_completion/partner_view.xml deleted file mode 100644 index c7ec3f1a..00000000 --- a/account_statement_so_completion/partner_view.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - account_bank_statement_import.view.partner.form - res.partner - form - 20 - - - - - - - - - - - From f80bba275eec1133d3bf300bcb2c06b7259b40df Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 3 Dec 2013 16:10:22 +0100 Subject: [PATCH 019/114] [ref] minor refactor --- account_statement_so_completion/__init__.py | 2 +- account_statement_so_completion/statement.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account_statement_so_completion/__init__.py b/account_statement_so_completion/__init__.py index 5c28ebc2..34a7ad21 100644 --- a/account_statement_so_completion/__init__.py +++ b/account_statement_so_completion/__init__.py @@ -22,4 +22,4 @@ # # ############################################################################### -import statement +from . import statement diff --git a/account_statement_so_completion/statement.py b/account_statement_so_completion/statement.py index 03d0a2b3..439a66ad 100644 --- a/account_statement_so_completion/statement.py +++ b/account_statement_so_completion/statement.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################### # # -# Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA +# Author: Joel Grand-Guillaume # +# Copyright 2011-2012 Camptocamp SA # # # # Author: Leonardo Pistone # # Copyright 2013 Camptocamp SA # From 53c5ab9c84e7ea6f206b3edb2d420594f7536161 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 3 Dec 2013 16:19:45 +0100 Subject: [PATCH 020/114] auto_install account_statement_so_completion --- account_statement_so_completion/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_so_completion/__openerp__.py b/account_statement_so_completion/__openerp__.py index 9028d535..929e46c8 100644 --- a/account_statement_so_completion/__openerp__.py +++ b/account_statement_so_completion/__openerp__.py @@ -48,6 +48,6 @@ 'test': [], 'installable': True, 'images': [], - 'auto_install': False, + 'auto_install': True, 'license': 'AGPL-3', } From 3c3b6539504a39bed5a0d6d2137f6a056c6988de Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 14:30:34 +0100 Subject: [PATCH 021/114] [IMP] account_statement_base_import : add the posibility to set the starting and ending balance --- account_statement_base_import/parser/parser.py | 18 ++++++++++++++++++ account_statement_base_import/statement.py | 11 +++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 377548b2..9d8ca4e1 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -49,6 +49,8 @@ class BankStatementImportParser(object): self.result_row_list = None # The file buffer on which to work on self.filebuffer = None + self.balance_start = None + self.balance_end = None @classmethod def parser_for(cls, parser_name): @@ -150,6 +152,22 @@ class BankStatementImportParser(object): self._post(*args, **kwargs) return self.result_row_list + def get_start_balance(self, *args, **kwargs): + """ + This is called by the importation method to set the balance start + amount in the bank statement. + return: float of the balance start (self.balance_start) + """ + return self.balance_start + + def get_end_balance(self, *args, **kwargs): + """ + This is called by the importation method to set the balance end + amount in the bank statement. + return: float of the balance end (self.balance_end) + """ + return self.balance_end + def itersubclasses(cls, _seen=None): """ diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 97e8e8ab..438f6f1b 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -158,10 +158,13 @@ class AccountStatementProfil(Model): raise osv.except_osv(_("Missing column!"), _("Column %s you try to import is not " "present in the bank statement line!") % col) - - statement_id = statement_obj.create(cr, uid, - {'profile_id': prof.id}, - context=context) + st_vals = { + 'profile_id': prof.id, + 'balance_start': parser.get_start_balance(), + 'balance_end_real': parser.get_end_balance(), + } + + statement_id = statement_obj.create(cr, uid, st_vals, context=context) if prof.receivable_account_id: account_receivable = account_payable = prof.receivable_account_id.id else: From b6cb19e401f9bc3256c5cc289a084ae5631a9ea0 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 14:41:23 +0100 Subject: [PATCH 022/114] [FIX] fix api and put the incorrect method in deprecated --- account_statement_base_import/statement.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 97e8e8ab..d8badee2 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -85,7 +85,12 @@ class AccountStatementProfil(Model): context=context) return True - def prepare_statetement_lines_vals( + #Deprecated remove on V8 + def prepare_statetement_lines_vals(self, *args, **kwargs): + return super(self, AccountStatementProfil).\ + prepare_statetement_lines_vals(*args, **kwargs) + + def prepare_statement_lines_vals( self, cr, uid, parser_vals, account_payable, account_receivable, statement_id, context): """ @@ -172,7 +177,7 @@ class AccountStatementProfil(Model): statement_store = [] for line in result_row_list: parser_vals = parser.get_st_line_vals(line) - values = self.prepare_statetement_lines_vals( + values = self.prepare_statement_lines_vals( cr, uid, parser_vals, account_payable, account_receivable, statement_id, context) statement_store.append(values) From 5e80529485412c30614839c6c2331298e92d9198 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 15:10:49 +0100 Subject: [PATCH 023/114] [IMP] add the posibility to customise the bank statement name in the parser --- account_statement_base_import/parser/parser.py | 9 +++++++++ account_statement_base_import/statement.py | 1 + account_statement_base_import/wizard/import_statement.py | 1 + 3 files changed, 11 insertions(+) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 9d8ca4e1..b0d86de7 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -51,6 +51,7 @@ class BankStatementImportParser(object): self.filebuffer = None self.balance_start = None self.balance_end = None + self.statement_name = None @classmethod def parser_for(cls, parser_name): @@ -168,6 +169,14 @@ class BankStatementImportParser(object): """ return self.balance_end + def get_statement_name(self, *args, **kwargs): + """ + This is called by the importation method to set the statement + date in the bank statement. + return: float of the balance start (self.balance_start) + """ + return self.statement_name or '/' + def itersubclasses(cls, _seen=None): """ diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 438f6f1b..47f52f63 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -160,6 +160,7 @@ class AccountStatementProfil(Model): "present in the bank statement line!") % col) st_vals = { 'profile_id': prof.id, + 'name': parser.get_statement_name(), 'balance_start': parser.get_start_balance(), 'balance_end_real': parser.get_end_balance(), } diff --git a/account_statement_base_import/wizard/import_statement.py b/account_statement_base_import/wizard/import_statement.py index b6960ec9..260a900e 100644 --- a/account_statement_base_import/wizard/import_statement.py +++ b/account_statement_base_import/wizard/import_statement.py @@ -97,6 +97,7 @@ class CreditPartnerStatementImporter(orm.TransientModel): 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, From 9205414ee1bef9367b430e68ac3ba9fdf2e25b0a Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 15:14:56 +0100 Subject: [PATCH 024/114] [IMP] add the possibility to specify the bank statement date --- account_statement_base_import/parser/parser.py | 9 +++++++++ account_statement_commission/commission.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index b0d86de7..6472cea1 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -20,6 +20,7 @@ ############################################################################## import base64 import csv +from datetime import datetime def UnicodeDictReader(utf8_data, **kwargs): @@ -52,6 +53,7 @@ class BankStatementImportParser(object): self.balance_start = None self.balance_end = None self.statement_name = None + self.statement_date = None @classmethod def parser_for(cls, parser_name): @@ -177,6 +179,13 @@ class BankStatementImportParser(object): """ return self.statement_name or '/' + def get_statement_date(self, *args, **kwargs): + """ + This is called by the importation method to set the statement + date in the bank statement. + return: float of the balance start (self.balance_start) + """ + return self.statement_date or datetime.now() def itersubclasses(cls, _seen=None): """ diff --git a/account_statement_commission/commission.py b/account_statement_commission/commission.py index 138ad61f..f4d0fc74 100644 --- a/account_statement_commission/commission.py +++ b/account_statement_commission/commission.py @@ -22,7 +22,7 @@ class AccountStatementProfil(orm.Model): commission_analytic_id = profile.commission_analytic_id and profile.commission_analytic_id.id or False comm_values = { 'name': 'IN ' + _('Commission line'), - 'date': datetime.datetime.now().date(), + 'date': parser.get_statement_date(), 'amount': global_commission_amount, 'partner_id': partner_id, 'type': 'general', @@ -65,4 +65,4 @@ class CreditPartnerStatementImporter(orm.TransientModel): 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 \ No newline at end of file + return res From 98323e23428a0543802cc216ce92787ff74675f0 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 17:10:32 +0100 Subject: [PATCH 025/114] [IMP] do not recatch error in debug mode --- account_statement_base_import/statement.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 97e8e8ab..3964d77c 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -26,6 +26,7 @@ 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): @@ -211,6 +212,8 @@ class AccountStatementProfil(Model): 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)) + if config['debug_mode']: + raise raise osv.except_osv(_("Statement import error"), _("The statement cannot be created: %s") % st) return statement_id From 4933e28d0670572805857d8a56fcd74352740e4d Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 17:13:46 +0100 Subject: [PATCH 026/114] [REF] remove useless unlink as the raise osv will roolback the cursor --- account_statement_base_import/statement.py | 1 - 1 file changed, 1 deletion(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index d8badee2..56fad9c0 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -212,7 +212,6 @@ class AccountStatementProfil(Model): context) except Exception: - statement_obj.unlink(cr, uid, [statement_id], context=context) 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)) From d1e1c06364139d6c2c51563b447a93d33adc7c1f Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 17:25:04 +0100 Subject: [PATCH 027/114] [REF] rename OpenERP class AccountBankSatement into AccountBankStatement --- .../account.py | 4 ++-- account_statement_base_completion/statement.py | 2 +- account_statement_ext/statement.py | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/account_advanced_reconcile_transaction_ref/account.py b/account_advanced_reconcile_transaction_ref/account.py index 0525de31..b3e2cd24 100644 --- a/account_advanced_reconcile_transaction_ref/account.py +++ b/account_advanced_reconcile_transaction_ref/account.py @@ -30,7 +30,7 @@ class AccountMoveLine(Model): 'transaction_ref': fields.char('Transaction Ref.', size=128), } -class AccountBankSatement(Model): +class AccountBankStatement(Model): """ Inherit account.bank.statement class in order to set transaction_ref info on account.move.line """ @@ -43,7 +43,7 @@ class AccountBankSatement(Model): if context is None: context = {} - res = super(AccountBankSatement, self)._prepare_move_line_vals( + res = super(AccountBankStatement, self)._prepare_move_line_vals( cr, uid, st_line, move_id, debit, credit, currency_id=currency_id, amount_currency=amount_currency, diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 96ab741b..d9782252 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -511,7 +511,7 @@ class AccountStatementLine(orm.Model): sql_err.pgerror) -class AccountBankSatement(orm.Model): +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. diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index f8762054..48667715 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -113,7 +113,7 @@ class AccountStatementProfile(Model): ] -class AccountBankSatement(Model): +class AccountBankStatement(Model): """ We improve the bank statement class mostly for : - Removing the period and compute it from the date of each line. @@ -202,7 +202,7 @@ class AccountBankSatement(Model): 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(AccountBankSatement, self).create(cr, uid, vals, context=context) + return super(AccountBankStatement, self).create(cr, uid, vals, context=context) def _get_period(self, cr, uid, date, context=None): """ @@ -243,7 +243,7 @@ class AccountBankSatement(Model): """ if context is None: context = {} - res = super(AccountBankSatement, self)._prepare_move( + 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 @@ -273,7 +273,7 @@ class AccountBankSatement(Model): """ if context is None: context = {} - res = super(AccountBankSatement, self)._prepare_move_line_vals( + res = super(AccountBankStatement, self)._prepare_move_line_vals( cr, uid, st_line, move_id, debit, credit, currency_id=currency_id, amount_currency=amount_currency, @@ -297,7 +297,7 @@ class AccountBankSatement(Model): create the move from. :return: int/long of the res.partner to use as counterpart """ - bank_partner_id = super(AccountBankSatement, self)._get_counter_part_partner(cr, + bank_partner_id = super(AccountBankStatement, self)._get_counter_part_partner(cr, uid, st_line, context=context) @@ -530,7 +530,7 @@ class AccountBankSatement(Model): """ st = self.browse(cr, uid, st_id, context=context) if st.balance_check: - return super(AccountBankSatement, self).balance_check( + return super(AccountBankStatement, self).balance_check( cr, uid, st_id, journal_type, context=context) else: return True @@ -555,7 +555,7 @@ class AccountBankSatement(Model): 'credit_partner_id': credit_partner_id}} -class AccountBankSatementLine(Model): +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 @@ -684,7 +684,7 @@ class AccountBankSatementLine(Model): Keep the same features as in standard and call super. If an account is returned, call the method to compute line values. """ - res = super(AccountBankSatementLine, self).onchange_type(cr, uid, + res = super(AccountBankStatementLine, self).onchange_type(cr, uid, line_id, partner_id, line_type, From 7be98134f48c7bbe82271551956262478ed0e60f Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 17:49:14 +0100 Subject: [PATCH 028/114] [IMP] add constraint to have an uniq name on bank statement --- account_statement_ext/statement.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index f8762054..fcfe1ece 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -111,6 +111,11 @@ class AccountStatementProfile(Model): _constraints = [ (_check_partner, "You need to put a partner if you tic the 'Force partner on bank move'!", []), ] + + _sql_constraints = [ + ('name_uniq', 'unique (name)', 'The name of the bank statement must be unique !') + ] + class AccountBankSatement(Model): From 1648c431f7678f5f75b768c422f7a43d9c926134 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 4 Dec 2013 18:39:04 +0100 Subject: [PATCH 029/114] [REF] add a prepare method for custom for creating the bank statement --- account_statement_base_import/statement.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 47f52f63..960616d1 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -126,6 +126,15 @@ class AccountStatementProfil(Model): values['type'] = 'general' return values + + def _prepare_statement_vals(self, cr, uid, prof, parser, context=None): + return { + 'profile_id': prof.id, + 'name': parser.get_statement_name(), + 'balance_start': parser.get_start_balance(), + 'balance_end_real': parser.get_end_balance(), + } + 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 @@ -158,13 +167,8 @@ class AccountStatementProfil(Model): raise osv.except_osv(_("Missing column!"), _("Column %s you try to import is not " "present in the bank statement line!") % col) - st_vals = { - 'profile_id': prof.id, - 'name': parser.get_statement_name(), - 'balance_start': parser.get_start_balance(), - 'balance_end_real': parser.get_end_balance(), - } - + + st_vals = self._prepare_statement_vals(cr, uid, prof, parser, context=context) statement_id = statement_obj.create(cr, uid, st_vals, context=context) if prof.receivable_account_id: account_receivable = account_payable = prof.receivable_account_id.id From bbb25a3ac797b1f82c861d6a77edd54e0ba085c9 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 11 Dec 2013 17:01:01 +0100 Subject: [PATCH 030/114] [FIX] fix uniq name constraint, should work in multi-company --- account_statement_ext/statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index fcfe1ece..4775362b 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -113,7 +113,7 @@ class AccountStatementProfile(Model): ] _sql_constraints = [ - ('name_uniq', 'unique (name)', 'The name of the bank statement must be unique !') + ('name_uniq', 'unique (name, company_id)', 'The name of the bank statement must be unique !') ] From 0164efeae71a14f040bedad7a61d3a910db32817 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Wed, 11 Dec 2013 17:18:58 +0100 Subject: [PATCH 031/114] [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 032/114] [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 033/114] [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 c921a717418b9b418a157fdb3b0dd2601d19d9ef Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 11 Dec 2013 20:11:44 +0100 Subject: [PATCH 034/114] [FIX] Change some methods description --- account_statement_base_import/parser/parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 6472cea1..cce55eea 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -174,8 +174,8 @@ class BankStatementImportParser(object): def get_statement_name(self, *args, **kwargs): """ This is called by the importation method to set the statement - date in the bank statement. - return: float of the balance start (self.balance_start) + name in the bank statement. + return: string of the statement name (self.statement_name) """ return self.statement_name or '/' @@ -183,7 +183,7 @@ class BankStatementImportParser(object): """ This is called by the importation method to set the statement date in the bank statement. - return: float of the balance start (self.balance_start) + return: datetime of the statement date (self.statement_date) """ return self.statement_date or datetime.now() From ac625c78e9bf3a763495f63eee281f0a12d9e1b9 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Thu, 12 Dec 2013 22:38:08 +0100 Subject: [PATCH 035/114] [FIX] Fix some code length, fill description, change module name --- account_statement_one_move/__openerp__.py | 15 +++++++---- account_statement_one_move/statement.py | 32 ++++++++++++++++------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/account_statement_one_move/__openerp__.py b/account_statement_one_move/__openerp__.py index 19a8b1f5..5ddb0cc3 100644 --- a/account_statement_one_move/__openerp__.py +++ b/account_statement_one_move/__openerp__.py @@ -21,19 +21,24 @@ ############################################################################### { - 'name': 'account_statement_one_move', + 'name': 'Bank statement one move', 'version': '0.1', 'category': 'Generic Modules/Others', 'license': 'AGPL-3', - 'description': """empty""", + 'description': """ + This module allow to groupe 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'], - 'init_xml': [], - 'update_xml': [ + 'data': [ 'statement_view.xml' ], - 'demo_xml': [], + 'demo': [], 'installable': True, + 'auto_install': False, 'active': False, } diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index 41706d72..e473e01f 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -37,8 +37,10 @@ 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')) + 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, @@ -60,22 +62,32 @@ class account_bank_statement(orm.Model): }) return res - def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context): + 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 = {} 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_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) + 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) + 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): + 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 @@ -115,7 +127,8 @@ class account_bank_statement(orm.Model): 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) + super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, + context=context) if st.profile_id.one_move: move_id = context['move_id'] self._valid_move(cr, uid, move_id, context=context) @@ -135,7 +148,8 @@ class account_bank_statement(orm.Model): move.unlink(context=context) st.write({'state':'draft'}, context=context) else: - super(account_bank_statement, self).button_cancel(cr, uid, ids, context=context) + super(account_bank_statement, self).button_cancel(cr, uid, ids, + context=context) return True From fc0b8ec312fed12ac4e4eb30a14fd12b61cc1ea0 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 13 Dec 2013 12:33:52 +0100 Subject: [PATCH 036/114] [fix] selection value --- account_statement_so_completion/statement.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account_statement_so_completion/statement.py b/account_statement_so_completion/statement.py index 439a66ad..f41fd906 100644 --- a/account_statement_so_completion/statement.py +++ b/account_statement_so_completion/statement.py @@ -89,9 +89,10 @@ class account_statement_completion_rule(orm.Model): def _get_functions(self, cr, uid, context=None): res = super(account_statement_completion_rule, self)._get_functions( cr, uid, context=context) - return res.append( + res.append( ('get_from_ref_and_so', 'From line reference (based on SO number)') ) + return res _columns = { 'function_to_call': fields.selection(_get_functions, 'Method'), From 9080e3d6c8a491df0db5344f5cfe06e7af762d27 Mon Sep 17 00:00:00 2001 From: Vincent Renaville Date: Fri, 13 Dec 2013 15:06:53 +0100 Subject: [PATCH 037/114] [FIX] PEP8 --- account_statement_ext/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_statement_ext/account.py b/account_statement_ext/account.py index 97f1103f..ecd1853c 100644 --- a/account_statement_ext/account.py +++ b/account_statement_ext/account.py @@ -36,6 +36,6 @@ class account_move(Model): 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) + 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) From 89e7700d21796d4be8bec6b522d2db7bfbde4fe3 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 13 Dec 2013 17:25:10 +0100 Subject: [PATCH 038/114] [add] tests for account_statement_base_completion: customer invoice --- .../__openerp__.py | 5 ++- .../test/TODO.txt | 3 ++ .../test/completion_test.yml | 31 ++++++++++++++++++ .../test/invoice.yml | 32 +++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 account_statement_base_completion/test/TODO.txt create mode 100644 account_statement_base_completion/test/completion_test.yml create mode 100644 account_statement_base_completion/test/invoice.yml diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py index d868a314..3147822f 100644 --- a/account_statement_base_completion/__openerp__.py +++ b/account_statement_base_completion/__openerp__.py @@ -66,7 +66,10 @@ 'security/ir.model.access.csv', ], 'demo_xml': [], - 'test': [], + 'test': [ + 'test/invoice.yml', + 'test/completion_test.yml' + ], 'installable': True, 'images': [], 'auto_install': False, diff --git a/account_statement_base_completion/test/TODO.txt b/account_statement_base_completion/test/TODO.txt new file mode 100644 index 00000000..42bd3f37 --- /dev/null +++ b/account_statement_base_completion/test/TODO.txt @@ -0,0 +1,3 @@ +* statement default company, or company required? +* on_change +* statment doesn't have a company, why? \ No newline at end of file diff --git a/account_statement_base_completion/test/completion_test.yml b/account_statement_base_completion/test/completion_test.yml new file mode 100644 index 00000000..4936094f --- /dev/null +++ b/account_statement_base_completion/test/completion_test.yml @@ -0,0 +1,31 @@ +- + 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 +- + !record {model: account.bank.statement, id: statement_test1}: + name: Statement 2 + profile_id: profile_test1 + company_id: base.main_company + line_ids: + - name: Test autocompletion based on Invoice Number + ref: CI0001 + date: '2013-12-13' + amount: 2100.0 +- + I run the auto complete +- + !python {model: account.bank.statement}: | + result = self.button_auto_completion(cr, uid, [ref("statement_test1")]) diff --git a/account_statement_base_completion/test/invoice.yml b/account_statement_base_completion/test/invoice.yml new file mode 100644 index 00000000..5b6845f5 --- /dev/null +++ b/account_statement_base_completion/test/invoice.yml @@ -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: 450.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' From ea399af06b5d5726f03ac4041135363390364754 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 13 Dec 2013 20:08:52 +0100 Subject: [PATCH 039/114] [add] statement completion: more tests --- .../__openerp__.py | 1 + .../test/completion_test.yml | 18 +++++++++++++++--- .../test/invoice.yml | 2 +- .../test/partner.yml | 5 +++++ 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 account_statement_base_completion/test/partner.yml diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py index 3147822f..b7e6bdc6 100644 --- a/account_statement_base_completion/__openerp__.py +++ b/account_statement_base_completion/__openerp__.py @@ -67,6 +67,7 @@ ], 'demo_xml': [], 'test': [ + 'test/partner.yml', 'test/invoice.yml', 'test/completion_test.yml' ], diff --git a/account_statement_base_completion/test/completion_test.yml b/account_statement_base_completion/test/completion_test.yml index 4936094f..976a2dac 100644 --- a/account_statement_base_completion/test/completion_test.yml +++ b/account_statement_base_completion/test/completion_test.yml @@ -20,10 +20,22 @@ profile_id: profile_test1 company_id: base.main_company line_ids: - - name: Test autocompletion based on Invoice Number + - name: Test autocompletion based on Customer Invoice Number ref: CI0001 - date: '2013-12-13' - amount: 2100.0 + date: '2013-12-20' + amount: 210.0 + - name: Test autocompletion based on Supplier Invoice Number + ref: T2S12345 + date: '2013-12-19' + amount: -65.0 + - name: Test autocompletion based on Partner Name Vauxoo + ref: / + date: '2013-12-17' + amount: 600.0 + - name: test autocompletion based on text (XXX66Z) matching with partner form information (note that Ref does not exist) + ref: ZU788 + date: '2013-12-24' + amount: -932.4 - I run the auto complete - diff --git a/account_statement_base_completion/test/invoice.yml b/account_statement_base_completion/test/invoice.yml index 5b6845f5..5619f0cd 100644 --- a/account_statement_base_completion/test/invoice.yml +++ b/account_statement_base_completion/test/invoice.yml @@ -9,7 +9,7 @@ invoice_line: - account_id: account.a_sale name: '[PCSC234] PC Assemble SC234' - price_unit: 450.0 + price_unit: 210.0 quantity: 1.0 product_id: product.product_product_3 uos_id: product.product_uom_unit diff --git a/account_statement_base_completion/test/partner.yml b/account_statement_base_completion/test/partner.yml new file mode 100644 index 00000000..bc8fca6c --- /dev/null +++ b/account_statement_base_completion/test/partner.yml @@ -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 From 1a2da08be81af7966424a8b640d80204aa02480f Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 13 Dec 2013 21:10:44 +0100 Subject: [PATCH 040/114] [imp] completion tests --- .../__openerp__.py | 1 + .../test/completion_test.yml | 58 +++++++++++++------ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py index b7e6bdc6..2e15450b 100644 --- a/account_statement_base_completion/__openerp__.py +++ b/account_statement_base_completion/__openerp__.py @@ -69,6 +69,7 @@ 'test': [ 'test/partner.yml', 'test/invoice.yml', + 'test/supplier_invoice.yml', 'test/completion_test.yml' ], 'installable': True, diff --git a/account_statement_base_completion/test/completion_test.yml b/account_statement_base_completion/test/completion_test.yml index 976a2dac..796c4b6e 100644 --- a/account_statement_base_completion/test/completion_test.yml +++ b/account_statement_base_completion/test/completion_test.yml @@ -19,25 +19,49 @@ name: Statement 2 profile_id: profile_test1 company_id: base.main_company - line_ids: - - name: Test autocompletion based on Customer Invoice Number - ref: CI0001 - date: '2013-12-20' - amount: 210.0 - - name: Test autocompletion based on Supplier Invoice Number - ref: T2S12345 - date: '2013-12-19' - amount: -65.0 - - name: Test autocompletion based on Partner Name Vauxoo - ref: / - date: '2013-12-17' - amount: 600.0 - - name: test autocompletion based on text (XXX66Z) matching with partner form information (note that Ref does not exist) - ref: ZU788 - date: '2013-12-24' - amount: -932.4 +- + 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 +- + !assert {model: account.bank.statement.line, id: statement_line_ci, string: Check completion by CI number}: + - partner_id == ref('res_partner_12') \ No newline at end of file From 5cb9f4893bbf5fb322b79ff9e6137aa477562a61 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Mon, 16 Dec 2013 10:37:15 +0100 Subject: [PATCH 041/114] [fix] missing comma --- account_statement_ofx_import/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_ofx_import/__openerp__.py b/account_statement_ofx_import/__openerp__.py index ae06cfbf..a67c8c81 100644 --- a/account_statement_ofx_import/__openerp__.py +++ b/account_statement_ofx_import/__openerp__.py @@ -31,7 +31,7 @@ ], 'external_dependencies': { 'python': ['ofxparse'], - } + }, 'description': """ Allows to import OFX (Open Financial Exchange) statement files, using *account_statement_base_import* generic inheritance mechanism to import From 1c66e3c3951fdd4eb88e3fac49a195cff4d50c11 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Mon, 16 Dec 2013 14:55:56 +0100 Subject: [PATCH 042/114] [fix] account_statement_ext: unwind related and stored field because it does not work in a constraint in YAML test, for some reason. This probably needs a more general solution. --- account_statement_ext/statement.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 4775362b..54857212 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -223,12 +223,21 @@ class AccountBankSatement(Model): move of period_id to the statement line """ for statement in self.browse(cr, uid, ids, context=context): - if (statement.period_id and - statement.company_id.id != statement.period_id.company_id.id): + # 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.company_id.id != line.period_id.company_id.id): + if ( + line.period_id + and statement.journal_id.company_id.id + != line.period_id.company_id.id + ): return False return True From b54f6997e526722683ca2f74fb5660bb0bbbc86b Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Wed, 18 Dec 2013 19:09:04 +0100 Subject: [PATCH 043/114] [fix] account_statement_ext: remove hidden fields from on_change --- account_statement_ext/statement.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 4775362b..7022c366 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -552,12 +552,8 @@ class AccountBankSatement(Model): import_config = self.pool.get("account.statement.profile").browse( cr, uid, profile_id, context=context) journal_id = import_config.journal_id.id - account_id = import_config.journal_id.default_debit_account_id.id - credit_partner_id = import_config.partner_id and import_config.partner_id.id or False return {'value': {'journal_id': journal_id, - 'account_id': account_id, - 'balance_check': import_config.balance_check, - 'credit_partner_id': credit_partner_id}} + 'balance_check': import_config.balance_check}} class AccountBankSatementLine(Model): From 8a46f556f1f93590150a202d4e7e8fdb3c1d4aa8 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 19 Dec 2013 11:13:30 +0100 Subject: [PATCH 044/114] [imp] pep8 --- account_statement_ext/statement.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 54857212..392e0b9d 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -226,18 +226,14 @@ class AccountBankSatement(Model): # 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 - ): + 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 - ): + if (line.period_id and + statement.journal_id.company_id.id + != line.period_id.company_id.id): return False return True From b16ece087d7e421c1e4df30d301a5ee6553e1f0a Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 20 Dec 2013 11:55:21 +0100 Subject: [PATCH 045/114] [imp] bank statements: check 4 lines --- .../test/completion_test.yml | 20 ++++++++++++++++++- .../test/supplier_invoice.yml | 14 +++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 account_statement_base_completion/test/supplier_invoice.yml diff --git a/account_statement_base_completion/test/completion_test.yml b/account_statement_base_completion/test/completion_test.yml index 4d8ae085..5b87a959 100644 --- a/account_statement_base_completion/test/completion_test.yml +++ b/account_statement_base_completion/test/completion_test.yml @@ -13,7 +13,8 @@ - bank_statement_completion_rule_2 - bank_statement_completion_rule_3 - - Now I create a statement + 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 @@ -67,3 +68,20 @@ - !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") diff --git a/account_statement_base_completion/test/supplier_invoice.yml b/account_statement_base_completion/test/supplier_invoice.yml new file mode 100644 index 00000000..24dbad82 --- /dev/null +++ b/account_statement_base_completion/test/supplier_invoice.yml @@ -0,0 +1,14 @@ +- + I add a reference to an existing supplier invoce +- + !record {model: account.invoice, id: account.demo_invoice_0}: + supplier_invoice_number: T2S12345 +- + 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' From 562250842a564e6d4b9611c64417934b94dc8547 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 20 Dec 2013 15:16:41 +0100 Subject: [PATCH 046/114] [fix] yaml: !record is to create. use python write --- .../test/supplier_invoice.yml | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/account_statement_base_completion/test/supplier_invoice.yml b/account_statement_base_completion/test/supplier_invoice.yml index 24dbad82..1bd826f9 100644 --- a/account_statement_base_completion/test/supplier_invoice.yml +++ b/account_statement_base_completion/test/supplier_invoice.yml @@ -1,8 +1,20 @@ +- + 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 - - !record {model: account.invoice, id: account.demo_invoice_0}: - supplier_invoice_number: T2S12345 + !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 - @@ -12,3 +24,8 @@ - !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' From aba2cd43974698a9f443d8579c6e453785d89d27 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 20 Dec 2013 16:43:01 +0100 Subject: [PATCH 047/114] [add] account_statement_so_completion/test --- .../__openerp__.py | 3 +- .../test/completion_so_test.yml | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 account_statement_so_completion/test/completion_so_test.yml diff --git a/account_statement_so_completion/__openerp__.py b/account_statement_so_completion/__openerp__.py index 929e46c8..cc0e4286 100644 --- a/account_statement_so_completion/__openerp__.py +++ b/account_statement_so_completion/__openerp__.py @@ -45,7 +45,8 @@ 'data.xml', ], 'demo_xml': [], - 'test': [], + 'test': [ + 'test/completion_so_test.yml'], 'installable': True, 'images': [], 'auto_install': True, diff --git a/account_statement_so_completion/test/completion_so_test.yml b/account_statement_so_completion/test/completion_so_test.yml new file mode 100644 index 00000000..3b0bda3f --- /dev/null +++ b/account_statement_so_completion/test/completion_so_test.yml @@ -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' From 655162b5993fdff88e2524c68267b42648dd2fb2 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 20 Dec 2013 16:45:19 +0100 Subject: [PATCH 048/114] [fix] function in the wrong place --- account_statement_so_completion/statement.py | 27 ++++++++------------ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/account_statement_so_completion/statement.py b/account_statement_so_completion/statement.py index f41fd906..dcf2378f 100644 --- a/account_statement_so_completion/statement.py +++ b/account_statement_so_completion/statement.py @@ -28,9 +28,18 @@ from tools.translate import _ from openerp.addons.account_statement_base_completion.statement import ErrorTooManyPartner -class account_statement_profile(orm.Model): +class account_statement_completion_rule(orm.Model): - _inherit = "account.statement.profile" + _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): @@ -80,20 +89,6 @@ class account_statement_profile(orm.Model): res.update(st_vals) return res - -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 - _columns = { 'function_to_call': fields.selection(_get_functions, 'Method'), } From 53f2c55faaec540881484305b2ee2a6a4de79541 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 20 Dec 2013 17:25:50 +0100 Subject: [PATCH 049/114] [del] TODO --- account_statement_base_completion/test/TODO.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 account_statement_base_completion/test/TODO.txt diff --git a/account_statement_base_completion/test/TODO.txt b/account_statement_base_completion/test/TODO.txt deleted file mode 100644 index 42bd3f37..00000000 --- a/account_statement_base_completion/test/TODO.txt +++ /dev/null @@ -1,3 +0,0 @@ -* statement default company, or company required? -* on_change -* statment doesn't have a company, why? \ No newline at end of file From 3e4eb1095838e907b8007fdace776cd63b294bea Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 24 Dec 2013 19:16:40 +0100 Subject: [PATCH 050/114] [IMP] account_statement_base_import: private method that returns import type to ease inheritance [IMP] account_statement_ofx_import: changed accordingly previous improvement --- account_statement_base_import/statement.py | 9 +++++---- account_statement_ofx_import/statement.py | 13 +------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 97e8e8ab..e2057bc2 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -31,12 +31,13 @@ from parser import new_bank_statement_parser class AccountStatementProfil(Model): _inherit = "account.statement.profile" - def get_import_type_selection(self, cr, uid, context=None): - """ - Has to be inherited to add parser - """ + 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 _get_import_type selection(cr, uid, context=context) + _columns = { 'launch_import_completion': fields.boolean( "Launch completion after import", diff --git a/account_statement_ofx_import/statement.py b/account_statement_ofx_import/statement.py index c5b06fe8..bc31980a 100644 --- a/account_statement_ofx_import/statement.py +++ b/account_statement_ofx_import/statement.py @@ -24,7 +24,7 @@ from openerp.osv import fields, orm class AccountStatementProfil(orm.Model): _inherit = "account.statement.profile" - def get_import_type_selection(self, cr, uid, context=None): + def _get_import_type_selection(self, cr, uid, context=None): """ Inherited from parent to add parser. """ @@ -33,14 +33,3 @@ class AccountStatementProfil(orm.Model): context=context) selection.append(('ofx_so', _('OFX - Open Financial Exchange'))) return selection - - _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."), - - } - From ed60c48bea698646c55741b47466f69f407b943a Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Tue, 7 Jan 2014 12:27:26 +0100 Subject: [PATCH 051/114] [add] yaml tests for module account_statement_transactionid_completion --- .../__openerp__.py | 5 ++- .../test/completion_transactionid_test.yml | 44 +++++++++++++++++++ .../test/sale.yml | 11 +++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 account_statement_transactionid_completion/test/completion_transactionid_test.yml create mode 100644 account_statement_transactionid_completion/test/sale.yml diff --git a/account_statement_transactionid_completion/__openerp__.py b/account_statement_transactionid_completion/__openerp__.py index d8c20ea3..46513591 100644 --- a/account_statement_transactionid_completion/__openerp__.py +++ b/account_statement_transactionid_completion/__openerp__.py @@ -48,7 +48,10 @@ "data.xml", ], 'demo_xml': [], - 'test': [], + 'test': [ + 'test/sale.yml', + 'test/completion_transactionid_test.yml', + ], 'installable': True, 'images': [], 'auto_install': True, diff --git a/account_statement_transactionid_completion/test/completion_transactionid_test.yml b/account_statement_transactionid_completion/test/completion_transactionid_test.yml new file mode 100644 index 00000000..5b1cb4bd --- /dev/null +++ b/account_statement_transactionid_completion/test/completion_transactionid_test.yml @@ -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' diff --git a/account_statement_transactionid_completion/test/sale.yml b/account_statement_transactionid_completion/test/sale.yml new file mode 100644 index 00000000..a8ba93a9 --- /dev/null +++ b/account_statement_transactionid_completion/test/sale.yml @@ -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 From 760a4781becac4dcd5929f87676313231ff3290d Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Mon, 13 Jan 2014 16:14:02 +0100 Subject: [PATCH 052/114] 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 053/114] 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 054/114] 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 055/114] 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 056/114] 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 057/114] 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 058/114] 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 059/114] 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 060/114] 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 0d262e8890708f1100b44a73753ca6e5e33df808 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 15 Jan 2014 14:46:57 +0100 Subject: [PATCH 061/114] [FIX] Minor fixes --- account_statement_one_move/__init__.py | 3 +-- account_statement_one_move/__openerp__.py | 2 +- account_statement_one_move/statement.py | 20 +++++++++++-------- account_statement_one_move/statement_view.xml | 2 -- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/account_statement_one_move/__init__.py b/account_statement_one_move/__init__.py index bf2e6751..141c95fc 100644 --- a/account_statement_one_move/__init__.py +++ b/account_statement_one_move/__init__.py @@ -20,5 +20,4 @@ # ############################################################################### -import statement - +from . import statement diff --git a/account_statement_one_move/__openerp__.py b/account_statement_one_move/__openerp__.py index 5ddb0cc3..266c6ce7 100644 --- a/account_statement_one_move/__openerp__.py +++ b/account_statement_one_move/__openerp__.py @@ -26,7 +26,7 @@ 'category': 'Generic Modules/Others', 'license': 'AGPL-3', 'description': """ - This module allow to groupe all lines of a bank statement in only one move. This feature is optional + 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. diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index e473e01f..ef6d0f21 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -23,14 +23,13 @@ from openerp.osv import fields, orm, osv - -class AccountStatementProfil(orm.Model): +class AccountStatementProfile(orm.Model): _inherit = "account.statement.profile" _columns = { - 'one_move': fields.boolean('One Move', - help="Tic that box if you want OpenERP to generated only" - "one move when the bank statement is validated") - } + 'one_move': fields.boolean( + 'Group Journal Items', + help="Only one Journal Entry will be generated on the " + "validation of the bank statement."), class account_bank_statement(orm.Model): @@ -62,6 +61,7 @@ class account_bank_statement(orm.Model): }) 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: @@ -110,7 +110,9 @@ class account_bank_statement(orm.Model): 'res.currency.compute.account': acc_cur, }) amount = res_currency_obj.compute(cr, uid, st.currency.id, - company_currency_id, st_line.amount, context=context) + 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) @@ -122,6 +124,7 @@ class account_bank_statement(orm.Model): move_obj.post(cr, uid, [move_id], context=context) return True + def button_confirm_bank(self, cr, uid, ids, context=None): st_line_obj = self.pool.get('account.bank.statement.line') if context is None: @@ -142,8 +145,9 @@ class account_bank_statement(orm.Model): done = [] for st in self.browse(cr, uid, ids, context=context): if st.profile_id.one_move: + assert st.line_ids, "This statement does not contain any lines" for move in st.line_ids[0].move_ids: - if move.state <> 'draft': + if move.state != 'draft': move.button_cancel(context=context) move.unlink(context=context) st.write({'state':'draft'}, context=context) diff --git a/account_statement_one_move/statement_view.xml b/account_statement_one_move/statement_view.xml index 3fb1d23d..8a145f22 100644 --- a/account_statement_one_move/statement_view.xml +++ b/account_statement_one_move/statement_view.xml @@ -14,8 +14,6 @@ account_statement_one_move.account_statement.view_form account.statement.profile - - form From e071aad62e541e816203dfc80ff0770dd4e6804c Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 15 Jan 2014 14:58:05 +0100 Subject: [PATCH 062/114] [IMP] Add transfer lines automatically to balance the bank statement --- account_statement_one_move/statement.py | 83 ++++++++++++++++++- account_statement_one_move/statement_view.xml | 1 + 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index ef6d0f21..1616fe4a 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -21,6 +21,8 @@ ############################################################################### from openerp.osv import fields, orm, osv +from openerp.tools.translate import _ + class AccountStatementProfile(orm.Model): @@ -30,6 +32,11 @@ class AccountStatementProfile(orm.Model): '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): @@ -124,12 +131,86 @@ class account_bank_statement(orm.Model): move_obj.post(cr, uid, [move_id], context=context) return True - + + def create_statement_payment_line(self, cr, uid, st, payment_amount, context=None): + st_line_obj = self.pool.get('account.bank.statement.line') + payment_account_id = st.profile_id.journal_id.default_credit_account_id.id + partner_id = st.profile_id.partner_id and profile.partner_id.id or False + vals = { + 'name': _('Payment Transfer'), + 'date': st.date, + 'amount': -payment_amount, + 'partner_id': partner_id, + 'type': 'general', + 'statement_id': st.id, + 'account_id': payment_account_id, + 'ref': _('Transfer'), + 'already_completed': True + } + payment_line_id = st_line_obj.create(cr, uid, vals, context=context) + return payment_line_id + + + def create_statement_refund_line(self, cr, uid, st, refund_amount, context=None): + st_line_obj = self.pool.get('account.bank.statement.line') + refund_account_id = st.profile_id.journal_id.default_credit_account_id.id + partner_id = st.profile_id.partner_id and profile.partner_id.id or False + vals = { + 'name': _('Refund Transfer'), + 'date': st.date, + 'amount': -refund_amount, + 'partner_id': partner_id, + 'type': 'general', + 'statement_id': st.id, + 'account_id': refund_account_id, + 'ref': _('Transfer'), + 'already_completed': True + } + refund_line_id = st_line_obj.create(cr, uid, vals, context=context) + return refund_line_id + + + def prepare_statement_transfer_lines(self, cr, uid, st, context=None): + refund_amount = 0.0 + payment_amount = 0.0 + transfer_line_ids = [] + #Calculate the part of the refund amount and the payment amount + for st_line in st.line_ids: + if st_line.amount < 0.0: + refund_amount += st_line.amount + else: + payment_amount += st_line.amount + #Create 2 Transfer lines or One global tranfer line + if st.profile_id.split_transfer_line: + transfer_line_ids.append(self.create_statement_refund_line(cr, uid, st, + refund_amount, + context=context)) + transfer_line_ids.append(self.create_statement_payment_line(cr, uid, st, + payment_amount, + context=context)) + else: + global_amount = refund_amount + payment_amount + #The global transfer line can be a refund or a payment transfer + if global_amount < 0.00: + transfer_line_ids.append(self.create_statement_refund_line(cr, uid, st, + global_amount, + context=context)) + else: + transfer_line_ids.append(self.create_statement_payment_line(cr, uid, st, + global_amount, + 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') if context is None: context = {} for st in self.browse(cr, uid, ids, context=context): + if st.profile_id.one_move: + refund_line_ids = self.prepare_statement_transfer_lines(cr, uid, st, + context=context) super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context) if st.profile_id.one_move: diff --git a/account_statement_one_move/statement_view.xml b/account_statement_one_move/statement_view.xml index 8a145f22..e0e19fc8 100644 --- a/account_statement_one_move/statement_view.xml +++ b/account_statement_one_move/statement_view.xml @@ -17,6 +17,7 @@ + From 19abe5ed0195c8f7b442720976bc9f706e55c945 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 16 Jan 2014 11:35:20 +0100 Subject: [PATCH 063/114] [imp] manifest: data --- account_statement_so_completion/__openerp__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/account_statement_so_completion/__openerp__.py b/account_statement_so_completion/__openerp__.py index cc0e4286..30a7f581 100644 --- a/account_statement_so_completion/__openerp__.py +++ b/account_statement_so_completion/__openerp__.py @@ -40,11 +40,9 @@ 1) Match from statement line reference (based on SO number) """, 'website': 'http://www.camptocamp.com', - 'init_xml': [], - 'update_xml': [ + 'data': [ 'data.xml', ], - 'demo_xml': [], 'test': [ 'test/completion_so_test.yml'], 'installable': True, From df53643070492311431acea67fbcc4ba7bc7955b Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 17 Jan 2014 14:20:56 +0100 Subject: [PATCH 064/114] Only commercial partners are allowed in bank statement lines --- account_statement_ext/statement.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 80edbfcc..2ca8627b 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -655,6 +655,8 @@ class AccountBankSatementLine(Model): # 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 + 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 From fda091b8d4d4892266c14cbd49886b47b37c65e4 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 17 Jan 2014 15:10:42 +0100 Subject: [PATCH 065/114] explain the last change --- 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 2ca8627b..0a436ab2 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -656,6 +656,9 @@ class AccountBankSatementLine(Model): 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 From f424f470b46c2f5de0164b11f8cadb29a67c80cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 19 Jan 2014 18:37:09 +0100 Subject: [PATCH 066/114] [IMP] pep8 + cleanup --- .../__openerp__.py | 15 +++++++-------- account_statement_bankaccount_completion/data.xml | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/account_statement_bankaccount_completion/__openerp__.py b/account_statement_bankaccount_completion/__openerp__.py index 0986b97d..e74f2ba7 100644 --- a/account_statement_bankaccount_completion/__openerp__.py +++ b/account_statement_bankaccount_completion/__openerp__.py @@ -29,21 +29,20 @@ 'account_statement_base_completion', ], 'description': """ - Add a completion method based on the partner bank account number provided by the bank/office. + 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. + 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', - 'init_xml': [], - 'update_xml': [ + 'data': [ "data.xml", ], - 'demo_xml': [], - 'test': [], + 'demo': [], 'installable': True, - 'images': [], 'auto_install': True, 'license': 'AGPL-3', } diff --git a/account_statement_bankaccount_completion/data.xml b/account_statement_bankaccount_completion/data.xml index a6a84429..685c4008 100644 --- a/account_statement_bankaccount_completion/data.xml +++ b/account_statement_bankaccount_completion/data.xml @@ -3,7 +3,7 @@ - Match from bank account number (Nomal or IBAN)) + Match from bank account number (Normal or IBAN)) 10 get_from_bank_account From 9eaf6c4109e81090cfe2c87a43b6219f51db7d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 19 Jan 2014 18:38:47 +0100 Subject: [PATCH 067/114] [FIX] account_statement_bankaccount_completion should not auto install --- account_statement_bankaccount_completion/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_bankaccount_completion/__openerp__.py b/account_statement_bankaccount_completion/__openerp__.py index e74f2ba7..d115274b 100644 --- a/account_statement_bankaccount_completion/__openerp__.py +++ b/account_statement_bankaccount_completion/__openerp__.py @@ -43,6 +43,6 @@ ], 'demo': [], 'installable': True, - 'auto_install': True, + 'auto_install': False, 'license': 'AGPL-3', } From b962fc2669b7773c993634b8dbb87b58ce074f5d Mon Sep 17 00:00:00 2001 From: "Laetitia Gangloff (Acsone)" Date: Mon, 20 Jan 2014 10:06:39 +0100 Subject: [PATCH 068/114] 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 3f1999ed8cea4d6ba273d486e8414f23dd2971df Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 21 Jan 2014 02:04:59 +0100 Subject: [PATCH 069/114] [IMP] account_statement_base_import: Inheritable method with public name. --- account_statement_base_import/statement.py | 9 ++++----- account_statement_ofx_import/statement.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index e2057bc2..3dbddd60 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -31,12 +31,12 @@ from parser import new_bank_statement_parser class AccountStatementProfil(Model): _inherit = "account.statement.profile" - def _get_import_type_selection(self, cr, uid, context=None): + 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 _get_import_type selection(cr, uid, context=context) + def _get_import_type_selection(self, cr, uid, context=None): + return get_import_type selection(cr, uid, context=context) _columns = { 'launch_import_completion': fields.boolean( @@ -47,12 +47,11 @@ class AccountStatementProfil(Model): # 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, + _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."), - } def _write_extra_statement_lines( diff --git a/account_statement_ofx_import/statement.py b/account_statement_ofx_import/statement.py index bc31980a..15060360 100644 --- a/account_statement_ofx_import/statement.py +++ b/account_statement_ofx_import/statement.py @@ -24,7 +24,7 @@ from openerp.osv import fields, orm class AccountStatementProfil(orm.Model): _inherit = "account.statement.profile" - def _get_import_type_selection(self, cr, uid, context=None): + def get_import_type_selection(self, cr, uid, context=None): """ Inherited from parent to add parser. """ From 1f11041736a6958437c26e85b844424809627a43 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 21 Jan 2014 13:07:34 +0100 Subject: [PATCH 070/114] [IMP] Translation template files. --- .../i18n/account_advanced_reconcile.pot | 90 ++++ ...unt_advanced_reconcile_transaction_ref.pot | 97 +++++ .../i18n/account_easy_reconcile.pot | 406 ++++++++++++++++++ ...count_statement_bankaccount_completion.pot | 43 ++ .../account_statement_base_completion.pot | 199 +++++++++ .../i18n/account_statement_base_import.pot | 289 +++++++++++++ .../i18n/account_statement_commission.pot | 53 +++ .../i18n/account_statement_ofx_import.pot | 34 ++ .../i18n/account_statement_so_completion.pot | 28 ++ ...unt_statement_transactionid_completion.pot | 43 ++ ...account_statement_transactionid_import.pot | 21 + .../i18n/base_transaction_id.pot | 58 +++ .../i18n/invoicing_voucher_killer.pot | 32 ++ .../i18n/statement_voucher_killer.pot | 27 ++ 14 files changed, 1420 insertions(+) create mode 100644 account_advanced_reconcile/i18n/account_advanced_reconcile.pot create mode 100644 account_advanced_reconcile_transaction_ref/i18n/account_advanced_reconcile_transaction_ref.pot create mode 100644 account_easy_reconcile/i18n/account_easy_reconcile.pot create mode 100644 account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot create mode 100644 account_statement_base_completion/i18n/account_statement_base_completion.pot create mode 100644 account_statement_base_import/i18n/account_statement_base_import.pot create mode 100644 account_statement_commission/i18n/account_statement_commission.pot create mode 100644 account_statement_ofx_import/i18n/account_statement_ofx_import.pot create mode 100644 account_statement_so_completion/i18n/account_statement_so_completion.pot create mode 100644 account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot create mode 100644 account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot create mode 100644 base_transaction_id/i18n/base_transaction_id.pot create mode 100644 invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot create mode 100644 statement_voucher_killer/i18n/statement_voucher_killer.pot diff --git a/account_advanced_reconcile/i18n/account_advanced_reconcile.pot b/account_advanced_reconcile/i18n/account_advanced_reconcile.pot new file mode 100644 index 00000000..98382751 --- /dev/null +++ b/account_advanced_reconcile/i18n/account_advanced_reconcile.pot @@ -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 "" + diff --git a/account_advanced_reconcile_transaction_ref/i18n/account_advanced_reconcile_transaction_ref.pot b/account_advanced_reconcile_transaction_ref/i18n/account_advanced_reconcile_transaction_ref.pot new file mode 100644 index 00000000..92297c0e --- /dev/null +++ b/account_advanced_reconcile_transaction_ref/i18n/account_advanced_reconcile_transaction_ref.pot @@ -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 "" + diff --git a/account_easy_reconcile/i18n/account_easy_reconcile.pot b/account_easy_reconcile/i18n/account_easy_reconcile.pot new file mode 100644 index 00000000..4f878273 --- /dev/null +++ b/account_easy_reconcile/i18n/account_easy_reconcile.pot @@ -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 "

\n" +" Click to add a reconciliation profile.\n" +"

\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" +"

\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 "" + diff --git a/account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot b/account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot new file mode 100644 index 00000000..f014fb5f --- /dev/null +++ b/account_statement_bankaccount_completion/i18n/account_statement_bankaccount_completion.pot @@ -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 "" + diff --git a/account_statement_base_completion/i18n/account_statement_base_completion.pot b/account_statement_base_completion/i18n/account_statement_base_completion.pot new file mode 100644 index 00000000..50f00fa5 --- /dev/null +++ b/account_statement_base_completion/i18n/account_statement_base_completion.pot @@ -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 "" + diff --git a/account_statement_base_import/i18n/account_statement_base_import.pot b/account_statement_base_import/i18n/account_statement_base_import.pot new file mode 100644 index 00000000..f6bfbeea --- /dev/null +++ b/account_statement_base_import/i18n/account_statement_base_import.pot @@ -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 "" + diff --git a/account_statement_commission/i18n/account_statement_commission.pot b/account_statement_commission/i18n/account_statement_commission.pot new file mode 100644 index 00000000..522d0121 --- /dev/null +++ b/account_statement_commission/i18n/account_statement_commission.pot @@ -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 "" + diff --git a/account_statement_ofx_import/i18n/account_statement_ofx_import.pot b/account_statement_ofx_import/i18n/account_statement_ofx_import.pot new file mode 100644 index 00000000..e2aedabf --- /dev/null +++ b/account_statement_ofx_import/i18n/account_statement_ofx_import.pot @@ -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 "" + diff --git a/account_statement_so_completion/i18n/account_statement_so_completion.pot b/account_statement_so_completion/i18n/account_statement_so_completion.pot new file mode 100644 index 00000000..69bf8c28 --- /dev/null +++ b/account_statement_so_completion/i18n/account_statement_so_completion.pot @@ -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 "" + diff --git a/account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot b/account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot new file mode 100644 index 00000000..ac5f9b13 --- /dev/null +++ b/account_statement_transactionid_completion/i18n/account_statement_transactionid_completion.pot @@ -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 "" + diff --git a/account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot b/account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot new file mode 100644 index 00000000..1f02b6f1 --- /dev/null +++ b/account_statement_transactionid_import/i18n/account_statement_transactionid_import.pot @@ -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 "" + diff --git a/base_transaction_id/i18n/base_transaction_id.pot b/base_transaction_id/i18n/base_transaction_id.pot new file mode 100644 index 00000000..6364a946 --- /dev/null +++ b/base_transaction_id/i18n/base_transaction_id.pot @@ -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 "" + diff --git a/invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot b/invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot new file mode 100644 index 00000000..dec048dc --- /dev/null +++ b/invoicing_voucher_killer/i18n/invoicing_voucher_killer.pot @@ -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 "" + diff --git a/statement_voucher_killer/i18n/statement_voucher_killer.pot b/statement_voucher_killer/i18n/statement_voucher_killer.pot new file mode 100644 index 00000000..5c314a5d --- /dev/null +++ b/statement_voucher_killer/i18n/statement_voucher_killer.pot @@ -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 "" + From 1e0c40e3a1117de0ab1aa2b2d864ee0eb5a52549 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Tue, 21 Jan 2014 17:50:31 +0100 Subject: [PATCH 071/114] 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 072/114] 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 073/114] 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 074/114] [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 075/114] [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 076/114] [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 077/114] [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 07e41d89150e536ea503ae8a73a287b5be24ac59 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 31 Jan 2014 20:52:16 +0100 Subject: [PATCH 078/114] [FIX] Automatically create transfer move lines instead of bank statement transfer lines --- account_statement_one_move/statement.py | 110 +++++++++++------------- 1 file changed, 48 insertions(+), 62 deletions(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index 1616fe4a..af4c3d03 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -21,8 +21,6 @@ ############################################################################### from openerp.osv import fields, orm, osv -from openerp.tools.translate import _ - class AccountStatementProfile(orm.Model): @@ -38,7 +36,6 @@ class AccountStatementProfile(orm.Model): "for the refunds and one for the payments.") } - class account_bank_statement(orm.Model): _inherit = "account.bank.statement" @@ -132,89 +129,78 @@ class account_bank_statement(orm.Model): return True - def create_statement_payment_line(self, cr, uid, st, payment_amount, context=None): - st_line_obj = self.pool.get('account.bank.statement.line') - payment_account_id = st.profile_id.journal_id.default_credit_account_id.id + def _prepare_transfer_move_line_vals(self, cr, uid, st, name, debit, credit, 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 vals = { - 'name': _('Payment Transfer'), + 'name': name, 'date': st.date, - 'amount': -payment_amount, 'partner_id': partner_id, - 'type': 'general', 'statement_id': st.id, - 'account_id': payment_account_id, - 'ref': _('Transfer'), - 'already_completed': True - } - payment_line_id = st_line_obj.create(cr, uid, vals, context=context) - return payment_line_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_statement_refund_line(self, cr, uid, st, refund_amount, context=None): - st_line_obj = self.pool.get('account.bank.statement.line') - refund_account_id = st.profile_id.journal_id.default_credit_account_id.id - partner_id = st.profile_id.partner_id and profile.partner_id.id or False - vals = { - 'name': _('Refund Transfer'), - 'date': st.date, - 'amount': -refund_amount, - 'partner_id': partner_id, - 'type': 'general', - 'statement_id': st.id, - 'account_id': refund_account_id, - 'ref': _('Transfer'), - 'already_completed': True - } - refund_line_id = st_line_obj.create(cr, uid, vals, context=context) - return refund_line_id - - - def prepare_statement_transfer_lines(self, cr, uid, st, context=None): - refund_amount = 0.0 - payment_amount = 0.0 + 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_line_ids = [] #Calculate the part of the refund amount and the payment amount - for st_line in st.line_ids: - if st_line.amount < 0.0: - refund_amount += st_line.amount - else: - payment_amount += st_line.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: - transfer_line_ids.append(self.create_statement_refund_line(cr, uid, st, - refund_amount, - context=context)) - transfer_line_ids.append(self.create_statement_payment_line(cr, uid, st, - payment_amount, - context=context)) + refund_name = 'Refund Transfer' + payment_name = 'Payment Transfer' + if st.profile_id.split_transfer_line and refund != 0.0 and payment != 0.0: + refund_vals = self._prepare_transfer_move_line_vals(cr, uid, st, + refund_name, 0, refund, + move_id, context=context) + transfer_line_ids.append(move_line_obj.create(cr, uid, refund_vals, context=context)) + payment_vals = self._prepare_transfer_move_line_vals(cr, uid, st, + payment_name, payment, 0, + move_id, context=context) + transfer_line_ids.append(move_line_obj.create(cr, uid, payment_vals, context=context)) else: - global_amount = refund_amount + payment_amount #The global transfer line can be a refund or a payment transfer - if global_amount < 0.00: - transfer_line_ids.append(self.create_statement_refund_line(cr, uid, st, - global_amount, - context=context)) + global_amount = abs(payment-refund) + if payment > refund: + vals = self._prepare_transfer_move_line_vals(cr, uid, st, + payment_name, + global_amount, 0, + move_id, context=context) else: - transfer_line_ids.append(self.create_statement_payment_line(cr, uid, st, - global_amount, - context=context)) + vals = self._prepare_transfer_move_line_vals(cr, uid, st, + refund_name, 0, global_amount, + 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): - if st.profile_id.one_move: - refund_line_ids = self.prepare_statement_transfer_lines(cr, uid, st, - context=context) super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context) if st.profile_id.one_move: 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, From 342afc6445f03193250ee3a26d1ef1dda03f6afb Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 31 Jan 2014 21:56:30 +0100 Subject: [PATCH 079/114] [FIX] replace assert by a simple check in cancel method + add a check on the context in the button_confirm_bank method --- account_statement_one_move/statement.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index ef6d0f21..9951abb7 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -132,7 +132,7 @@ class account_bank_statement(orm.Model): 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: + if st.profile_id.one_move and context.get('move_id', False): move_id = context['move_id'] self._valid_move(cr, uid, move_id, context=context) lines_ids = [x.id for x in st.line_ids] @@ -144,8 +144,7 @@ class account_bank_statement(orm.Model): 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: - assert st.line_ids, "This statement does not contain any lines" + 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) From 6835d74e34f8421b8fde60dd9ef72c704cb12fb7 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 31 Jan 2014 22:03:42 +0100 Subject: [PATCH 080/114] [FIX] add closing bracket --- account_statement_one_move/statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index 9951abb7..5abf78c4 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -30,7 +30,7 @@ class AccountStatementProfile(orm.Model): 'Group Journal Items', help="Only one Journal Entry will be generated on the " "validation of the bank statement."), - + } class account_bank_statement(orm.Model): _inherit = "account.bank.statement" From 0f7fa422b458800dd1b9d035d7232ffaf8dd28da Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 3 Feb 2014 10:16:01 +0100 Subject: [PATCH 081/114] [FIX] Clean data --- account_statement_base_import/statement.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 56fad9c0..e85b7c8e 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -87,8 +87,7 @@ class AccountStatementProfil(Model): #Deprecated remove on V8 def prepare_statetement_lines_vals(self, *args, **kwargs): - return super(self, AccountStatementProfil).\ - prepare_statetement_lines_vals(*args, **kwargs) + return self.prepare_statement_lines_vals(*args, **kwargs) def prepare_statement_lines_vals( self, cr, uid, parser_vals, account_payable, account_receivable, From a08c8340a844abbb365f58cb14e3a33d48d89300 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 3 Feb 2014 10:25:07 +0100 Subject: [PATCH 082/114] [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 083/114] [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 b83af513536181d2a233ba0a410420e4d605c928 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 7 Feb 2014 13:45:52 +0100 Subject: [PATCH 084/114] [FIX] simplify code --- account_statement_one_move/statement.py | 47 ++++++++++++------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index af4c3d03..687fcbf7 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -129,12 +129,18 @@ class account_bank_statement(orm.Model): return True - def _prepare_transfer_move_line_vals(self, cr, uid, st, name, debit, credit, move_id, context=None): + 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, @@ -156,35 +162,28 @@ class account_bank_statement(orm.Model): 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 + refund -= move_line.debit payment += move_line.credit #Create 2 Transfer lines or One global tranfer line - refund_name = 'Refund Transfer' - payment_name = 'Payment Transfer' - if st.profile_id.split_transfer_line and refund != 0.0 and payment != 0.0: - refund_vals = self._prepare_transfer_move_line_vals(cr, uid, st, - refund_name, 0, refund, - move_id, context=context) - transfer_line_ids.append(move_line_obj.create(cr, uid, refund_vals, context=context)) - payment_vals = self._prepare_transfer_move_line_vals(cr, uid, st, - payment_name, payment, 0, - move_id, context=context) - transfer_line_ids.append(move_line_obj.create(cr, uid, payment_vals, context=context)) + if st.profile_id.split_transfer_line: + if refund: + transfer_lines.append(['Refund Transfer', refund]) + if payment: + transfer_lines.append(['Payment Transfer', payment]) else: - #The global transfer line can be a refund or a payment transfer - global_amount = abs(payment-refund) - if payment > refund: - vals = self._prepare_transfer_move_line_vals(cr, uid, st, - payment_name, - global_amount, 0, - move_id, context=context) - else: - vals = self._prepare_transfer_move_line_vals(cr, uid, st, - refund_name, 0, global_amount, - move_id, context=context) + 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 From 44b598805ee3c33d0de3cefffb5ea05a183f15c0 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 7 Feb 2014 13:48:29 +0100 Subject: [PATCH 085/114] [FIX] Fix compability with account_constraints --- account_statement_one_move/statement.py | 1 + 1 file changed, 1 insertion(+) diff --git a/account_statement_one_move/statement.py b/account_statement_one_move/statement.py index 5abf78c4..6540358d 100644 --- a/account_statement_one_move/statement.py +++ b/account_statement_one_move/statement.py @@ -66,6 +66,7 @@ class account_bank_statement(orm.Model): 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, From 96012530c03643f3ff26fbd441cf6e6cbbcda2f5 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 7 Feb 2014 15:56:14 +0100 Subject: [PATCH 086/114] [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 087/114] 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 From 3278d9990e8976c6657a19d0adb4e5fd7830364d Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 12 Feb 2014 15:50:40 +0100 Subject: [PATCH 088/114] [IMP] Allow to import xlsx files --- .../parser/file_parser.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/account_statement_base_import/parser/file_parser.py b/account_statement_base_import/parser/file_parser.py index 2f4fbdaf..125605f2 100644 --- a/account_statement_base_import/parser/file_parser.py +++ b/account_statement_base_import/parser/file_parser.py @@ -35,24 +35,24 @@ def float_or_zero(val): class FileParser(BankStatementImportParser): """ - Generic abstract class for defining parser for .csv or .xls file format. + 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 or xls) + :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'): - self.ftype = ftype + if ftype in ('csv', 'xls' ,'xlsx'): + self.ftype = ftype[0:3] else: raise except_osv(_('User Error'), - _('Invalid file type %s. Please use csv or xls') % ftype) + _('Invalid file type %s. Please use csv, xls or xlsx') % ftype) self.conversion_dict = { 'ref': unicode, 'label': unicode, @@ -81,7 +81,7 @@ class FileParser(BankStatementImportParser): def _parse(self, *args, **kwargs): """ - Launch the parsing through .csv or .xls depending on the + Launch the parsing through .csv, .xls or .xlsx depending on the given ftype """ @@ -128,7 +128,7 @@ class FileParser(BankStatementImportParser): def _parse_xls(self): """ - :return: dict of dict from xls file (line/rows) + :return: dict of dict from xls/xlsx file (line/rows) """ wb_file = tempfile.NamedTemporaryFile() wb_file.write(self.filebuffer) @@ -180,7 +180,7 @@ class FileParser(BankStatementImportParser): def _from_xls(self, result_set, conversion_rules): """ Handle the converstion from the dict and handle date format from - an .xls file. + an .csv, .xls or .xlsx file. """ for line in result_set: for rule in conversion_rules: From bb06a4b2aa53b92252a95f8cad9f9476b913fd33 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Sun, 16 Feb 2014 16:21:52 +0100 Subject: [PATCH 089/114] [FIX] search for name in the statement line label and no vice versa --- account_statement_base_completion/statement.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 0ab8e854..b4c717e8 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -319,7 +319,9 @@ class AccountStatementCompletionRule(orm.Model): if not context['partner_memoizer']: return res st_obj = self.pool.get('account.bank.statement.line') - sql = "SELECT id FROM res_partner WHERE name ~* %s and id in %s" + sql = """SELECT id FROM ( + SELECT id, regexp_matches(%s, name) AS name_match FROM res_partner) AS res_patner_matcher + WHERE name_match IS NOT NULL AND id IN %s """ pattern = ".*%s.*" % re.escape(st_line['name']) cr.execute(sql, (pattern, context['partner_memoizer'])) result = cr.fetchall() @@ -332,7 +334,7 @@ class AccountStatementCompletionRule(orm.Model): res['partner_id'] = result[0][0] st_vals = st_obj.get_values_for_line(cr, uid, - profile_id=st_line['porfile_id'], + profile_id=st_line['profile_id'], master_account_id=st_line['master_account_id'], partner_id=res['partner_id'], line_type=False, From 4e538950d71f31dc9a32d465a3424e5a0d2a3cba Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Sun, 16 Feb 2014 16:28:57 +0100 Subject: [PATCH 090/114] typo --- account_statement_base_completion/statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index b4c717e8..6c44517a 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -320,7 +320,7 @@ class AccountStatementCompletionRule(orm.Model): return res st_obj = self.pool.get('account.bank.statement.line') sql = """SELECT id FROM ( - SELECT id, regexp_matches(%s, name) AS name_match FROM res_partner) AS res_patner_matcher + SELECT id, regexp_matches(%s, name) AS name_match FROM res_partner) AS res_patner_matcher WHERE name_match IS NOT NULL AND id IN %s """ pattern = ".*%s.*" % re.escape(st_line['name']) cr.execute(sql, (pattern, context['partner_memoizer'])) From a440f845b93ff9a7caed9b629f6d50b89edb6dcf Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Sun, 16 Feb 2014 16:45:03 +0100 Subject: [PATCH 091/114] [FIX] lp:1280822 define a default value for import_type to avoid breaking tests of completions addons --- account_statement_base_import/statement.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 8da3c7b3..93b4997a 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -54,6 +54,10 @@ class AccountStatementProfil(Model): } + _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. From b290110758141639990b800dd20b69a24d05f458 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Sun, 16 Feb 2014 19:41:04 +0100 Subject: [PATCH 092/114] a little query optimization --- account_statement_base_completion/statement.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 6c44517a..965d977e 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -320,8 +320,9 @@ class AccountStatementCompletionRule(orm.Model): return res st_obj = self.pool.get('account.bank.statement.line') sql = """SELECT id FROM ( - SELECT id, regexp_matches(%s, name) AS name_match FROM res_partner) AS res_patner_matcher - WHERE name_match IS NOT NULL AND id IN %s """ + SELECT id, regexp_matches(%s, name) AS name_match FROM res_partner + WHERE id IN %s) AS res_patner_matcher + WHERE name_match IS NOT NULL""" pattern = ".*%s.*" % re.escape(st_line['name']) cr.execute(sql, (pattern, context['partner_memoizer'])) result = cr.fetchall() From 4f19caeb2009f9df6bc5a9f01fd590729bcb7eea Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (Acsone)" Date: Mon, 17 Feb 2014 18:24:03 +0100 Subject: [PATCH 093/114] [FIX] escape res_partner.name column as second arg of regexp_matches and keep the first one as unescaped. Add a lot of tests for completion based on the res_partner name --- account_statement_base_completion/__init__.py | 4 +- .../statement.py | 6 +- .../tests/__init__.py | 27 ++++++ .../tests/test_base_completion.py | 95 +++++++++++++++++++ 4 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 account_statement_base_completion/tests/__init__.py create mode 100644 account_statement_base_completion/tests/test_base_completion.py diff --git a/account_statement_base_completion/__init__.py b/account_statement_base_completion/__init__.py index 6c9ef1bc..a219be6a 100644 --- a/account_statement_base_completion/__init__.py +++ b/account_statement_base_completion/__init__.py @@ -19,5 +19,5 @@ # ############################################################################## -import statement -import partner +from . import partner +from . import statement diff --git a/account_statement_base_completion/statement.py b/account_statement_base_completion/statement.py index 965d977e..910234d9 100644 --- a/account_statement_base_completion/statement.py +++ b/account_statement_base_completion/statement.py @@ -319,12 +319,12 @@ class AccountStatementCompletionRule(orm.Model): 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, name) AS name_match FROM res_partner + 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""" - pattern = ".*%s.*" % re.escape(st_line['name']) - cr.execute(sql, (pattern, context['partner_memoizer'])) + cr.execute(sql, (st_line['name'], r"\\\1", context['partner_memoizer'])) result = cr.fetchall() if not result: return res diff --git a/account_statement_base_completion/tests/__init__.py b/account_statement_base_completion/tests/__init__.py new file mode 100644 index 00000000..6f9e09ea --- /dev/null +++ b/account_statement_base_completion/tests/__init__.py @@ -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 . +# +# + +from . import test_base_completion + +checks = [ + test_base_completion +] diff --git a/account_statement_base_completion/tests/test_base_completion.py b/account_statement_base_completion/tests/test_base_completion.py new file mode 100644 index 00000000..d9416eff --- /dev/null +++ b/account_statement_base_completion/tests/test_base_completion.py @@ -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 . +# +# +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)) From e80f498d67cf96ac49eda16849b6b2b6c108b7c7 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of banking-addons-team Date: Thu, 20 Feb 2014 05:47:21 +0000 Subject: [PATCH 094/114] Launchpad automatic translations update. --- account_statement_regex_account_completion/i18n/fr.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_regex_account_completion/i18n/fr.po b/account_statement_regex_account_completion/i18n/fr.po index 4d414f52..ab5e74f6 100644 --- a/account_statement_regex_account_completion/i18n/fr.po +++ b/account_statement_regex_account_completion/i18n/fr.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-02-10 05:56+0000\n" +"X-Launchpad-Export-Date: 2014-02-20 05:47+0000\n" "X-Generator: Launchpad (build 16916)\n" #. module: account_statement_regex_account_completion From 106294d36367d6aab319c974dba0e466bda250f4 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 21 Feb 2014 19:18:26 +0100 Subject: [PATCH 095/114] UPD account_advanced_reconcile_transaction_ref version --- account_advanced_reconcile_transaction_ref/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_advanced_reconcile_transaction_ref/__openerp__.py b/account_advanced_reconcile_transaction_ref/__openerp__.py index d806ba9e..bd1586cf 100644 --- a/account_advanced_reconcile_transaction_ref/__openerp__.py +++ b/account_advanced_reconcile_transaction_ref/__openerp__.py @@ -25,7 +25,7 @@ Advanced reconciliation method for the module account_easy_reconcile Reconcile rules with transaction_ref """, - 'version': '1.0', + 'version': '1.0.1', 'author': 'Camptocamp', 'category': 'Finance', 'website': 'http://www.camptocamp.com', From 0cedf1b84dc79d0f38bdce497f9664f85365ac8b Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 21 Feb 2014 19:19:17 +0100 Subject: [PATCH 096/114] UPD account_statement_base_completion version --- account_statement_base_completion/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py index d868a314..1ff18db7 100644 --- a/account_statement_base_completion/__openerp__.py +++ b/account_statement_base_completion/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## {'name': "Bank statement base completion", - 'version': '1.0', + 'version': '1.0.1', 'author': 'Camptocamp', 'maintainer': 'Camptocamp', 'category': 'Finance', From fc6032597b33960b15f8c292b935d37e035e373a Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 21 Feb 2014 19:19:53 +0100 Subject: [PATCH 097/114] UPD account_statement_base_import version --- account_statement_base_import/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_base_import/__openerp__.py b/account_statement_base_import/__openerp__.py index 086af048..59a5a338 100644 --- a/account_statement_base_import/__openerp__.py +++ b/account_statement_base_import/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## {'name': "Bank statement base import", - 'version': '1.0', + 'version': '1.0.1', 'author': 'Camptocamp', 'maintainer': 'Camptocamp', 'category': 'Finance', From 3875378fc9229d1107f1683854327e998269b618 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 21 Feb 2014 19:25:38 +0100 Subject: [PATCH 098/114] PEP8 on changes --- account_statement_ext/statement.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 48667715..4fa5b0df 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -202,7 +202,8 @@ class AccountBankStatement(Model): 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) + return super(AccountBankStatement, self + ).create(cr, uid, vals, context=context) def _get_period(self, cr, uid, date, context=None): """ @@ -243,8 +244,9 @@ class AccountBankStatement(Model): """ if context is None: context = {} - res = super(AccountBankStatement, self)._prepare_move( - cr, uid, st_line, st_line_number, context=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) @@ -297,10 +299,9 @@ class AccountBankStatement(Model): 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) + 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 @@ -530,8 +531,9 @@ class AccountBankStatement(Model): """ 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) + return super(AccountBankStatement, self + ).balance_check(cr, uid, st_id, journal_type, + context=context) else: return True @@ -684,11 +686,9 @@ class AccountBankStatementLine(Model): 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) + 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, From 25e916cdcbdd0d007f6c742dda30473357f39ae7 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 21 Feb 2014 19:26:17 +0100 Subject: [PATCH 099/114] UPD account_statement_ext version --- account_statement_ext/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index c6000063..32c518b9 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## {'name': "Bank statement extension and profiles", - 'version': '1.3.0', + 'version': '1.3.1', 'author': 'Camptocamp', 'maintainer': 'Camptocamp', 'category': 'Finance', From da6c89f9dc603f66e1d275582f4803a186c59c18 Mon Sep 17 00:00:00 2001 From: Sebastien Beau Date: Mon, 24 Feb 2014 14:05:38 +0100 Subject: [PATCH 100/114] [REF] add TODO comment for using python exception --- account_statement_base_import/statement.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 3964d77c..e8cc6596 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -212,6 +212,9 @@ class AccountStatementProfil(Model): 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"), From 51c76544454b4dcf0609eed95b6e2cdf36cc5960 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 24 Feb 2014 23:45:29 +0100 Subject: [PATCH 101/114] [FIX] account_statement_base_import: self reference calling method. --- account_statement_base_import/statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 3dbddd60..3ad5dbe4 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -36,7 +36,7 @@ class AccountStatementProfil(Model): return [('generic_csvxls_so', 'Generic .csv/.xls based on SO Name')] def _get_import_type_selection(self, cr, uid, context=None): - return get_import_type selection(cr, uid, context=context) + return self.get_import_type_selection(cr, uid, context=context) _columns = { 'launch_import_completion': fields.boolean( From ba824ca100af6ea5f8828bca610a8e09794e2e98 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 26 Feb 2014 11:23:37 +0100 Subject: [PATCH 102/114] the sample is insufficient to guess the delimiters on some files --- account_statement_base_import/parser/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 39d4d313..cda1b539 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -25,7 +25,7 @@ import csv def UnicodeDictReader(utf8_data, **kwargs): sniffer = csv.Sniffer() pos = utf8_data.tell() - sample_data = utf8_data.read(1024) + 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) From 512fd89093b5fb1b0c8f0ca22fbd662707bd4230 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 26 Feb 2014 12:02:40 +0100 Subject: [PATCH 103/114] restore default values to prevent regression introduced in pedro.baeza@serviciosbaeza.com-20140202105840-ndjvkvas1y82pxlw --- account_statement_base_import/parser/parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 39d4d313..83fe9bd0 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -20,6 +20,7 @@ ############################################################################## import base64 import csv +from datetime import datetime def UnicodeDictReader(utf8_data, **kwargs): @@ -121,10 +122,10 @@ class BankStatementImportParser(object): :return: dict of vals that represent additional infos for the statement """ return { - 'name': self.statement_name, + 'name': self.statement_name or '/', 'balance_start': self.balance_start, 'balance_end_real': self.balance_end, - 'date': self.statement_date + 'date': self.statement_date or datetime.now() } def get_st_line_vals(self, line, *args, **kwargs): From c17afe17b1795332c979e5ed7dd8953713673afa Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of banking-addons-team Date: Sat, 1 Mar 2014 05:55:31 +0000 Subject: [PATCH 104/114] 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 ab5e74f6..b2bdf2a0 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-02-20 05:47+0000\n" -"X-Generator: Launchpad (build 16916)\n" +"X-Launchpad-Export-Date: 2014-03-01 05:55+0000\n" +"X-Generator: Launchpad (build 16948)\n" #. module: account_statement_regex_account_completion #: field:account.statement.completion.rule,regex:0 From 2c763f77ebee70e5e961b5d282171d899edf644f Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 6 Mar 2014 17:39:02 +0100 Subject: [PATCH 105/114] [fix] account_statement_ext: trigger for a related field --- account_statement_ext/__openerp__.py | 2 +- account_statement_ext/statement.py | 23 ++++++--- .../test/test_balance_check.yml | 50 +++++++++++++++++++ 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 account_statement_ext/test/test_balance_check.yml diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index 0eb73d8d..a5e98cef 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -79,7 +79,7 @@ 'security/ir.model.access.csv', 'security/ir_rule.xml'], 'demo_xml': [], - 'test': [], + 'test': ['test/test_balance_check.yml'], 'installable': True, 'images': [], 'auto_install': False, diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 2cbd9e8f..bf65ddaf 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -159,6 +159,13 @@ class AccountBankStatement(Model): return profile_ids[0] if profile_ids else False + def _get_statement_from_profile(self, cr, uid, profile_ids, context=None): + """Weirdness warning! self is another class.""" + triggered = [] + for profile in self.browse(cr, uid, profile_ids, context=context): + triggered += [st.id for st in profile.bank_statement_ids] + return triggered + _columns = { 'profile_id': fields.many2one( 'account.statement.profile', @@ -174,12 +181,16 @@ class AccountBankStatement(Model): store=True, readonly=True), 'balance_check': fields.related( - 'profile_id', - 'balance_check', - type='boolean', - string='Balance check', - store=True, - readonly=True), + 'profile_id', + 'balance_check', + type='boolean', + string='Balance check', + store={ + 'account.statement.profile': ( + _get_statement_from_profile, ['balance_check'], 10), + }, + readonly=True + ), 'journal_id': fields.related( 'profile_id', 'journal_id', diff --git a/account_statement_ext/test/test_balance_check.yml b/account_statement_ext/test/test_balance_check.yml new file mode 100644 index 00000000..fdd4582e --- /dev/null +++ b/account_statement_ext/test/test_balance_check.yml @@ -0,0 +1,50 @@ +- + 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 +- + 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 + 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 balance_check of the statement is enabled. +- + !assert {model: account.bank.statement, id: statement_test1, string: We should check the balance}: + - balance_check is True +- + Now I set the 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 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: We should check the balance}: + - balance_check is True From 063812d7c4353bc21063f403902f893fd641cbfe Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Thu, 6 Mar 2014 18:14:44 +0100 Subject: [PATCH 106/114] [fix] other related fields found in the statement --- account_statement_ext/__openerp__.py | 2 +- account_statement_ext/statement.py | 40 ++++++---- .../test/test_balance_check.yml | 50 ------------ .../test/test_profile_related_fields.yml | 78 +++++++++++++++++++ 4 files changed, 105 insertions(+), 65 deletions(-) delete mode 100644 account_statement_ext/test/test_balance_check.yml create mode 100644 account_statement_ext/test/test_profile_related_fields.yml diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index a5e98cef..6b574701 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -79,7 +79,7 @@ 'security/ir.model.access.csv', 'security/ir_rule.xml'], 'demo_xml': [], - 'test': ['test/test_balance_check.yml'], + 'test': ['test/test_profile_related_fields.yml'], 'installable': True, 'images': [], 'auto_install': False, diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index bf65ddaf..7d4d0f51 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -166,6 +166,9 @@ class AccountBankStatement(Model): 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', @@ -173,32 +176,41 @@ class AccountBankStatement(Model): required=True, states={'draft': [('readonly', False)]}), 'credit_partner_id': fields.related( - 'profile_id', - 'partner_id', - type='many2one', - relation='res.partner', - string='Financial Partner', - store=True, - readonly=True), + '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=True, - readonly=True), + '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', diff --git a/account_statement_ext/test/test_balance_check.yml b/account_statement_ext/test/test_balance_check.yml deleted file mode 100644 index fdd4582e..00000000 --- a/account_statement_ext/test/test_balance_check.yml +++ /dev/null @@ -1,50 +0,0 @@ -- - 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 -- - 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 - 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 balance_check of the statement is enabled. -- - !assert {model: account.bank.statement, id: statement_test1, string: We should check the balance}: - - balance_check is True -- - Now I set the 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 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: We should check the balance}: - - balance_check is True diff --git a/account_statement_ext/test/test_profile_related_fields.yml b/account_statement_ext/test/test_profile_related_fields.yml new file mode 100644 index 00000000..56c93e8f --- /dev/null +++ b/account_statement_ext/test/test_profile_related_fields.yml @@ -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') From fb9f6f4c32bedb2bf7865204b6fab53fdc06e7b5 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 7 Mar 2014 11:20:21 +0100 Subject: [PATCH 107/114] [imp] docstring for a function field trigger --- account_statement_ext/statement.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 7d4d0f51..faa98f58 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -160,7 +160,14 @@ class AccountBankStatement(Model): return profile_ids[0] if profile_ids else False def _get_statement_from_profile(self, cr, uid, profile_ids, context=None): - """Weirdness warning! self is another class.""" + """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] From b519b1046dce961b5d31afabb44f5720d10bbe0f Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of banking-addons-team Date: Fri, 14 Mar 2014 07:02:43 +0000 Subject: [PATCH 108/114] 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 b2bdf2a0..d8d96513 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-03-01 05:55+0000\n" -"X-Generator: Launchpad (build 16948)\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 From 496205218ff6a24c069ea311930b96865ba0c7ba Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 14 Mar 2014 11:48:30 +0100 Subject: [PATCH 109/114] [IMP] Add buttons to open unreconciled and partially reconciled items from a profile to easy the verification and controlling --- account_easy_reconcile/easy_reconcile.py | 53 +++++++++++++++++++++++ account_easy_reconcile/easy_reconcile.xml | 14 ++++-- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/account_easy_reconcile/easy_reconcile.py b/account_easy_reconcile/easy_reconcile.py index 7971895e..dfe74da7 100644 --- a/account_easy_reconcile/easy_reconcile.py +++ b/account_easy_reconcile/easy_reconcile.py @@ -22,6 +22,7 @@ from openerp.osv import fields, osv, orm from openerp.tools.translate import _ from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT +from openerp.tools.translate import _ class easy_reconcile_options(orm.AbstractModel): @@ -257,6 +258,58 @@ class account_easy_reconcile(orm.Model): _('Error'), _('There is no history of reconciled ' 'items on the task: %s.') % rec.name) + + def _open_move_line_list(sefl, cr, uid, move_line_ids, name, context=None): + 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_unreconcile(self, cr, uid, ids, context=None): + """ Open the view of move line with the unreconciled move lines + """ + + assert len(ids) == 1 , \ + "You can only open entries from one profile at a time" + + obj_move_line = self.pool.get('account.move.line') + res = {} + for task in self.browse(cr, uid, ids, context=context): + line_ids = obj_move_line.search( + cr, uid, + [('account_id', '=', task.account.id), + ('reconcile_id', '=', False), + ('reconcile_partial_id', '=', False)], + context=context) + + name = _('Unreconciled items') + return self._open_move_line_list(cr, uid, line_ids, name, context=context) + + def open_partial_reconcile(self, cr, uid, ids, context=None): + """ Open the view of move line with the unreconciled move lines + """ + + assert len(ids) == 1 , \ + "You can only open entries from one profile at a time" + + obj_move_line = self.pool.get('account.move.line') + res = {} + for task in self.browse(cr, uid, ids, context=context): + line_ids = obj_move_line.search( + cr, uid, + [('account_id', '=', task.account.id), + ('reconcile_id', '=', False), + ('reconcile_partial_id', '!=', False)], + context=context) + name = _('Partial reconciled items') + return self._open_move_line_list(cr, uid, line_ids, name, context=context) def last_history_reconcile(self, cr, uid, rec_id, context=None): """ Get the last history record for this reconciliation profile diff --git a/account_easy_reconcile/easy_reconcile.xml b/account_easy_reconcile/easy_reconcile.xml index 2696419a..56e12b2e 100644 --- a/account_easy_reconcile/easy_reconcile.xml +++ b/account_easy_reconcile/easy_reconcile.xml @@ -13,11 +13,9 @@