[FIX] stock,event,pos: fix "today" filter with regard to timezones

The previous filters didn't take timezones into account, and
returned stringified naive datetime values in local browser
time. Those would then be interpreted by the server-side as
UTC date, and depending on the current timezone offset vs UTC,
yield partially incorrect results.

By returning directly a datetime.datetime object instead of
a stringified version (see previous commit 76881fb),
we can get the expected result regarless of the timezone.

Fixes #2972
Closes #6229

opw-621282
This commit is contained in:
Nicolas Lempereur 2015-04-13 16:31:04 +02:00 committed by Olivier Dony
parent 76881fb226
commit 81a3f56651
3 changed files with 3 additions and 3 deletions

View File

@ -293,7 +293,7 @@
<separator/>
<filter icon="terp-personal" string="My Events" help="My Events" domain="[('user_id','=',uid)]"/>
<separator/>
<filter icon="terp-go-today" string="Upcoming" name="upcoming" domain="[('date_begin','&gt;=', time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Upcoming events from today" />
<filter icon="terp-go-today" string="Upcoming" name="upcoming" domain="[('date_begin','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Upcoming events from today" />
<field name="type"/>
<field name="user_id"/>
<group expand="0" string="Group By...">

View File

@ -986,7 +986,7 @@
<field name="name" />
<filter string="Open" domain="[('state', '=', 'opened')]" />
<separator/>
<filter string="Today" domain="[('start_at', '>=', time.strftime('%%Y-%%m-%%d 00:00:00'))]" />
<filter string="Today" domain="[('start_at', '>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" />
<field name="config_id" />
<field name="user_id" />
<group expand="0" string="Group By...">

View File

@ -1368,7 +1368,7 @@
<filter icon="terp-stock" string="To Do" name="future" domain="[('state','in',('assigned','confirmed','waiting'))]" help="Stock moves that are Confirmed, Available or Waiting"/>
<filter icon="terp-dialog-close" string="Done" name="done" domain="[('state','=','done')]" help="Stock moves that have been processed"/>
<separator/>
<filter icon="terp-go-today" string="Today" domain="[('date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/>
<filter icon="terp-go-today" string="Today" domain="[('date','&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Orders processed Today or planned for Today"/>
<field name="product_id"/>
<field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
<field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','child_of',self)]"/>