[FIX] mrp: don't select bom out of current date range, replace sql query by orm request

lp bug: https://launchpad.net/bugs/1049415 fixed

bzr revid: mat@openerp.com-20130924122123-v4sgyx5v08ikqzsx
This commit is contained in:
Martin Trigaux 2013-09-24 14:21:23 +02:00
commit 89848bce01
1 changed files with 4 additions and 2 deletions

View File

@ -296,8 +296,10 @@ class mrp_bom(osv.osv):
"""
if properties is None:
properties = []
cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
ids = map(lambda x: x[0], cr.fetchall())
domain = [('product_id', '=', product_id), ('bom_id', '=', False),
'|', ('date_start', '=', False), ('date_start', '<=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
'|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))]
ids = self.search(cr, uid, domain)
max_prop = 0
result = False
for bom in self.pool.get('mrp.bom').browse(cr, uid, ids):