[IMP]:MRP module sql queries to parameterized query
bzr revid: nch@tinyerp.com-20091124131045-cl53el8bke3o1py2
This commit is contained in:
parent
c214c029d4
commit
c13ca999d8
|
@ -215,9 +215,9 @@ class mrp_bom(osv.osv):
|
||||||
]
|
]
|
||||||
|
|
||||||
def _check_recursion(self, cr, uid, ids):
|
def _check_recursion(self, cr, uid, ids):
|
||||||
level = 500
|
level = 100
|
||||||
while len(ids):
|
while len(ids):
|
||||||
cr.execute('select distinct bom_id from mrp_bom where id in ('+','.join(map(str, ids))+')')
|
cr.execute('select distinct bom_id from mrp_bom where id =ANY(%s)',(ids,))
|
||||||
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
|
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
|
||||||
if not level:
|
if not level:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -98,14 +98,13 @@ class report_custom(report_int):
|
||||||
def create(self, cr, uid, ids, datas, context={}):
|
def create(self, cr, uid, ids, datas, context={}):
|
||||||
assert len(ids), 'You should provide some ids!'
|
assert len(ids), 'You should provide some ids!'
|
||||||
colors = choice_colors(len(ids))
|
colors = choice_colors(len(ids))
|
||||||
ids_str = ','.join(map(str, ids))
|
|
||||||
cr.execute(
|
cr.execute(
|
||||||
"SELECT MAX(mrp_production.date_planned) AS stop,MIN(mrp_production.date_planned) AS start "\
|
"SELECT MAX(mrp_production.date_planned) AS stop,MIN(mrp_production.date_planned) AS start "\
|
||||||
"FROM mrp_workcenter, mrp_production, mrp_production_workcenter_line "\
|
"FROM mrp_workcenter, mrp_production, mrp_production_workcenter_line "\
|
||||||
"WHERE mrp_production_workcenter_line.production_id=mrp_production.id "\
|
"WHERE mrp_production_workcenter_line.production_id=mrp_production.id "\
|
||||||
"AND mrp_production_workcenter_line.workcenter_id=mrp_workcenter.id "\
|
"AND mrp_production_workcenter_line.workcenter_id=mrp_workcenter.id "\
|
||||||
"AND mrp_production.state NOT IN ('cancel','done') "\
|
"AND mrp_production.state NOT IN ('cancel','done') "\
|
||||||
"AND mrp_workcenter.id IN (%s)" % ids_str)
|
"AND mrp_workcenter.id =ANY(%s)",(ids,))
|
||||||
res = cr.dictfetchone()
|
res = cr.dictfetchone()
|
||||||
if not res['stop']:
|
if not res['stop']:
|
||||||
res['stop'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
res['stop'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
@ -136,8 +135,8 @@ class report_custom(report_int):
|
||||||
# select workcenters
|
# select workcenters
|
||||||
cr.execute(
|
cr.execute(
|
||||||
"SELECT id, name FROM mrp_workcenter " \
|
"SELECT id, name FROM mrp_workcenter " \
|
||||||
"WHERE id in (%s) "\
|
"WHERE id=ANY(%s)" \
|
||||||
"ORDER BY mrp_workcenter.id" % ids_str)
|
"ORDER BY mrp_workcenter.id" ,(ids,))
|
||||||
workcenters = cr.dictfetchall()
|
workcenters = cr.dictfetchall()
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
|
Loading…
Reference in New Issue