[IMP] improve the code
bzr revid: rma@tinyerp.com-20121122071522-ck8a1hyhszqlzd0j
This commit is contained in:
parent
828b38bfdd
commit
01636ac48b
|
@ -1175,6 +1175,7 @@ class task(base_stage, osv.osv):
|
|||
#raise osv.except_osv(_('Warning!'), _('Stage is not defined in the project.'))
|
||||
write_vals = vals_reset_kstate if t.stage_id != new_stage else vals
|
||||
super(task, self).write(cr, uid, [t.id], write_vals, context=context)
|
||||
self.stage_set_send_note(cr, uid, [t.id], new_stage, context=context)
|
||||
result = True
|
||||
else:
|
||||
result = super(task, self).write(cr, uid, ids, vals, context=context)
|
||||
|
@ -1286,7 +1287,11 @@ class task(base_stage, osv.osv):
|
|||
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
return self.message_post(cr, uid, ids, body=_("Task has been <b>created</b>."), subtype="project.mt_task_new", context=context)
|
||||
|
||||
def stage_set_send_note(self, cr, uid, ids, stage_id, context=None):
|
||||
""" Override of the (void) default notification method. """
|
||||
stage_name = self.pool.get('project.task.type').name_get(cr, uid, [stage_id], context=context)[0][1]
|
||||
return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name),
|
||||
context=context)
|
||||
def case_open_send_note(self, cr, uid, ids, context=None):
|
||||
return self.message_post(cr, uid, ids, body=_("Task has been <b>started</b>."), subtype="project.mt_task_started", context=context)
|
||||
|
||||
|
|
|
@ -387,7 +387,6 @@ class project_issue(base_stage, osv.osv):
|
|||
def write(self, cr, uid, ids, vals, context=None):
|
||||
#Update last action date every time the user change the stage, the state or send a new email
|
||||
logged_fields = ['stage_id', 'state', 'message_ids']
|
||||
print "logged_fields-------",logged_fields
|
||||
if any([field in vals for field in logged_fields]):
|
||||
vals['date_action_last'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
|
@ -399,6 +398,7 @@ class project_issue(base_stage, osv.osv):
|
|||
if st.state =='open':
|
||||
self.issue_start_send_note(cr, uid, ids, context=context)
|
||||
return super(project_issue, self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def issue_start_send_note(self, cr, uid, ids, context=None):
|
||||
return self.message_post(cr, uid, ids, body=_("Issue has been <b>started</b>."), subtype="mt_issue_change", context=context)
|
||||
|
||||
|
@ -547,7 +547,10 @@ class project_issue(base_stage, osv.osv):
|
|||
def convert_to_task_send_note(self, cr, uid, ids, context=None):
|
||||
message = _("Project issue <b>converted</b> to task.")
|
||||
return self.message_post(cr, uid, ids, body=message, context=context)
|
||||
|
||||
def stage_set_send_note(self, cr, uid, ids, stage_id, context=None):
|
||||
""" Override of the (void) default notification method. """
|
||||
stage_name = self.pool.get('project.task.type').name_get(cr, uid, [stage_id], context=context)[0][1]
|
||||
return self.message_post(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), subtype="mt_issue_new", context=context)
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
message = _("Project issue <b>created</b>.")
|
||||
return self.message_post(cr, uid, ids, body=message, subtype="mt_issue_new", context=context)
|
||||
|
|
Loading…
Reference in New Issue