From c7c6954df7d1932afe539a17c855cb87acec70b3 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 20 Mar 2015 11:48:55 +0100 Subject: [PATCH] [IMP] Backport from master at 04daefd2d101d90daf5782173b95f31f3bd9e1b6 --- account_bank_statement_import/__init__.py | 3 +- .../account_bank_statement_import.py | 9 +- .../account_bank_statement_import_view.xml | 2 +- .../static/description/icon_src.svg | 150 +++++++++--------- account_bank_statement_import_ofx/__init__.py | 3 +- .../__openerp__.py | 5 +- .../account_bank_statement_import_ofx.py | 7 +- .../tests/test_import_bank_statement.py | 6 +- account_bank_statement_import_qif/__init__.py | 1 - .../tests/test_import_bank_statement.py | 3 +- 10 files changed, 92 insertions(+), 97 deletions(-) diff --git a/account_bank_statement_import/__init__.py b/account_bank_statement_import/__init__.py index 70262b2..0882f8a 100644 --- a/account_bank_statement_import/__init__.py +++ b/account_bank_statement_import/__init__.py @@ -1,4 +1,3 @@ # -*- encoding: utf-8 -*- -from . import account_bank_statement_import -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +import account_bank_statement_import diff --git a/account_bank_statement_import/account_bank_statement_import.py b/account_bank_statement_import/account_bank_statement_import.py index 66c27df..37ff851 100644 --- a/account_bank_statement_import/account_bank_statement_import.py +++ b/account_bank_statement_import/account_bank_statement_import.py @@ -123,8 +123,9 @@ class account_bank_statement_import(osv.TransientModel): bank_account_id = None if account_number and len(account_number) > 4: account_number = account_number.replace(' ', '').replace('-', '') - cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') like %s and journal_id is not null", ('%' + account_number + '%',)) + cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (account_number,)) bank_account_ids = [id[0] for id in cr.fetchall()] + bank_account_ids = self.pool.get('res.partner.bank').search(cr, uid, [('id', 'in', bank_account_ids)], context=context) if bank_account_ids: bank_account_id = bank_account_ids[0] @@ -132,8 +133,6 @@ class account_bank_statement_import(osv.TransientModel): def _get_journal(self, cr, uid, currency_id, bank_account_id, account_number, context=None): """ Find or create the journal """ - if context is None: - context = {} bank_pool = self.pool.get('res.partner.bank') # Find the journal from context or bank account @@ -174,7 +173,7 @@ class account_bank_statement_import(osv.TransientModel): wmca_pool = self.pool.get('wizard.multi.charts.accounts') company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id - vals_account = {'currency_id': currency_id, 'acc_name': account_number, 'account_type': 'bank'} + vals_account = {'currency_id': currency_id, 'acc_name': account_number, 'account_type': 'bank', 'currency_id': currency_id} vals_account = wmca_pool._prepare_bank_account(cr, uid, company, vals_account, context=context) account_id = self.pool.get('account.account').create(cr, uid, vals_account, context=context) @@ -213,7 +212,7 @@ class account_bank_statement_import(osv.TransientModel): if unique_import_id: line_vals['unique_import_id'] = (account_number and account_number + '-' or '') + unique_import_id - if not line_vals.get('partner_id') and not line_vals.get('bank_account_id'): + if not 'bank_account_id' in line_vals or not line_vals['bank_account_id']: # Find the partner and his bank account or create the bank account. The partner selected during the # reconciliation process will be linked to the bank when the statement is closed. partner_id = False diff --git a/account_bank_statement_import/account_bank_statement_import_view.xml b/account_bank_statement_import/account_bank_statement_import_view.xml index 6df58c7..8fc98a4 100644 --- a/account_bank_statement_import/account_bank_statement_import_view.xml +++ b/account_bank_statement_import/account_bank_statement_import_view.xml @@ -23,7 +23,7 @@ - Import Bank Statement + Import ir.actions.act_window account.bank.statement.import form diff --git a/account_bank_statement_import/static/description/icon_src.svg b/account_bank_statement_import/static/description/icon_src.svg index 0443f56..664381e 100644 --- a/account_bank_statement_import/static/description/icon_src.svg +++ b/account_bank_statement_import/static/description/icon_src.svg @@ -14,14 +14,14 @@ viewBox="0 0 100 100" width="100px" xml:space="preserve" - inkscape:version="0.91 r" - sodipodi:docname="icon_src.svg" - inkscape:export-filename="icon.png" + inkscape:version="0.48.2 r9819" + sodipodi:docname="1409271720_Noun_Project_100Icon_10px_grid-17.svg" + inkscape:export-filename="/Users/arthurmaniet/Desktop/icon.png" inkscape:export-xdpi="115.2" inkscape:export-ydpi="115.2">image/svg+xml08/12/13 1000.00 Delta PC08/15/13 75.46 Walts Drugs03/03/13 379.00 Epic Technologies03/04/13 20.28 YOUR LOCAL SU03/03/13 421.35 SPRINGFIELD WA03/03/13 379.00 Epic Technologies03/04/13 20.28 YOUR LOCAL SUP08/15/13 75.46 Walts Drugs08/12/13 1000.00 Delta PC03/03/13 421.35 SPRINGFIELD WA03/04/13 20.28 YOUR LOCAL SU03/03/13 379.00 Epic Technologies08/12/13 1000.00 De a PC03/03/13 379.00 E Technologies08/15/13 75.46 Walts Drugs03/04/13 20.28 YOUR LOCAL SU03/03/13 379.00 Epic Technologies08/12/13 1000.00 Delta PC08/15/13 75.46 Walts Drugs