From 28ee1da747c4b7c23edf8280e5e8fb72060c1039 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 24 Nov 2014 19:41:28 +0100 Subject: [PATCH] [FIX] move unidecode imports to function scope [ADD] missing newline [DEL] migration script that never would be called --- .../banking_export_pain.py | 2 +- account_banking_payment_export/__init__.py | 3 +- .../migrations/7.0.0.1.165/pre-migration.py | 33 ------------------- .../account_banking_sdd.py | 2 +- 4 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py diff --git a/account_banking_pain_base/banking_export_pain.py b/account_banking_pain_base/banking_export_pain.py index 279dc5f5a..211b70f2b 100644 --- a/account_banking_pain_base/banking_export_pain.py +++ b/account_banking_pain_base/banking_export_pain.py @@ -24,7 +24,6 @@ from openerp.osv import orm from openerp.tools.translate import _ from openerp.tools.safe_eval import safe_eval from datetime import datetime -from unidecode import unidecode from lxml import etree from openerp import tools import logging @@ -50,6 +49,7 @@ class banking_export_pain(orm.AbstractModel): self, cr, uid, field_name, field_value, eval_ctx, max_size=0, gen_args=None, context=None): '''This function is designed to be inherited !''' + from unidecode import unidecode if gen_args is None: gen_args = {} assert isinstance(eval_ctx, dict), 'eval_ctx must contain a dict' diff --git a/account_banking_payment_export/__init__.py b/account_banking_payment_export/__init__.py index 36ec7207a..833a0ba11 100644 --- a/account_banking_payment_export/__init__.py +++ b/account_banking_payment_export/__init__.py @@ -1 +1,2 @@ -from . import model \ No newline at end of file +from . import model + diff --git a/account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py b/account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py deleted file mode 100644 index a420f05fd..000000000 --- a/account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2014 Akretion (http://www.akretion.com/) -# @author: Alexis de Lattre -# -# 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 . -# -############################################################################## - - -def migrate(cr, version): - if not version: - return - cr.execute( - "UPDATE payment_line SET communication = communication2, " - "communication2 = null " - "FROM payment_order " - "WHERE payment_line.order_id = payment_order.id " - "AND payment_order.state in ('draft', 'open') " - "AND payment_line.state = 'normal' " - "AND communication2 is not null") diff --git a/account_banking_sepa_direct_debit/account_banking_sdd.py b/account_banking_sepa_direct_debit/account_banking_sdd.py index 87e50111b..25cd41f68 100644 --- a/account_banking_sepa_direct_debit/account_banking_sdd.py +++ b/account_banking_sepa_direct_debit/account_banking_sdd.py @@ -23,7 +23,6 @@ from openerp.osv import orm, fields from openerp.tools.translate import _ from openerp.addons.decimal_precision import decimal_precision as dp -from unidecode import unidecode from datetime import datetime from dateutil.relativedelta import relativedelta import logging @@ -40,6 +39,7 @@ class banking_export_sdd(orm.Model): _rec_name = 'filename' def _generate_filename(self, cr, uid, ids, name, arg, context=None): + from unidecode import unidecode res = {} for sepa_file in self.browse(cr, uid, ids, context=context): ref = sepa_file.payment_order_ids[0].reference