summaryrefslogtreecommitdiff
path: root/bin/addons/base/module
diff options
context:
space:
mode:
authorHarshad Modi <hmo@tinyerp.com>2008-09-29 14:19:06 +0530
committerHarshad Modi <hmo@tinyerp.com>2008-09-29 14:19:06 +0530
commit4f80a8e2137a0fa9b57ff7f73d01fdb41ba23dfc (patch)
treebf1881b8ba63b6f5ae89e580d6372ebe1ed969f4 /bin/addons/base/module
parentf456e3a052034c58292d003b63d37caaf9a1b3dc (diff)
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
Diffstat (limited to 'bin/addons/base/module')
-rw-r--r--bin/addons/base/module/module.py107
-rw-r--r--bin/addons/base/module/module_view.xml67
-rw-r--r--bin/addons/base/module/wizard/wizard_module_upgrade.py2
3 files changed, 2 insertions, 174 deletions
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:
diff --git a/bin/addons/base/module/module_view.xml b/bin/addons/base/module/module_view.xml
index 8580d163c27..dfec0514bd7 100644
--- a/bin/addons/base/module/module_view.xml
+++ b/bin/addons/base/module/module_view.xml
@@ -183,72 +183,7 @@
<field name="view_mode">tree,form</field>
<field name="context">{'active_test': False}</field>
</record>
- <menuitem action="open_repository_tree" id="menu_module_repository_tree" parent="base.menu_management"/>
-
- <record id="config_wizard_step_view_tree" model="ir.ui.view">
- <field name="model">ir.module.module.configuration.step</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree editable="bottom" string="Config Wizard Steps">
- <field name="name" select="1"/>
- <field name="action_id" select="1"/>
- <field name="sequence"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
- <record id="config_wizard_step_view_form" model="ir.ui.view">
- <field name="model">ir.module.module.configuration.step</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form editable="bottom" string="Config Wizard Steps">
- <field name="name" select="1"/>
- <field name="action_id" select="1"/>
- <field name="sequence"/>
- <field name="state"/>
- <field colspan="4" name="note"/>
- </form>
- </field>
- </record>
- <record id="act_config_wizard_step_form" model="ir.actions.act_window">
- <field name="name">Config Wizard Steps</field>
- <field name="res_model">ir.module.module.configuration.step</field>
- <field name="view_id" ref="config_wizard_step_view_tree"/>
- <field name="view_type">form</field>
- </record>
- <menuitem id="next_id_11" name="Configuration Wizards" parent="base.menu_custom"/><menuitem action="act_config_wizard_step_form" id="menu_config_wizard_step_form" parent="next_id_11"/>
-
- <record id="view_config_wizard_form" model="ir.ui.view">
- <field name="name">Main Configuration Wizard</field>
- <field name="model">ir.module.module.configuration.wizard</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Next Configuration Step">
- <image name="gtk-dialog-info"/>
- <group>
- <separator string="Next Configuration Step" colspan="4"/>
- <field name="name" nolabel="1" colspan="4" width="500"/>
- <field name="progress" widget="progressbar"/>
- <separator colspan="4" string=""/>
- <label string="" colspan="2"/>
- <group colspan="2" col="2">
- <button icon="gtk-cancel" special="cancel" string="Skip Step"/>
- <button icon="gtk-go-forward" name="button_continue" string="Continue" type="object"/>
- </group>
- </group>
- </form>
- </field>
- </record>
-
- <record id="action_config_wizard_form" model="ir.actions.act_window">
- <field name="name">Configuration Wizard</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">ir.module.module.configuration.wizard</field>
- <field name="view_type">form</field>
- <field name="view_mode">form</field>
- <field name="target">new</field>
- </record>
- <menuitem action="action_config_wizard_form" id="menu_config_module" parent="base.next_id_11"/>
+ <menuitem action="open_repository_tree" id="menu_module_repository_tree" parent="base.menu_management"/>
</data>
</openerp>
diff --git a/bin/addons/base/module/wizard/wizard_module_upgrade.py b/bin/addons/base/module/wizard/wizard_module_upgrade.py
index c126a70b12a..15a0195b151 100644
--- a/bin/addons/base/module/wizard/wizard_module_upgrade.py
+++ b/bin/addons/base/module/wizard/wizard_module_upgrade.py
@@ -113,7 +113,7 @@ class wizard_info_get(wizard.interface):
return {
'view_type': 'form',
"view_mode": 'form',
- 'res_model': 'ir.module.module.configuration.wizard',
+ 'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}