From 086e88d4ce2494d8f242599db13a59418bec091b Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 26 Aug 2010 18:05:54 +0530 Subject: [IMP]: convert old wizard into osv memory wizard for update module bzr revid: ksa@tinyerp.co.in-20100826123554-2zd5yvp33slx8xfm --- .../base/module/wizard/base_module_update.py | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 bin/addons/base/module/wizard/base_module_update.py (limited to 'bin/addons/base/module/wizard/base_module_update.py') 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 -- cgit v1.2.3 From 55bec50ff09b29eb616ffbd56949b9ca194753d0 Mon Sep 17 00:00:00 2001 From: jas Date: Wed, 29 Sep 2010 13:28:01 +0530 Subject: [IMP]: base : Improvements in base module bzr revid: jas@tinyerp.com-20100929075801-l569rvj9tiq2ha9w --- bin/addons/base/module/wizard/base_module_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/addons/base/module/wizard/base_module_update.py') diff --git a/bin/addons/base/module/wizard/base_module_update.py b/bin/addons/base/module/wizard/base_module_update.py index 29e897b3a0c..eea5f5aaee4 100644 --- a/bin/addons/base/module/wizard/base_module_update.py +++ b/bin/addons/base/module/wizard/base_module_update.py @@ -92,7 +92,7 @@ class base_module_update_open(osv.osv_memory): """ res = { 'domain': str([]), - 'name': 'Module List', + 'name': 'Modules', 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'ir.module.module', -- cgit v1.2.3 From cd527b6c9d3a7337ae689b54325a1bb574b3b285 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 4 Oct 2010 16:33:36 +0200 Subject: [IMP] base: refactor/unify base module wizards bzr revid: odo@openerp.com-20101004143336-nh0vnvbipt5dvmna --- .../base/module/wizard/base_module_update.py | 78 ++++------------------ 1 file changed, 14 insertions(+), 64 deletions(-) (limited to 'bin/addons/base/module/wizard/base_module_update.py') 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" + _inherit = "ir.wizard.screen" - 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" + _columns = { + '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 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. - """ + _defaults = { + 'state': 'init', + } + 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,) - return {'update': update, 'add': add} - - _columns = { - 'update': fields.integer('Number of modules updated', readonly=True), - 'add': fields.integer('Number of modules added', readonly=True), - } + self.write(cr, uid, ids, {'update': update, 'add': add, 'state': 'done'}, context=context) + return False 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': '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 -- cgit v1.2.3