diff --git a/bin/addons/base/__openerp__.py b/bin/addons/base/__openerp__.py
index 09e5fc23ace..11632498e20 100644
--- a/bin/addons/base/__openerp__.py
+++ b/bin/addons/base/__openerp__.py
@@ -49,6 +49,7 @@
'module/module_data.xml',
'module/module_report.xml',
'module/wizard/base_module_import_view.xml',
+ 'module/wizard/base_module_update_view.xml',
'res/res_request_view.xml',
'res/res_lang_view.xml',
'res/res_log_view.xml',
diff --git a/bin/addons/base/module/module_wizard.xml b/bin/addons/base/module/module_wizard.xml
index b7653eb30d9..c8d4ce5d54b 100644
--- a/bin/addons/base/module/module_wizard.xml
+++ b/bin/addons/base/module/module_wizard.xml
@@ -5,7 +5,7 @@
Update Modules List
module.module.update
-
+
diff --git a/bin/addons/base/module/wizard/__init__.py b/bin/addons/base/module/wizard/__init__.py
index 69215e90c8c..c6b34de2936 100644
--- a/bin/addons/base/module/wizard/__init__.py
+++ b/bin/addons/base/module/wizard/__init__.py
@@ -19,7 +19,7 @@
#
##############################################################################
-import wizard_update_module
+import wizard_update_module # base_module_update
import wizard_module_upgrade
import wizard_configuration
import wizard_module_lang_install
@@ -29,6 +29,7 @@ import wizard_import_lang
import wizard_update_translations
import base_module_import
+import base_module_update
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/addons/base/module/wizard/base_module_import.py b/bin/addons/base/module/wizard/base_module_import.py
index fc28452c6dd..cd916482279 100644
--- a/bin/addons/base/module/wizard/base_module_import.py
+++ b/bin/addons/base/module/wizard/base_module_import.py
@@ -40,6 +40,55 @@ class base_module_import(osv.osv_memory):
'module_file': fields.binary('Module .ZIP file', required=True),
}
+ 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]
+ 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]
+
+ 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 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"
+
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]
@@ -61,5 +110,5 @@ class base_module_import(osv.osv_memory):
'type': 'ir.actions.act_window',
}
-base_module_import()
+base_module_import_msg()
\ 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 818a7317c61..f46c7ebf293 100644
--- a/bin/addons/base/module/wizard/base_module_import_view.xml
+++ b/bin/addons/base/module/wizard/base_module_import_view.xml
@@ -15,7 +15,7 @@
-
+
@@ -37,6 +37,30 @@
parent="menu_management"
sequence="1"/>
+
+ Module Import Message
+ base.module.import.msg
+ form
+
+
+
+
+
+ Module Import Message
+ base.module.import.msg
+ form
+ form
+
+ new
+
-
\ No newline at end of file
+
+
diff --git a/bin/addons/base/module/wizard/base_module_update.py b/bin/addons/base/module/wizard/base_module_update.py
new file mode 100644
index 00000000000..e6ad24cbbdf
--- /dev/null
+++ b/bin/addons/base/module/wizard/base_module_update.py
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+import netsvc
+import pooler
+from osv import osv, fields
+
+class base_module_update(osv.osv_memory):
+ """ Update Module """
+
+ _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}
+
+ _columns = {
+ 'update': fields.integer('Number of modules updated', readonly=True),
+ 'add': fields.integer('Number of modules added', readonly=True),
+ }
+
+ def action_module_open(self, cr, uid, ids, context):
+ """
+ Update Module List Open
+
+ @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
+ """
+ res = {
+ 'domain': str([]),
+ 'name': 'Module List',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'ir.module.module',
+ '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()
\ 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
new file mode 100644
index 00000000000..5dad4bbd037
--- /dev/null
+++ b/bin/addons/base/module/wizard/base_module_update_view.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+ Module Update
+ base.module.update
+ form
+
+
+
+
+
+
+ Module Update
+ ir.actions.act_window
+ base.module.update
+ form
+ form
+ new
+
+
+
+
+
+ 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/wizard_update_module.py b/bin/addons/base/module/wizard/wizard_update_module.py
deleted file mode 100644
index 22e52bb6d6d..00000000000
--- a/bin/addons/base/module/wizard/wizard_update_module.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import pooler
-
-class wizard_update_module(wizard.interface):
-
- arch = '''
- '''
- fields = {
-
- }
-
- arch_module = '''
- '''
-
- fields_module = {
- 'update': {'type': 'integer', 'string': 'Number of modules updated', 'readonly': True},
- 'add': {'type': 'integer', 'string': 'Number of modules added', 'readonly': True},
- }
-
- def _update_module(self, cr, uid, data, context):
- update, add = pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid)
- return {'update': update, 'add': add}
-
- def _action_module_open(self, cr, uid, data, context):
-
- res = {
- 'domain': str([]),
- 'name': 'Module List',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'ir.module.module',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
-
- search_view_id = pooler.get_pool(cr.dbname).get('ir.ui.view').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
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': arch, 'fields': fields,
- 'state': [
- ('end', 'Cancel', 'gtk-cancel'),
- ('update', 'Check new modules', 'gtk-ok', True)
- ]
- }
- },
- 'update': {
- 'actions': [_update_module],
- 'result': {'type': 'form', 'arch': arch_module, 'fields': fields_module,
- 'state': [
- ('open_window', 'Ok', 'gtk-ok', True)
- ]
- }
- },
- 'open_window': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_module_open, 'state':'end'}
- }
- }
-wizard_update_module('module.module.update')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-