[IMP] add new handler for addons configuration, corresponding menu item
bzr revid: xmo@tinyerp.com-20091203123110-r1v2vycpe92bvvxc
This commit is contained in:
@@ -1411,5 +1411,12 @@
|
||||
</record>
|
||||
<menuitem action="action_config_wizard_form" id="menu_config_module" parent="base.next_id_11"/>
|
||||
|
||||
<record id="action_start_configurator" model="ir.actions.server">
|
||||
<field name="name">Start Configuration</field>
|
||||
<field name="model_id" ref="model_ir_actions_configurator"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = self.next(cr, uid)</field>
|
||||
</record>
|
||||
<menuitem action="action_start_configurator" id="menu_configurator_module" parent="next_id_11" type="server"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -812,5 +812,42 @@ class ir_actions_configuration_wizard(osv.osv_memory):
|
||||
return self.button_next(cr, uid, ids, context)
|
||||
ir_actions_configuration_wizard()
|
||||
|
||||
class ir_actions_configurator(osv.osv_memory):
|
||||
_name = 'ir.actions.configurator'
|
||||
logger = netsvc.Logger()
|
||||
def next_action(self, cr, uid, context=None):
|
||||
todos = self.pool.get('ir.actions.todo')
|
||||
self.logger.notifyChannel('actions', netsvc.LOG_INFO,
|
||||
'getting next %s' % todos)
|
||||
active_todos = todos.search(cr, uid,
|
||||
[('type','=','configure'),
|
||||
('state', '=', 'open'),
|
||||
('active','=',True)],
|
||||
limit=1, context=None)
|
||||
if active_todos:
|
||||
return todos.browse(cr, uid, active_todos[0], context=None)
|
||||
return None
|
||||
|
||||
def next(self, cr, uid):
|
||||
self.logger.notifyChannel('actions', netsvc.LOG_INFO,
|
||||
'getting next operation')
|
||||
next = self.next_action(cr, uid)
|
||||
self.logger.notifyChannel('actions', netsvc.LOG_INFO,
|
||||
'next action is %s' % next)
|
||||
if next:
|
||||
self.pool.get('ir.actions.todo').write(cr, uid, next.id, {
|
||||
'state':'done',
|
||||
}, context=None)
|
||||
action = next.action_id
|
||||
return {
|
||||
'view_mode': action.view_mode,
|
||||
'view_type': action.view_type,
|
||||
'view_id': action.view_id and [action.view_id.id] or False,
|
||||
'res_model': action.res_model,
|
||||
'type': action.type,
|
||||
'target': action.target,
|
||||
}
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
ir_actions_configurator()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user