@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Base Phone module for OpenERP
# Copyright (C) 2012-2014 Alexis de Lattre <alexis@via.ecp.fr>
# Base Phone module for Odoo
# Copyright (C) 2012-2015 Alexis de Lattre <alexis@via.ecp.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -19,20 +19,23 @@
#
##############################################################################
from openerp.osv import orm , fields
from openerp import models , fields
import logging
logger = logging . getLogger ( __name__ )
class reformat_all_phonenumbers ( orm . TransientModel ) :
class reformat_all_phonenumbers ( models . TransientModel ) :
_name = " reformat.all.phonenumbers "
_inherit = " res.config.installer "
_description = " Reformat all phone numbers "
_columns = {
' phonenumbers_not_reformatted ' : fields . text (
" Phone numbers that couldn ' t be reformatted " ) ,
}
phonenumbers_not_reformatted = fields . Text (
string = " Phone numbers that couldn ' t be reformatted " )
state = fields . Selection ( [
( ' draft ' , ' Draft ' ) ,
( ' done ' , ' Done ' ) ,
] , string = ' State ' , default = ' draft ' )
def run_reformat_all_phonenumbers ( self , cr , uid , ids , context = None ) :
logger . info ( ' Starting to reformat all the phone numbers ' )
@ -95,9 +98,10 @@ class reformat_all_phonenumbers(orm.TransientModel):
phonenumbers_not_reformatted = \
' All phone numbers have been reformatted successfully. '
self . write (
cr , uid , ids [ 0 ] ,
{ ' phonenumbers_not_reformatted ' : phonenumbers_not_reformatted } ,
context = context )
cr , uid , ids [ 0 ] , {
' phonenumbers_not_reformatted ' : phonenumbers_not_reformatted ,
' state ' : ' done ' ,
} , context = context )
logger . info ( ' End of the phone number reformatting wizard ' )
action = self . pool [ ' ir.actions.act_window ' ] . for_xml_id (
cr , uid , ' base_phone ' , ' reformat_all_phonenumbers_action ' ,