summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@tinyerp.com>2011-10-02 13:51:31 +0200
committerFabien Pinckaers <fp@tinyerp.com>2011-10-02 13:51:31 +0200
commitfc7675014fa53bd75c16015c7319e80dcdc5392c (patch)
treec5f10c09fc499e011f331297037cab2d8ad92899
parent7569906597c6ea783c4466e3c05b473c5ed818af (diff)
[IMP] config wizard, launch once
bzr revid: fp@tinyerp.com-20111002115131-cf5417apx9vfa9jc
-rw-r--r--openerp/addons/base/ir/ir_actions.py11
-rw-r--r--openerp/addons/base/res/res_config.py27
2 files changed, 7 insertions, 31 deletions
diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py
index a2e107e741e..7850006c31a 100644
--- a/openerp/addons/base/ir/ir_actions.py
+++ b/openerp/addons/base/ir/ir_actions.py
@@ -810,7 +810,7 @@ ir_actions_todo_category()
# This model use to register action services.
TODO_STATES = [('open', 'To Do'),
('done', 'Done')]
-TODO_TYPES = [('manual', 'Launch Manually'),
+TODO_TYPES = [('manual', 'Launch Manually'),('once', 'Launch Manually Once'),
('automatic', 'Launch Automatically')]
class ir_actions_todo(osv.osv):
"""
@@ -827,7 +827,8 @@ class ir_actions_todo(osv.osv):
'name': fields.char('Name', size=64),
'type': fields.selection(TODO_TYPES, 'Type', required=True,
help="""Manual: Launched manually.
-Automatic: Runs whenever the system is reconfigured."""),
+Automatic: Runs whenever the system is reconfigured.
+Launch Manually Once: after hacing been launched manually, it sets automatically to Done."""),
'groups_id': fields.many2many('res.groups', 'res_groups_action_rel', 'uid', 'gid', 'Groups'),
'note': fields.text('Text', translate=True),
'category_id': fields.many2one('ir.actions.todo.category','Category'),
@@ -843,7 +844,7 @@ Automatic: Runs whenever the system is reconfigured."""),
""" Launch Action of Wizard"""
wizard_id = ids and ids[0] or False
wizard = self.browse(cr, uid, wizard_id, context=context)
- if wizard.type == 'automatic':
+ if wizard.type in ('automatic', 'once'):
wizard.write({'state': 'done'})
# Load action
@@ -890,13 +891,13 @@ Automatic: Runs whenever the system is reconfigured."""),
done = filter(
groups_match,
self.browse(cr, uid,
- self.search(cr, uid, ['&', ('state', '!=', 'open'), ('type', '=', 'manual')], context=context),
+ self.search(cr, uid, [('state', '!=', 'open')], context=context),
context=context))
total = filter(
groups_match,
self.browse(cr, uid,
- self.search(cr, uid, [('type', '=', 'manual')], context=context),
+ self.search(cr, uid, [], context=context),
context=context))
return {
diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py
index df508bad5c9..3cec8b740ec 100644
--- a/openerp/addons/base/res/res_config.py
+++ b/openerp/addons/base/res/res_config.py
@@ -39,27 +39,6 @@ class res_config_configurable(osv.osv_memory):
_inherit = 'ir.wizard.screen'
__logger = logging.getLogger(_name)
- def get_current_progress(self, cr, uid, context=None):
- '''Return a description the current progress of configuration:
- a tuple of (non_open_todos:int, total_todos: int)
- '''
- return itemgetter('done', 'total')(
- self.pool.get('ir.actions.todo').progress(cr, uid, context=context))
-
- def _progress(self, cr, uid, context=None):
- closed, total = self.get_current_progress(cr, uid, context=context)
- if total:
- return round(closed*100./total)
- return 100.
-
- _columns = dict(
- progress = fields.float('Configuration Progress', readonly=True),
- )
-
- _defaults = dict(
- progress = _progress,
- )
-
def _next_action(self, cr, uid, context=None):
Todos = self.pool['ir.actions.todo']
self.__logger.info('getting next %s', Todos)
@@ -91,11 +70,7 @@ class res_config_configurable(osv.osv_memory):
res = next.action_launch(context=context)
res['nodestroy'] = False
return res
- self.__logger.info('all configuration actions have been executed')
-
- current_user_menu = self.pool.get('res.users').browse(cr, uid, uid).menu_id
- # return the action associated with the menu
- return self.pool.get(current_user_menu.type).read(cr, uid, current_user_menu.id)
+ return {'type' : 'ir.actions.act_window_close'}
def start(self, cr, uid, ids, context=None):
return self.next(cr, uid, ids, context)