diff options
| author | Harshad Modi <hmo@tinyerp.com> | 2008-09-29 14:19:06 +0530 |
|---|---|---|
| committer | Harshad Modi <hmo@tinyerp.com> | 2008-09-29 14:19:06 +0530 |
| commit | 4f80a8e2137a0fa9b57ff7f73d01fdb41ba23dfc (patch) | |
| tree | bf1881b8ba63b6f5ae89e580d6372ebe1ed969f4 /bin | |
| parent | f456e3a052034c58292d003b63d37caaf9a1b3dc (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')
| -rw-r--r-- | bin/addons/base/base_update.xml | 4 | ||||
| -rw-r--r-- | bin/addons/base/ir/ir.xml | 70 | ||||
| -rw-r--r-- | bin/addons/base/ir/ir_actions.py | 119 | ||||
| -rw-r--r-- | bin/addons/base/ir/ir_model.py | 4 | ||||
| -rw-r--r-- | bin/addons/base/module/module.py | 107 | ||||
| -rw-r--r-- | bin/addons/base/module/module_view.xml | 67 | ||||
| -rw-r--r-- | bin/addons/base/module/wizard/wizard_module_upgrade.py | 2 | ||||
| -rw-r--r-- | bin/addons/base/res/res_user.py | 8 | ||||
| -rw-r--r-- | bin/addons/base/security/ir.model.access.csv | 2 |
9 files changed, 199 insertions, 184 deletions
diff --git a/bin/addons/base/base_update.xml b/bin/addons/base/base_update.xml index b56866a5a15..756085896bb 100644 --- a/bin/addons/base/base_update.xml +++ b/bin/addons/base/base_update.xml @@ -244,7 +244,7 @@ <!-- register on configuratuion --> - <record id="config_wizard_step_user" model="ir.module.module.configuration.step"> + <record id="config_wizard_step_user" model="ir.actions.todo"> <field name="name">Create User</field> <field name="note">Create your users. You will be able to assign groups to users. Groups define the access rights of each users on the different objects of the system. @@ -254,7 +254,7 @@ You will be able to assign groups to users. Groups define the access rights of e <field name="sequence">10</field> </record> - <record id="config_wizard_simple_view" model="ir.module.module.configuration.step"> + <record id="config_wizard_simple_view" model="ir.actions.todo"> <field name="name">Select Your Interface</field> <field name="note">Choose between the "Simplified Interface" or the extended one. If you are testing or using OpenERP for the first time, we suggest you to use diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index b67f5704af8..11358c788ce 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -1187,5 +1187,75 @@ </record> <menuitem action="action_model_grid_security" id="menu_ir_access_grid" parent="menu_security_access"/> + <record id="ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">Config Wizard Steps</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"/> + <field name="active" select="1"/> + </tree> + </field> + </record> + <record id="config_wizard_step_view_form" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">Config Wizard Steps</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="active" 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_ir_actions_todo_form" model="ir.actions.act_window"> + <field name="name">Config Wizard Steps</field> + <field name="res_model">ir.actions.todo</field> + <field name="view_id" ref="ir_actions_todo_tree"/> + <field name="view_type">form</field> + <field name="domain">[('type','=','configure')]</field> + </record> + <menuitem id="next_id_11" name="Configuration Wizards" parent="base.menu_custom"/><menuitem action="act_ir_actions_todo_form" id="menu_ir_actions_todo_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.actions.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.actions.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"/> + </data> </openerp> diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index 03f79a067ce..1fffd01c4bc 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -589,3 +589,122 @@ class act_window_close(osv.osv): 'type': lambda *a: 'ir.actions.act_window_close', } act_window_close() + +# This model use to register action services. +# if action type is 'configure', it will be start on configuration wizard. +# if action type is 'service', +# - if start_type= 'at once', it will be start at one time on start date +# - if start_type='auto', it will be start on auto starting from start date, and stop on stop date +# - if start_type="manual", it will start and stop on manually +class ir_actions_todo(osv.osv): + _name = 'ir.actions.todo' + _columns={ + 'name':fields.char('Name',size=64,required=True, select=True), + 'note':fields.text('Text'), + 'start_date': fields.datetime('Start Date'), + 'end_date': fields.datetime('End Date'), + 'action_id':fields.many2one('ir.actions.act_window', 'Action', select=True,required=True, ondelete='cascade'), + 'sequence':fields.integer('Sequence'), + 'active': fields.boolean('Active'), + 'type':fields.selection([('configure', 'Configure'),('service', 'Service'),('other','Other')], string='Type', required=True), + 'start_on':fields.selection([('at_once', 'At Once'),('auto', 'Auto'),('manual','Manual')], string='Start On'), + 'groups_id': fields.many2many('res.groups', 'res_groups_act_todo_rel', 'act_todo_id', 'group_id', 'Groups'), + 'users_id': fields.many2many('res.users', 'res_users_act_todo_rel', 'act_todo_id', 'user_id', 'Users'), + 'state':fields.selection([('open', 'Not Started'),('done', 'Done'),('skip','Skipped'),('cancel','Cancel')], string='State', required=True) + } + _defaults={ + 'state': lambda *a: 'open', + 'sequence': lambda *a: 10, + 'active':lambda *a:True, + 'type':lambda *a:'configure' + } + _order="sequence" +ir_actions_todo() + +# This model to use run all configuration actions +class ir_actions_configuration_wizard(osv.osv_memory): + _name='ir.actions.configuration.wizard' + def next_configuration_action(self,cr,uid,context={}): + item_obj = self.pool.get('ir.actions.todo') + item_ids = item_obj.search(cr, uid, [('type','=','configure'),('state', '=', 'open'),('active','=',True)], limit=1, context=context) + if item_ids and len(item_ids): + item = item_obj.browse(cr, uid, item_ids[0], context=context) + return item + return False + def _get_action_name(self, cr, uid, context={}): + next_action=self.next_configuration_action(cr,uid,context=context) + if next_action: + return next_action.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={}): + next_action=self.next_configuration_action(cr,uid,context=context) + if next_action: + return next_action.id + return False + + def _progress_get(self,cr,uid, context={}): + total = self.pool.get('ir.actions.todo').search_count(cr, uid, [], context) + todo = self.pool.get('ir.actions.todo').search_count(cr, uid, [('type','=','configure'),('active','=',True),('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.actions.todo', '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.actions.todo') + 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.actions.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.actions.todo') + 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' } +ir_actions_configuration_wizard() + diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 66010201701..1bb1fea3f27 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -544,7 +544,7 @@ class ir_model_config(osv.osv): 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', } @@ -561,7 +561,7 @@ class ir_model_config(osv.osv): 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', } 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', } diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 35b008806e1..28529e5ce41 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -212,7 +212,7 @@ class users(osv.osv): 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', } @@ -221,7 +221,7 @@ class users(osv.osv): 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', } @@ -258,7 +258,7 @@ class res_config_view(osv.osv_memory): 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', } @@ -275,7 +275,7 @@ class res_config_view(osv.osv_memory): 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', } diff --git a/bin/addons/base/security/ir.model.access.csv b/bin/addons/base/security/ir.model.access.csv index a9ae41ee90e..6ef1956c0f9 100644 --- a/bin/addons/base/security/ir.model.access.csv +++ b/bin/addons/base/security/ir.model.access.csv @@ -13,8 +13,6 @@ access_ir_model_data_group_user,"ir_model_data group_user",model_ir_model_data,, access_ir_model_fields_group_user,"ir_model_fields group_user",model_ir_model_fields,,1,0,0,0 access_ir_module_category_group_user,"ir_module_category group_user",model_ir_module_category,group_system,1,0,0,0 access_ir_module_module_group_user,"ir_module_module group_user",model_ir_module_module,group_system,1,1,1,1 -access_ir_module_module_configuration_step_group_system,"ir_module_module_configuration_step group_system",model_ir_module_module_configuration_step,group_system,1,1,1,1 -access_ir_module_module_configuration_wizard_group_system,"ir_module_module_configuration_wizard group_system",model_ir_module_module_configuration_wizard,group_system,1,1,1,1 access_ir_module_module_dependency_group_system,"ir_module_module_dependency group_system",model_ir_module_module_dependency,group_system,1,1,1,1 access_ir_module_repository_group_system,"ir_module_repository group_system",model_ir_module_repository,group_system,1,1,1,1 access_ir_property_group_user,"ir_property group_user",model_ir_property,,1,0,0,0 |
