From 4f80a8e2137a0fa9b57ff7f73d01fdb41ba23dfc Mon Sep 17 00:00:00 2001 From: Harshad Modi Date: Mon, 29 Sep 2008 14:19:06 +0530 Subject: Improvement on Configuration wizard step : * rename "ir.module.module.configuration.step" with "ir.actions.todo" and put into ir/ir_actions.py file * added more fields like : - active - start_date (datetime) - stop_date (datetime) - users_id and groups_id ( for security) - type : configure | service | other ( default type is "configure" ) - start_on : at once | auto | manual * rename "ir.module.module.configuration.wizard" with "ir.actions.configuration.wizard" and put into ir/ir_actions.py file bzr revid: hmo@tinyerp.com-20080929084906-8jke69eg3uadl9vm --- bin/addons/base/module/module.py | 107 --------------------------------------- 1 file changed, 107 deletions(-) (limited to 'bin/addons/base/module/module.py') diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index ca25c010ccc..9f1035b3528 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -588,112 +588,5 @@ class module_dependency(osv.osv): ], string='State', readonly=True), } module_dependency() - - - -class module_config_wizard_step(osv.osv): - _name = 'ir.module.module.configuration.step' - _columns={ - 'name':fields.char('Name',size=64,required=True, select=True), - 'note':fields.text('Text'), - 'action_id':fields.many2one('ir.actions.act_window', 'Action', select=True,required=True, ondelete='cascade'), - 'sequence':fields.integer('Sequence'), - 'state':fields.selection([('open', 'Not Started'),('done', 'Done'),('skip','Skipped')], string='State', required=True) - } - _defaults={ - 'state': lambda *a: 'open', - 'sequence': lambda *a: 10, - } - _order="sequence" -module_config_wizard_step() - - -class module_configuration(osv.osv_memory): - _name='ir.module.module.configuration.wizard' - def _get_action_name(self, cr, uid, context={}): - item_obj = self.pool.get('ir.module.module.configuration.step') - item_ids = item_obj.search(cr, uid, [ - ('state', '=', 'open'), - ], limit=1, context=context) - if item_ids and len(item_ids): - item = item_obj.browse(cr, uid, item_ids[0], context=context) - return item.note - else: - return "Your database is now fully configured.\n\nClick 'Continue' and enjoy your OpenERP experience..." - return False - - def _get_action(self, cr, uid, context={}): - item_obj = self.pool.get('ir.module.module.configuration.step') - item_ids = item_obj.search(cr, uid, [ - ('state', '=', 'open'), - ], limit=1, context=context) - if item_ids: - item = item_obj.browse(cr, uid, item_ids[0], context=context) - return item.id - return False - - def _progress_get(self,cr,uid, context={}): - total = self.pool.get('ir.module.module.configuration.step').search_count(cr, uid, [], context) - todo = self.pool.get('ir.module.module.configuration.step').search_count(cr, uid, [('state','<>','open')], context) - return max(5.0,round(todo*100/total)) - - _columns = { - 'name': fields.text('Next Wizard',readonly=True), - 'progress': fields.float('Configuration Progress', readonly=True), - 'item_id':fields.many2one('ir.module.module.configuration.step', 'Next Configuration Wizard',invisible=True, readonly=True), - } - _defaults={ - 'progress': _progress_get, - 'item_id':_get_action, - 'name':_get_action_name, - } - def button_skip(self,cr,uid,ids,context=None): - item_obj = self.pool.get('ir.module.module.configuration.step') - item_id=self.read(cr,uid,ids)[0]['item_id'] - if item_id: - item = item_obj.browse(cr, uid, item_id, context=context) - item_obj.write(cr, uid, item.id, { - 'state': 'skip', - }, context=context) - return{ - 'view_type': 'form', - "view_mode": 'form', - 'res_model': 'ir.module.module.configuration.wizard', - 'type': 'ir.actions.act_window', - 'target':'new', - } - return {'type':'ir.actions.act_window_close'} - - def button_continue(self, cr, uid, ids, context=None): - item_obj = self.pool.get('ir.module.module.configuration.step') - item_id=self.read(cr,uid,ids)[0]['item_id'] - if item_id: - item = item_obj.browse(cr, uid, item_id, context=context) - item_obj.write(cr, uid, item.id, { - 'state': 'done', - }, context=context) - return{ - 'view_mode': item.action_id.view_mode, - 'view_type': item.action_id.view_type, - 'view_id':item.action_id.view_id and [item.action_id.view_id.id] or False, - 'res_model': item.action_id.res_model, - 'type': item.action_id.type, - 'target':item.action_id.target, - } - user_action=self.pool.get('res.users').browse(cr,uid,uid) - act_obj=self.pool.get(user_action.menu_id.type) - action_ids=act_obj.search(cr,uid,[('name','=',user_action.menu_id.name)]) - action_open=act_obj.browse(cr,uid,action_ids)[0] - if context.get('menu',False): - return{ - 'view_type': action_open.view_type, - 'view_id':action_open.view_id and [action_open.view_id.id] or False, - 'res_model': action_open.res_model, - 'type': action_open.type, - 'domain':action_open.domain - } - return {'type':'ir.actions.act_window_close' } -module_configuration() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- cgit v1.2.3