[FIX] project: Fill date_last_stage_update when needed
Before this commit, the date_last_stage_update field in fill everytime at task creation. This does not make sense if ther is no project linked to the task or if there is no stages associated to the project/task. This commit populates the date_last_stage_update field only when needed. So, we can now have newly created task without date_last_stage_update filled. closes odoo/odoo#31999 Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
This commit is contained in:
@@ -478,7 +478,6 @@ class Task(models.Model):
|
||||
date_assign = fields.Datetime(string='Assigning Date', index=True, copy=False, readonly=True)
|
||||
date_deadline = fields.Date(string='Deadline', index=True, copy=False, track_visibility='onchange')
|
||||
date_last_stage_update = fields.Datetime(string='Last Stage Update',
|
||||
default=fields.Datetime.now,
|
||||
index=True,
|
||||
copy=False,
|
||||
readonly=True)
|
||||
@@ -696,9 +695,10 @@ class Task(models.Model):
|
||||
# user_id change: update date_assign
|
||||
if vals.get('user_id'):
|
||||
vals['date_assign'] = fields.Datetime.now()
|
||||
# Stage change: Update date_end if folded stage
|
||||
# Stage change: Update date_end if folded stage and date_last_stage_update
|
||||
if vals.get('stage_id'):
|
||||
vals.update(self.update_date_end(vals['stage_id']))
|
||||
vals['date_last_stage_update'] = fields.Datetime.now()
|
||||
task = super(Task, self.with_context(context)).create(vals)
|
||||
return task
|
||||
|
||||
|
||||
Reference in New Issue
Block a user