search view of 6.1 web client does not honor the fact that dates are stored in UTC timezone in the server

Bug #1093074 reported by renjith k
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

All datetime fields are stored in the UTC timezone in the database .
However the browser displays the datetime converting the time from UTC to the local timezone ..

In the case of a search view the date entered in the search field has to be converted ito UTC timezone before sending it to the server for the actual search ...
The following code of addons/web/static/src/js/search.js

openerp.web.search.DateTimeField = openerp.web.search.DateField.extend(/** @lends openerp.web.search.DateTimeField# */{
    make_domain: function (name, operator, value) {
        return ['&', [name, '>=', value + ' 00:00:00'],
                     [name, '<=', value + ' 23:59:59']];
    }
});

has to be changed to something similar as the following

openerp.web.search.DateTimeField = openerp.web.search.DateField.extend(/** @lends openerp.web.search.DateTimeField# */{
    make_domain: function (name, operator, value) {
        var time_low = Date.parseExact(value + ' 00:00:00' ,'yyyy-MM-dd HH:mm:ss')
        var time_high = Date.parseExact(value + ' 23:59:59' ,'yyyy-MM-dd HH:mm:ss')
        var value_low = openerp.web.datetime_to_str(time_low)
        var value_high = openerp.web.datetime_to_str(time_high)
        return ['&', [name, '>=', value_low],
                     [name, '<=', value_high]];
    }
});

Amit Parik (amit-parik)
affects: openobject-client → openerp-web
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.