if not task.date_end:
vals.update({ 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
self.write(cr, uid, [task.id],vals, context=context)
- self.case_close_send_note(cr, uid, [task.id], context)
+ self.do_close_send_note(cr, uid, [task.id], context)
return True
def do_reopen(self, cr, uid, ids, context=None):
}, context=context)
self.write(cr, uid, [task.id], {'state': 'open'}, context=context)
- self.case_open_send_note(cr, uid, [task.id], context)
+ self.do_open_send_note(cr, uid, [task.id], context)
return True
def do_cancel(self, cr, uid, ids, context={}):
'ref_doc1': 'project.task,%d' % task.id,
'ref_doc2': 'project.project,%d' % project.id,
}, context=context)
- self.case_cancel_send_note(cr, uid, [task.id], context)
self.write(cr, uid, [task.id], {'state': 'cancelled', 'remaining_hours':0.0}, context=context)
+ self.do_cancel_send_note(cr, uid, [task.id], context)
return True
def do_open(self, cr, uid, ids, context={}):
if not t.date_start:
data['date_start'] = time.strftime('%Y-%m-%d %H:%M:%S')
self.write(cr, uid, [t.id], data, context=context)
- self.case_open_send_note(cr, uid, [t.id], context)
+ self.do_open_send_note(cr, uid, [t.id], context)
return True
def do_draft(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state': 'draft'}, context=context)
- self.case_draft_send_note(cr, uid, ids, context)
+ self.do_draft_send_note(cr, uid, ids, context)
return True
self.do_pending(cr, uid, [task.id], context=context)
elif delegate_data['state'] == 'done':
self.do_close(cr, uid, [task.id], context=context)
- self.case_delegation_send_note(cr, uid, [task.id], context)
+ self.do_delegation_send_note(cr, uid, [task.id], context)
delegated_tasks[task.id] = delegated_task_id
return delegated_tasks
def do_pending(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state': 'pending'}, context=context)
- self.case_pending_send_note(cr, uid, ids, context)
+ self.do_pending_send_note(cr, uid, ids, context)
return True
def set_remaining_time(self, cr, uid, ids, remaining_time=1.0, context=None):
elif typeid and typeid in sorted_types and sorted_types.index(typeid) != len(sorted_types)-1:
index = sorted_types.index(typeid)
self.write(cr, uid, task.id, {'type_id': sorted_types[index+1]})
- self.case_state_change_send_note(cr, uid, [task.id], context)
+ self.state_change_send_note(cr, uid, [task.id], context)
return True
def next_type(self, cr, uid, ids, context=None):
def get_needaction_user_ids(self, cr, uid, ids, context=None):
result = dict.fromkeys(ids, [])
for obj in self.browse(cr, uid, ids, context=context):
- if (obj.state == 'draft' and obj.user_id):
+ if obj.state == 'draft' and obj.user_id:
result[obj.id] = [obj.user_id.id]
return result
+ def message_get_subscribers(self, cr, uid, ids, context=None):
+ sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context);
+ for obj in self.browse(cr, uid, ids, context=context):
+ if obj.user_id:
+ sub_ids.append(obj.user_id.id)
+ return self.pool.get('res.users').read(cr, uid, sub_ids, context=context)
+
def create(self, cr, uid, vals, context=None):
result = super(task, self).create(cr, uid, vals, context=context)
self._store_history(cr, uid, [result], context=context)
return result
def create_send_note(self, cr, uid, ids, context=None):
- for obj in self.browse(cr, uid, ids, context=context):
- if obj.user_id.id :
- self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context)
- obj.message_append_note('',_("Task has been <b>created</b>."))
+ self.message_append_note(cr, uid, ids, _('System notification'), _("Task has been <b>created</b>."), type='notification', context=context)
return True
- def case_pending_send_note(self, cr, uid, ids, context=None):
+ def do_pending_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = 'Task is now <b>pending</b>.'
self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
return True
- def case_open_send_note(self, cr, uid, ids, context=None):
+ def do_open_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = 'Task has been <b>opened</b>.'
self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
return True
- def case_cancel_send_note(self, cr, uid, ids, context=None):
+ def do_cancel_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = 'Task has been <b>canceled</b>.'
self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
return True
- def case_close_send_note(self, cr, uid, ids, context=None):
+ def do_close_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = 'Task has been <b>closed</b>.'
self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
return True
- def case_draft_send_note(self, cr, uid, ids, context=None):
+ def do_draft_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = 'Task has been <b>renewed</b>.'
self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
return True
- def case_delegation_send_note(self, cr, uid, ids, context=None):
+ def do_delegation_send_note(self, cr, uid, ids, context=None):
for task in self.browse(cr, uid, ids, context=context):
msg = 'Task has been <b>delegated</b> to <em>%s</em>.' % (task.user_id.name)
self.message_append_note(cr, uid, [task.id], 'System Notification', msg, context=context)
return True
- def case_state_change_send_note(self, cr, uid, ids, context=None):
+ def state_change_send_note(self, cr, uid, ids, context=None):
for task in self.browse(cr, uid, ids, context=context):
msg = 'Stage changed to <b>%s</b>' % (task.type_id.name)
self.message_append_note(cr, uid, [task.id], 'System Notification', msg, context=context)