Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1405 Näkymät

We have created a custom planning app.

Last thing to make it fully work is the following.

We have created an automated action that adds a line in time entry of the project/task timescheet.

Everything works except the time is subtracted by 2 ours.

So lets say the line should be 15:00 it's 13:00 in the timesheet app, i think there is something with timezone.

How do we fix this?


See code


task = env['x_Customplan'].browse(record.id)



start_time = task.x_studio_start_time

end_time = task.x_studio_end_time 


if start_time and end_time:

    duration_seconds = (end_time - start_time).total_seconds()


    duration_hours = duration_seconds / 3600.0

    

    

timesheet = env['account.analytic.line'].create({

    'name' : task.x_name,

    'project_id': task.x_studio_project.id if task.x_studio_project else None,

    'task_id': task.x_studio_taak.id if task.x_studio_taak else None,

    'date' : task.x_studio_start_time.strftime('%Y-%m-%d'),

    'x_studio_char_field_776_1hg0t17l3' : task.x_studio_start_time.strftime('%H:%M'),

    'x_studio_char_field_3ou_1hg0t3rg2' : task.x_studio_end_time.strftime('%H:%M'),

    'unit_amount' : duration_hours,

    

})

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
heinäk. 25
1282
2
maalisk. 25
1545
0
helmik. 25
1190
0
helmik. 25
1400
0
helmik. 25
1322