diff --git a/bin/addons/base/module/wizard/base_export_language.py b/bin/addons/base/module/wizard/base_export_language.py
index ca2e3059cfb..1b43b561ac3 100644
--- a/bin/addons/base/module/wizard/base_export_language.py
+++ b/bin/addons/base/module/wizard/base_export_language.py
@@ -68,6 +68,7 @@ class base_language_export(osv.osv_memory):
return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice, 'name':this.name}, context=context)
_name = "base.language.export"
+ _inherit = "ir.wizard.screen"
_columns = {
'name': fields.char('Filename', 16, readonly=True),
'lang': fields.selection(_get_languages, 'Language', help='To export a new language, do not select a language.'), # not required: unset = new language
@@ -78,11 +79,11 @@ class base_language_export(osv.osv_memory):
'state': fields.selection( ( ('choose','choose'), # choose language
('get','get'), # get the file
) ),
- }
- _defaults = { 'state': lambda *a: 'choose',
- 'name': lambda *a: 'lang.tar.gz'
- }
+ }
+ _defaults = {
+ 'state': lambda *a: 'choose',
+ 'name': lambda *a: 'lang.tar.gz'
+ }
base_language_export()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/bin/addons/base/module/wizard/base_export_language_view.xml b/bin/addons/base/module/wizard/base_export_language_view.xml
index 07c5a34f0da..c908c5ce03a 100644
--- a/bin/addons/base/module/wizard/base_export_language_view.xml
+++ b/bin/addons/base/module/wizard/base_export_language_view.xml
@@ -3,48 +3,50 @@
- Export Translation
+ Export Translations
base.language.export
form
-
diff --git a/bin/addons/base/module/wizard/base_import_language.py b/bin/addons/base/module/wizard/base_import_language.py
index ca45c0a6c1c..6608ade03ef 100644
--- a/bin/addons/base/module/wizard/base_import_language.py
+++ b/bin/addons/base/module/wizard/base_import_language.py
@@ -21,7 +21,6 @@
import tools
import base64
-import pooler
from tempfile import TemporaryFile
from osv import osv, fields
@@ -30,6 +29,7 @@ class base_language_import(osv.osv_memory):
_name = "base.language.import"
_description = "Language Import"
+ _inherit = "ir.wizard.screen"
_columns = {
'name': fields.char('Language Name',size=64 , required=True),
diff --git a/bin/addons/base/module/wizard/base_import_language_view.xml b/bin/addons/base/module/wizard/base_import_language_view.xml
index 70a48850448..c7cdac663b5 100644
--- a/bin/addons/base/module/wizard/base_import_language_view.xml
+++ b/bin/addons/base/module/wizard/base_import_language_view.xml
@@ -7,35 +7,33 @@
base.language.import
form
-
+
diff --git a/bin/addons/base/module/wizard/base_language_install.py b/bin/addons/base/module/wizard/base_language_install.py
index 140cc4cc033..7a3b8cc75aa 100644
--- a/bin/addons/base/module/wizard/base_language_install.py
+++ b/bin/addons/base/module/wizard/base_language_install.py
@@ -20,17 +20,22 @@
##############################################################################
import tools
-import pooler
from osv import osv, fields
class base_language_install(osv.osv_memory):
""" Install Language"""
_name = "base.language.install"
+ _inherit = "ir.wizard.screen"
_description = "Install Language"
_columns = {
- 'lang': fields.selection(tools.scan_languages(),'Language'),
+ 'lang': fields.selection(tools.scan_languages(),'Language', required=True),
+ 'state':fields.selection([('init','init'),('done','done')], 'state', readonly=True),
+ }
+
+ _defaults = {
+ 'state': 'init',
}
def lang_install(self, cr, uid, ids, context):
@@ -40,30 +45,9 @@ class base_language_install(osv.osv_memory):
modobj = self.pool.get('ir.module.module')
mids = modobj.search(cr, uid, [('state', '=', 'installed')])
modobj.update_translations(cr, uid, mids, lang)
-
- data_obj = self.pool.get('ir.model.data')
- id2 = data_obj._get_id(cr, uid, 'base', 'view_base_language_install_msg')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
-
- return {
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'base.module.import.msg',
- 'views': [(id2, 'form')],
- 'view_id': False,
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
+ self.write(cr, uid, ids, {'state': 'done'}, context=context)
+ return False
base_language_install()
-class base_language_install_msg(osv.osv_memory):
- """ Install Language"""
-
- _name = "base.language.install.msg"
- _description = "Install Language"
-
-base_language_install_msg()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/bin/addons/base/module/wizard/base_language_install_view.xml b/bin/addons/base/module/wizard/base_language_install_view.xml
index 3d9f4eabe3b..38edf4d4a82 100644
--- a/bin/addons/base/module/wizard/base_language_install_view.xml
+++ b/bin/addons/base/module/wizard/base_language_install_view.xml
@@ -8,13 +8,38 @@
form
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -33,29 +58,6 @@
action="action_view_base_language_install"
id="menu_view_base_language_install"
parent="menu_translation" sequence="2"/>
-
-
- Official Translation Loaded
- base.module.import.msg
- form
-
-
-
-
-
-
-
-
-
-
-
- Official Translation Loaded
- base.module.import.msg
- form
- form
-
- new
-
diff --git a/bin/addons/base/module/wizard/base_module_import.py b/bin/addons/base/module/wizard/base_module_import.py
index 990a77ce8cd..68822690f45 100644
--- a/bin/addons/base/module/wizard/base_module_import.py
+++ b/bin/addons/base/module/wizard/base_module_import.py
@@ -19,8 +19,6 @@
#
##############################################################################
-
-import pooler
import os
import tools
@@ -34,19 +32,24 @@ class base_module_import(osv.osv_memory):
""" Import Module """
_name = "base.module.import"
+ _inherit = "ir.wizard.screen"
_description = "Import Module"
_columns = {
'module_file': fields.binary('Module .ZIP file', required=True),
+ 'state':fields.selection([('init','init'),('done','done')], 'state', readonly=True),
+ 'module_name': fields.char('Module Name', size=128),
+ }
+
+ _defaults = {
+ 'state': 'init',
}
def importzip(self, cr, uid, ids, context):
- module_obj= self.pool.get('ir.module.module')
- active_ids = context and context.get('active_ids', False)
- data = self.browse(cr, uid, ids , context=context)[0]
+ (data,) = self.browse(cr, uid, ids , context=context)
module_data = data.module_file
- val =base64.decodestring(module_data)
+ val = base64.decodestring(module_data)
fp = StringIO()
fp.write(val)
fdata = zipfile.ZipFile(fp, 'r')
@@ -55,62 +58,30 @@ class base_module_import(osv.osv_memory):
ad = tools.config['addons_path']
- fname = os.path.join(ad,module_name+'.zip')
+ fname = os.path.join(ad, module_name+'.zip')
try:
fp = file(fname, 'wb')
fp.write(val)
fp.close()
- except IOError, e:
+ except IOError:
raise osv.except_osv(_('Error !'), _('Can not create the module file: %s !') % (fname,) )
- module_obj.update_list(cr, uid,{'module_name': module_name,})
- data_obj = self.pool.get('ir.model.data')
- id2 = data_obj._get_id(cr, uid, 'base', 'view_base_module_import_msg')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
-
- module_name = module_obj.browse(cr, uid, ids, context=context)
- return {
- 'domain': str([('name', '=', module_name)]),
- 'name': 'Message',
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'base.module.import.msg',
- 'views': [(id2, 'form')],
- 'view_id': False,
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
-
-base_module_import()
-
-class base_module_import_msg(osv.osv_memory):
- """ message """
- _name = "base.module.import.msg"
- _description = "Message"
+ self.pool.get('ir.module.module').update_list(cr, uid, {'module_name': module_name,})
+ self.write(cr, uid, ids, {'state':'done', 'module_name': module_name}, context)
+ return False
def action_module_open(self, cr, uid, ids, context):
- module_obj = self.pool.get('base.module.import')
- data = module_obj.browse(cr, uid, ids , context=context)[0]
- module_data = data.module_file
-
- val =base64.decodestring(module_data)
- fp = StringIO()
- fp.write(val)
- fdata = zipfile.ZipFile(fp, 'r')
- fname = fdata.namelist()[0]
- module_name = os.path.split(fname)[0]
-
+ (data,) = self.browse(cr, uid, ids , context=context)
return {
- 'domain': str([('name', '=', module_name)]),
- 'name': 'Module List',
+ 'domain': str([('name', '=', data.module_name)]),
+ 'name': 'Modules',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'ir.module.module',
'type': 'ir.actions.act_window',
}
-base_module_import_msg()
+base_module_import()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/bin/addons/base/module/wizard/base_module_import_view.xml b/bin/addons/base/module/wizard/base_module_import_view.xml
index 9d1aa1bce49..b04bc050e97 100644
--- a/bin/addons/base/module/wizard/base_module_import_view.xml
+++ b/bin/addons/base/module/wizard/base_module_import_view.xml
@@ -7,17 +7,41 @@
base.module.import
form
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -31,36 +55,12 @@
+ name="Import Module"
+ action="action_view_base_module_import"
+ id="menu_view_base_module_import"
+ parent="menu_management"
+ sequence="1"/>
-
- Module Import Message
- base.module.import.msg
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
- Module Import Message
- base.module.import.msg
- form
- form
-
- new
-
diff --git a/bin/addons/base/module/wizard/base_module_scan.py b/bin/addons/base/module/wizard/base_module_scan.py
index cd8d4ab7ec5..d47e091955f 100644
--- a/bin/addons/base/module/wizard/base_module_scan.py
+++ b/bin/addons/base/module/wizard/base_module_scan.py
@@ -19,16 +19,13 @@
#
##############################################################################
import os
-import re
import glob
-import time
import imp
import tools
-import pooler
import zipfile
-from osv import osv, fields
+from osv import osv
class base_module_scan(osv.osv_memory):
""" scan module """
diff --git a/bin/addons/base/module/wizard/base_module_update.py b/bin/addons/base/module/wizard/base_module_update.py
index eea5f5aaee4..a0d21840d90 100644
--- a/bin/addons/base/module/wizard/base_module_update.py
+++ b/bin/addons/base/module/wizard/base_module_update.py
@@ -18,8 +18,6 @@
# along with this program. If not, see .
#
##############################################################################
-import netsvc
-import pooler
from osv import osv, fields
class base_module_update(osv.osv_memory):
@@ -27,69 +25,25 @@ class base_module_update(osv.osv_memory):
_name = "base.module.update"
_description = "Update Module"
-
- def update_module(self, cr, uid, ids, context):
- """
- Update Module
-
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: the ID or list of IDs
- @param context: A standard dictionary
- """
- data_obj = self.pool.get('ir.model.data')
- id2 = data_obj._get_id(cr, uid, 'base', 'view_base_module_update_open')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
-
- return {
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'base.module.update.open',
- 'views': [(id2, 'form')],
- 'view_id': False,
- 'type': 'ir.actions.act_window',
- 'target': 'new',
-
- }
-
-base_module_update()
-
-class base_module_update_open(osv.osv_memory):
- """ Update Module Open """
-
- _name = "base.module.update.open"
- _description = "Update Module Open"
-
- def default_get(self, cr, uid, fields, context=None):
- """
- This function gets default values
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param fields: List of fields for default value
- @param context: A standard dictionary for contextual values
- @return : default values of fields.
- """
-
- module_obj = self.pool.get('ir.module.module')
- update, add = module_obj.update_list(cr, uid,)
- return {'update': update, 'add': add}
+ _inherit = "ir.wizard.screen"
_columns = {
- 'update': fields.integer('Number of modules updated', readonly=True),
- 'add': fields.integer('Number of modules added', readonly=True),
+ 'update': fields.integer('Number of modules updated', readonly=True),
+ 'add': fields.integer('Number of modules added', readonly=True),
+ 'state':fields.selection([('init','init'),('done','done')], 'state', readonly=True),
}
- def action_module_open(self, cr, uid, ids, context):
- """
- Update Module List Open
+ _defaults = {
+ 'state': 'init',
+ }
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: the ID or list of IDs
- @param context: A standard dictionary
- """
+ def update_module(self, cr, uid, ids, context=None):
+ module_obj = self.pool.get('ir.module.module')
+ update, add = module_obj.update_list(cr, uid,)
+ self.write(cr, uid, ids, {'update': update, 'add': add, 'state': 'done'}, context=context)
+ return False
+
+ def action_module_open(self, cr, uid, ids, context):
res = {
'domain': str([]),
'name': 'Modules',
@@ -99,13 +53,9 @@ class base_module_update_open(osv.osv_memory):
'view_id': False,
'type': 'ir.actions.act_window',
}
- view_obj = self.pool.get('ir.ui.view')
- search_view_id = view_obj.search(cr, uid, [('name','=','ir.module.module.list.select')], context=context)
- if search_view_id:
- res.update({'search_view_id' : search_view_id[0]})
return res
-base_module_update_open()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+base_module_update()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/bin/addons/base/module/wizard/base_module_update_view.xml b/bin/addons/base/module/wizard/base_module_update_view.xml
index 9091b5a1b9d..21bff3fb935 100644
--- a/bin/addons/base/module/wizard/base_module_update_view.xml
+++ b/bin/addons/base/module/wizard/base_module_update_view.xml
@@ -7,15 +7,41 @@
base.module.update
form
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -36,33 +62,5 @@
sequence="2"
icon="STOCK_CONVERT"/>
-
- Update ModuleList
- base.module.update.open
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Update ModuleList
- ir.actions.act_window
- base.module.update.open
- form
- form
-
- new
-
-
\ No newline at end of file
diff --git a/bin/addons/base/module/wizard/base_module_upgrade.py b/bin/addons/base/module/wizard/base_module_upgrade.py
index 79ec7c80997..4db4028bdb0 100644
--- a/bin/addons/base/module/wizard/base_module_upgrade.py
+++ b/bin/addons/base/module/wizard/base_module_upgrade.py
@@ -20,8 +20,6 @@
##############################################################################
import pooler
-import os
-import tools
from osv import osv, fields
class base_module_upgrade(osv.osv_memory):
@@ -98,7 +96,7 @@ class base_module_upgrade(osv.osv_memory):
raise osv.except_osv('Unmet dependency !', 'Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages))
mod_obj.download(cr, uid, ids, context=context)
cr.commit()
- db, pool = pooler.restart_pool(cr.dbname, update_module=True)
+ _, pool = pooler.restart_pool(cr.dbname, update_module=True)
id2 = data_obj._get_id(cr, uid, 'base', 'view_base_module_upgrade_install')
if id2:
diff --git a/bin/addons/base/module/wizard/base_update_translations.py b/bin/addons/base/module/wizard/base_update_translations.py
index cc7a3361a29..94cb0ee2e18 100644
--- a/bin/addons/base/module/wizard/base_update_translations.py
+++ b/bin/addons/base/module/wizard/base_update_translations.py
@@ -35,7 +35,7 @@ class base_update_translations(osv.osv_memory):
lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
ids=lang_obj.search(cr, uid, [('code', '=', lang_code)])
if not ids:
- raise osv.orm_except('Bad lang')
+ raise osv.except_osv(_('No language with code "%s" exists') % lang_code)
lang = lang_obj.browse(cr, uid, ids[0])
return lang.name
def act_cancel(self, cr, uid, ids, context=None):
@@ -51,14 +51,17 @@ class base_update_translations(osv.osv_memory):
return {'type': 'ir.actions.act_window_close'}
def default_get(self, cr, uid, fields, context=None):
- lang_obj = self.pool.get('res.lang')
+ res = super(base_update_translations, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
- lang=lang_obj.browse(cr,uid,record_id).code
- return {'lang':lang}
+ if record_id:
+ lang = self.pool.get('res.lang').browse(cr, uid, record_id).code
+ res.update(lang=lang)
+ return res
_name = 'base.update.translations'
+ _inherit = "ir.wizard.screen"
_columns = {
'lang': fields.selection(_get_languages, 'Language', required=True),
}
-base_update_translations()
+base_update_translations()
\ No newline at end of file
diff --git a/bin/addons/base/module/wizard/base_update_translations_view.xml b/bin/addons/base/module/wizard/base_update_translations_view.xml
index 781f3d142d8..60d30440ca1 100644
--- a/bin/addons/base/module/wizard/base_update_translations_view.xml
+++ b/bin/addons/base/module/wizard/base_update_translations_view.xml
@@ -2,23 +2,34 @@
- Update Translations
+ Synchronize Translations
base.update.translations
form
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Resynchronise Terms
+ Synchronize Translations
ir.actions.act_window
base.update.translations
form
diff --git a/bin/addons/base/res/res_config.py b/bin/addons/base/res/res_config.py
index f94c4fbeaa6..47667a5ba81 100644
--- a/bin/addons/base/res/res_config.py
+++ b/bin/addons/base/res/res_config.py
@@ -19,19 +19,14 @@
#
##############################################################################
-import os
-import base64
-import random
from operator import attrgetter
from osv import osv, fields
-import tools
from tools.translate import _
import netsvc
import pooler
-
class res_config_configurable(osv.osv_memory):
''' Base classes for new-style configuration items
@@ -40,6 +35,7 @@ class res_config_configurable(osv.osv_memory):
their view inherit from the related res_config_view_base view.
'''
_name = 'res.config'
+ _inherit = 'ir.wizard.screen'
logger = netsvc.Logger()
def get_current_progress(self, cr, uid, context=None):
@@ -57,20 +53,13 @@ class res_config_configurable(osv.osv_memory):
return round(closed*100./total)
return 100.
- def _get_image(self, cr, uid, context=None):
- file_no = str(random.randint(1,3))
- path = os.path.join('base','res','config_pixmaps/%s.png'%file_no)
- file_data = tools.file_open(path,'rb').read()
- return base64.encodestring(file_data)
-
_columns = dict(
progress = fields.float('Configuration Progress', readonly=True),
- config_logo = fields.binary('Image', readonly=True),
- )
+ )
+
_defaults = dict(
progress = _progress,
- config_logo = _get_image
- )
+ )
def _next_action(self, cr, uid, context=None):
todos = self.pool.get('ir.actions.todo')