[FIX] project_timesheet: date of created analytic line not in user tz
When the user was in timezone UTC + 1, and added a project.task.work which created an analytic entry line (timsheet activity), if the datetime was set to 11/25 00:00:00, the date on the analytic line was set to 11/24, because this was the truncated stored value(UTC Time), which was 11/24 23:00:00
This commit is contained in:
parent
4ce7af3573
commit
73f7a2ba35
|
@ -120,7 +120,9 @@ class project_work(osv.osv):
|
|||
vals_line['user_id'] = vals['user_id']
|
||||
vals_line['product_id'] = result['product_id']
|
||||
if vals.get('date'):
|
||||
vals_line['date' ] = vals['date'][:10]
|
||||
timestamp = datetime.datetime.strptime(vals['date'], tools.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
ts = fields.datetime.context_timestamp(cr, uid, timestamp, context)
|
||||
vals_line['date'] = ts.strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
# Calculate quantity based on employee's product's uom
|
||||
vals_line['unit_amount'] = vals['hours']
|
||||
|
|
Loading…
Reference in New Issue