[REM] Remove unused fields in the ir.actions.todo model

bzr revid: xmo@tinyerp.com-20091207101740-9qllhd695oxskls2
This commit is contained in:
Xavier Morel 2009-12-07 11:17:40 +01:00
parent 1b8220ef59
commit 2d43ae33ff
2 changed files with 18 additions and 30 deletions

View File

@ -679,30 +679,24 @@ class act_window_close(osv.osv):
act_window_close() act_window_close()
# This model use to register action services. # This model use to register action services.
# if action type is 'configure', it will be start on configuration wizard. TODO_STATES = [('open', 'Not Started'),
# if action type is 'service', ('done', 'Done'),
# - if start_type= 'at once', it will be start at one time on start date ('skip','Skipped'),
# - if start_type='auto', it will be start on auto starting from start date, and stop on stop date ('cancel','Cancel')]
# - if start_type="manual", it will start and stop on manually
class ir_actions_todo(osv.osv): class ir_actions_todo(osv.osv):
_name = 'ir.actions.todo' _name = 'ir.actions.todo'
_columns={ _columns={
'start_date': fields.datetime('Start Date'), 'action_id': fields.many2one(
'end_date': fields.datetime('End Date'), 'ir.actions.act_window', 'Action', select=True, required=True,
'action_id':fields.many2one('ir.actions.act_window', 'Action', select=True,required=True, ondelete='cascade'), ondelete='cascade'),
'sequence':fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
'active': fields.boolean('Active'), 'active': fields.boolean('Active'),
'type':fields.selection([('configure', 'Configure'),('service', 'Service'),('other','Other')], string='Type', required=True), 'state': fields.selection(TODO_STATES, string='State', 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={ _defaults={
'state': lambda *a: 'open', 'state': lambda *a: 'open',
'sequence': lambda *a: 10, 'sequence': lambda *a: 10,
'active':lambda *a:True, 'active': lambda *a: True,
'type':lambda *a:'configure'
} }
_order="sequence" _order="sequence"
ir_actions_todo() ir_actions_todo()
@ -712,10 +706,8 @@ class ir_actions_configuration_wizard(osv.osv_memory):
_name='ir.actions.configuration.wizard' _name='ir.actions.configuration.wizard'
def next_configuration_action(self,cr,uid,context={}): def next_configuration_action(self,cr,uid,context={}):
item_obj = self.pool.get('ir.actions.todo') item_obj = self.pool.get('ir.actions.todo')
item_ids = item_obj.search(cr, uid, item_ids = item_obj.search(cr, uid, [('state','=','open'),
[('type','=','configure'), ('active','=',True)],
('state', '=', 'open'),
('active','=',True)],
limit=1, context=context) limit=1, context=context)
if item_ids: if item_ids:
return item_obj.browse(cr, uid, item_ids[0], context=context) return item_obj.browse(cr, uid, item_ids[0], context=context)
@ -737,8 +729,7 @@ class ir_actions_configuration_wizard(osv.osv_memory):
total = self.pool.get('ir.actions.todo')\ total = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [], context) .search_count(cr, uid, [], context)
todo = self.pool.get('ir.actions.todo')\ todo = self.pool.get('ir.actions.todo')\
.search_count(cr, uid,[('type','=','configure'), .search_count(cr, uid,[('active','=',True),
('active','=',True),
('state','<>','open')], ('state','<>','open')],
context) context)
if total > 0.0: if total > 0.0:

View File

@ -30,9 +30,8 @@ class res_config_configurable(osv.osv_memory):
total = self.pool.get('ir.actions.todo')\ total = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [], context) .search_count(cr, uid, [], context)
open = self.pool.get('ir.actions.todo')\ open = self.pool.get('ir.actions.todo')\
.search_count(cr, uid,[('type','=','configure'), .search_count(cr, uid, [('active','=',True),
('active','=',True), ('state','<>','open')],
('state','<>','open')],
context) context)
if total: if total:
return round(open*100./total) return round(open*100./total)
@ -49,11 +48,9 @@ class res_config_configurable(osv.osv_memory):
todos = self.pool.get('ir.actions.todo') todos = self.pool.get('ir.actions.todo')
self.logger.notifyChannel('actions', netsvc.LOG_INFO, self.logger.notifyChannel('actions', netsvc.LOG_INFO,
'getting next %s' % todos) 'getting next %s' % todos)
active_todos = todos.search(cr, uid, active_todos = todos.search(cr, uid, [('state','=','open'),
[('type','=','configure'), ('active','=',True)],
('state', '=', 'open'), limit=1, context=None)
('active','=',True)],
limit=1, context=None)
if active_todos: if active_todos:
return todos.browse(cr, uid, active_todos[0], context=None) return todos.browse(cr, uid, active_todos[0], context=None)
return None return None