Looking I found this.
Odoo stores ALL times and dates in UTC, not the local time zone.
My local time 11am
My database 11 am
My treeview 06 am
My Widget in JS 11 am
The view and widget Should have the same time
Py Code:
devicetime = fields.Datetime('Device Time')
@api.model
def js_positions(self):
positions_arg =[('deviceid','=',vehicle.id)]
positions_data =self.search_read(positions_arg, offset=0, limit=1, order='devicetime DESC')
if len(positions_data)>0:
return_positions[vehicle.id] =positions_data[0]
return return_positions
XML Code:
<tree string="Models">
<field name="devicetime"/>
</tree>
JS Code:
rpc.query({
model: 'gpsmap.positions',
method: 'js_positions',
fields: ['devicetime'],
order: 'devicetime DESC',
})
.then(function (result)
{
mycode();
});
Odoo stores ALL times and dates in UTC, not the local time zone.
My local time 11am
My database 11 am
My treeview 06 am
My Widget in JS 11 am
The view and widget Should have the same time
Py Code:
devicetime = fields.Datetime('Device Time')@api.model
def js_positions(self):
positions_arg =[('deviceid','=',vehicle.id)]
positions_data =self.search_read(positions_arg, offset=0, limit=1, order='devicetime DESC')
if len(positions_data)>0:
return_positions[vehicle.id] =positions_data[0]
return return_positions
XML Code:
<tree string="Models"><field name="devicetime"/>
</tree>
JS Code:
rpc.query({model: 'gpsmap.positions',
method: 'js_positions',
fields: ['devicetime'],
order: 'devicetime DESC',
})
.then(function (result)
{
mycode();
});