[FIX] fix useless and invalid casts in domain fields

The ORM will automatically append 00:00:00 to a date
literal that is being compared with a timestamp field
with operators '>' or '>=', and 23:59:59 if compared
with operators '<' or '<='.
So a trivial domain for 'Today' is:
[('tstamp_field','>=',current_date),('tstamp_field','<=',current_date)]
taking advantage of the current_date helper that
is defined as the current date in YYYY-MM-DD format.

bzr revid: odo@openerp.com-20110924005547-pvgblte6r14so7mw
This commit is contained in:
Olivier Dony 2011-09-24 02:55:47 +02:00
parent ccc56996dd
commit 253eaa462d
5 changed files with 6 additions and 6 deletions

View File

@ -248,13 +248,13 @@
/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Today"
domain="[('date::date','=',time.strftime('%%Y-%%m-%%d'))]"
domain="[('date','&gt;=',current_date), ('date','&lt;=',current_date)]"
help="Todays's Helpdesk Requests"
/>
<filter icon="terp-go-week"
string="7 Days"
help="Helpdesk requests during last 7 days"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d')), ('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
domain="[('date','&lt;',current_date), ('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<separator orientation="vertical"/>
<field name="name" string="Query"/>

View File

@ -52,7 +52,7 @@
<search string="Hr Attendance Search">
<filter icon="terp-stock_align_left_24" string="My Attendances" domain="[('employee_id.user_id.id', '=', uid)]" />
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Today" name="today" domain="[('name::date','=',current_date)]" />
<filter icon="terp-go-today" string="Today" name="today" domain="[('name','&gt;=',current_date),('name','&lt;=',current_date)]" />
<separator orientation="vertical"/>
<field name="employee_id"/>
<field name="name"/>

View File

@ -808,7 +808,7 @@
help="Manufacturing Orders which are currently in production."/>
<separator orientation="vertical"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed', 'ready'))]"
domain="['&amp;', ('date_planned','&lt;', current_date), ('state', 'in', ('draft', 'confirmed', 'ready'))]"
help="Production started late" />
<separator orientation="vertical"/>
<field name="name"/>

View File

@ -140,7 +140,7 @@
domain="[('state','=','pause')]"/>
<separator orientation="vertical"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed', 'ready'))]"
domain="['&amp;', ('date_planned','&lt;', current_date), ('state', 'in', ('draft', 'confirmed', 'ready'))]"
help="Production started late" />
<separator orientation="vertical"/>
<field name="name"/>

View File

@ -106,7 +106,7 @@
<filter icon="terp-emblem-important" string="Temporary" name="temp_exceptions" domain="[('state','=','exception'),('message', '=', '')]" help="Temporary Procurement Exceptions"/>
<separator orientation="vertical"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
domain="['&amp;', ('date_planned','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
help="Procurement started late" />
<separator orientation="vertical"/>
<field name="origin"/>