summaryrefslogtreecommitdiff
path: root/bin/addons/base/module/wizard/wizard_module_import.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/addons/base/module/wizard/wizard_module_import.py')
-rw-r--r--bin/addons/base/module/wizard/wizard_module_import.py120
1 files changed, 60 insertions, 60 deletions
diff --git a/bin/addons/base/module/wizard/wizard_module_import.py b/bin/addons/base/module/wizard/wizard_module_import.py
index d59c635cd30..394389dd68f 100644
--- a/bin/addons/base/module/wizard/wizard_module_import.py
+++ b/bin/addons/base/module/wizard/wizard_module_import.py
@@ -40,82 +40,82 @@ import base64
finish_form ='''<?xml version="1.0"?>
<form string="Module import">
- <label string="Module successfully imported !" colspan="4"/>
+ <label string="Module successfully imported !" colspan="4"/>
</form>
'''
ask_form ='''<?xml version="1.0"?>
<form string="Module import">
- <separator string="Module import" colspan="4"/>
- <label string="Please give your module .ZIP file to import." colspan="4"/>
- <field name="module_file"/>
+ <separator string="Module import" colspan="4"/>
+ <label string="Please give your module .ZIP file to import." colspan="4"/>
+ <field name="module_file"/>
</form>
'''
ask_fields = {
- 'module_file': {'string': 'Module .ZIP file', 'type': 'binary', 'required': True},
+ 'module_file': {'string': 'Module .ZIP file', 'type': 'binary', 'required': True},
}
class move_module_wizard(wizard.interface):
- def importzip(self, cr, uid, data, context):
- module_obj=pooler.get_pool(cr.dbname).get('ir.module.module')
- module_data = data['form']['module_file']
+ def importzip(self, cr, uid, data, context):
+ module_obj=pooler.get_pool(cr.dbname).get('ir.module.module')
+ module_data = data['form']['module_file']
- val =base64.decodestring(module_data)
- fp = StringIO.StringIO(val)
- fdata = zipfile.ZipFile(fp, 'r')
- fname = fdata.namelist()[0]
- module_name = os.path.split(fname)[0]
+ val =base64.decodestring(module_data)
+ fp = StringIO.StringIO(val)
+ fdata = zipfile.ZipFile(fp, 'r')
+ fname = fdata.namelist()[0]
+ module_name = os.path.split(fname)[0]
- ad = tools.config['addons_path']
+ ad = tools.config['addons_path']
- fname = os.path.join(ad,module_name+'.zip')
- try:
- fp = file(fname, 'wb')
- fp.write(val)
- fp.close()
- except IOError, e:
- raise wizard.except_wizard(_('Error !'), _('Can not create the module file: %s !') % (fname,) )
+ fname = os.path.join(ad,module_name+'.zip')
+ try:
+ fp = file(fname, 'wb')
+ fp.write(val)
+ fp.close()
+ except IOError, e:
+ raise wizard.except_wizard(_('Error !'), _('Can not create the module file: %s !') % (fname,) )
- pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid)
- return {'module_name': module_name}
+ pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid)
+ return {'module_name': module_name}
- def _action_module_open(self, cr, uid, data, context):
- return {
- 'domain': str([('name', '=', data['form']['module_name'])]),
- 'name': 'Module List',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'ir.module.module',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
+ def _action_module_open(self, cr, uid, data, context):
+ return {
+ 'domain': str([('name', '=', data['form']['module_name'])]),
+ 'name': 'Module List',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'ir.module.module',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window'
+ }
- states = {
- 'init': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': ask_form,
- 'fields': ask_fields,
- 'state': [
- ('end', 'Cancel', 'gtk-cancel'),
- ('import', 'Import module', 'gtk-ok', True)
- ]
- }
- },
- 'import': {
- 'actions': [importzip],
- 'result': {
- 'type':'form',
- 'arch':finish_form,
- 'fields':{},
- 'state':[('open_window','Close')]
- }
- },
- 'open_window': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_module_open, 'state':'end'}
- },
- }
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {
+ 'type': 'form',
+ 'arch': ask_form,
+ 'fields': ask_fields,
+ 'state': [
+ ('end', 'Cancel', 'gtk-cancel'),
+ ('import', 'Import module', 'gtk-ok', True)
+ ]
+ }
+ },
+ 'import': {
+ 'actions': [importzip],
+ 'result': {
+ 'type':'form',
+ 'arch':finish_form,
+ 'fields':{},
+ 'state':[('open_window','Close')]
+ }
+ },
+ 'open_window': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _action_module_open, 'state':'end'}
+ },
+ }
move_module_wizard('base.module.import')