Skip to Content
Menu
This question has been flagged
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();
            });
Avatar
Discard
Related Posts Replies Views Activity
2
May 21
17604
1
Apr 23
1063
1
Nov 18
3437
2
Oct 18
6612
2
Aug 18
6736