← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 649148] Re: [trunk] stock move analysis - wrong domain

 

the current code will miss the moves of the last day as data are stored
with time

        date         
---------------------
 2010-11-08 10:53:16
 2010-11-08 10:53:20
 2010-11-08 10:50:30
 2010-11-08 10:53:14
 2010-11-05 10:52:18
 2010-11-16 10:52:21
 2010-11-19 11:33:49
 2010-11-05 00:00:00
 2010-11-02 10:52:19

for YEAR
domain="[('date','<=', time.strftime('%%Y-%%m-%%d'))
will miss todays moves

for Current Month
domain="[('date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),
will miss  moves of the last day of this month

for Last Month
domain="[('date','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d'))
will miss  moves of the last day of last month

Solution 
either 
* date_trunc('day',date) (will IMHO not use index if exists)
* 'date','&lt; <fist date of the next month>

I consider this a show stopper, as it returns wrong data in all
"Analysis" Reports

** Changed in: openobject-addons
       Status: Incomplete => New

-- 
[trunk] stock move analysis - wrong domain
https://bugs.launchpad.net/bugs/649148
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: New

Bug description:
                 domain="[('date_planned','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date_planned','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"

should be 
'&gt;=' 

domain="[('date_planned','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date_planned','&gt;=',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"

I really wonder why OpenERP uses unreadable code - see suggestions
https://bugs.launchpad.net/openobject-addons/+bug/626867