[FIX] move unidecode imports to function scope

[ADD] missing newline
[DEL] migration script that never would be called
This commit is contained in:
Holger Brunn
2014-11-24 19:41:28 +01:00
parent 7a1c67e482
commit 28ee1da747
4 changed files with 4 additions and 36 deletions

View File

@@ -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'

View File

@@ -1 +1,2 @@
from . import model
from . import model

View File

@@ -1,33 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Akretion (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
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")

View File

@@ -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