[IMP]: Improve write method for project
bzr revid: atp@tinyerp.com-20120926162225-io7szog9omvd0sx6
This commit is contained in:
parent
ae0d1d99a3
commit
f7c2177157
|
@ -790,7 +790,7 @@ class crm_lead(base_stage, format_address, osv.osv):
|
|||
vals['probability'] = stage.probability
|
||||
for lead in self.browse(cr, uid, ids, context=context):
|
||||
if lead.section_id:
|
||||
vals.update({'message_follower_ids': [(4, follow.id) for follow in lead.section_id.message_follower_ids]})
|
||||
vals.update({'message_follower_ids': [(4, follower.id) for follower in lead.section_id.message_follower_ids]})
|
||||
return super(crm_lead,self).write(cr, uid, ids, vals, context)
|
||||
|
||||
# ----------------------------------------
|
||||
|
|
|
@ -1114,6 +1114,10 @@ class task(base_stage, osv.osv):
|
|||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
if task.project_id:
|
||||
vals.update({'message_follower_ids': [(4, follower.id) for follower in task.project_id.message_follower_ids]})
|
||||
|
||||
if vals and not 'kanban_state' in vals and 'stage_id' in vals:
|
||||
new_stage = vals.get('stage_id')
|
||||
vals_reset_kstate = dict(vals, kanban_state='normal')
|
||||
|
|
|
@ -364,6 +364,9 @@ class project_issue(base_stage, osv.osv):
|
|||
logged_fields = ['stage_id', 'state', 'message_ids']
|
||||
if any([field in vals for field in logged_fields]):
|
||||
vals['date_action_last'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
for issue in self.browse(cr, uid, ids, context=context):
|
||||
if issue.project_id:
|
||||
vals.update({'message_follower_ids': [(4, follower.id) for follower in issue.project_id.message_follower_ids]})
|
||||
return super(project_issue, self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def onchange_task_id(self, cr, uid, ids, task_id, context=None):
|
||||
|
|
|
@ -41,7 +41,7 @@ class sale_order(osv.osv):
|
|||
def write(self, cr, uid, ids, vals, context=None):
|
||||
for order in self.browse(cr, uid, ids, context=context):
|
||||
if order.section_id:
|
||||
vals.update({'message_follower_ids': [(4, follow.id) for follow in order.section_id.message_follower_ids]})
|
||||
vals.update({'message_follower_ids': [(4, follower.id) for follower in order.section_id.message_follower_ids]})
|
||||
return super(sale_order, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
sale_order()
|
||||
|
|
Loading…
Reference in New Issue