[FIX]:fix string problem
bzr revid: nch@tinyerp.com-20091125103450-gla544qdr273udgy
This commit is contained in:
parent
19faaa8222
commit
8354496c6d
|
@ -41,19 +41,19 @@ class product_product(osv.osv):
|
|||
res[val.id]['date_to']=date_to
|
||||
if 'invoice_state' in field_names:
|
||||
res[val.id]['invoice_state']=invoice_state
|
||||
invoice_types=[]
|
||||
states=[]
|
||||
invoice_types=()
|
||||
states=()
|
||||
if invoice_state=='paid':
|
||||
states=['paid']
|
||||
states=('paid')
|
||||
elif invoice_state=='open_paid':
|
||||
states=['open','paid']
|
||||
states=('open','paid')
|
||||
elif invoice_state=='draft_open_paid':
|
||||
states=['draft','open','paid']
|
||||
states=('draft','open','paid')
|
||||
|
||||
if 'sale_avg_price' in field_names or 'sale_num_invoiced' in field_names or 'turnover' in field_names or 'sale_expected' in field_names:
|
||||
invoice_types=['out_invoice','in_refund']
|
||||
invoice_types=('out_invoice','in_refund')
|
||||
if 'purchase_avg_price' in field_names or 'purchase_num_invoiced' in field_names or 'total_cost' in field_names or 'normal_cost' in field_names:
|
||||
invoice_types=['in_invoice','out_refund']
|
||||
invoice_types=('in_invoice','out_refund')
|
||||
if len(invoice_types):
|
||||
cr.execute("""select
|
||||
avg(l.price_unit) as avg_unit_price,
|
||||
|
@ -64,7 +64,7 @@ class product_product(osv.osv):
|
|||
from account_invoice_line l
|
||||
left join account_invoice i on (l.invoice_id = i.id)
|
||||
left join product_template product on (product.id=l.product_id)
|
||||
where l.product_id = %s and i.state =ANY(%s) and i.type =ANY(%s) and i.date_invoice>=%s and i.date_invoice<=%s
|
||||
where l.product_id = %s and i.state in %s and i.type in %s and i.date_invoice>=%s and i.date_invoice<=%s
|
||||
""",(val.id,states,invoice_types,date_from,date_to))
|
||||
result=cr.fetchall()[0]
|
||||
if 'sale_avg_price' in field_names or 'sale_num_invoiced' in field_names or 'turnover' in field_names or 'sale_expected' in field_names:
|
||||
|
|
|
@ -101,7 +101,7 @@ class product_product(osv.osv):
|
|||
'and location_dest_id =ANY(%s)'\
|
||||
'and product_id =ANY(%s)'\
|
||||
'and state in %s' + (date_str and 'and '+date_str+' ' or '') +''\
|
||||
'group by product_id,product_uom',(location_ids,location_ids,ids,states,)
|
||||
'group by product_id,product_uom',(location_ids,location_ids,ids,tuple(states),)
|
||||
)
|
||||
results = cr.fetchall()
|
||||
if 'out' in what:
|
||||
|
@ -113,7 +113,7 @@ class product_product(osv.osv):
|
|||
'and location_dest_id <> ANY(%s) '\
|
||||
'and product_id =ANY(%s)'\
|
||||
'and state in %s' + (date_str and 'and '+date_str+' ' or '') + ''\
|
||||
'group by product_id,product_uom',(location_ids,location_ids,ids,states,)
|
||||
'group by product_id,product_uom',(location_ids,location_ids,ids,tuple(states),)
|
||||
)
|
||||
results2 = cr.fetchall()
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
|
|
@ -68,10 +68,10 @@ class report_stock(report_int):
|
|||
|
||||
cr.execute("select sum(r.product_qty * u.factor), r.date_planned, r.product_id "
|
||||
"from stock_move r left join product_uom u on (r.product_uom=u.id) "
|
||||
"where state =ANY(%s)"
|
||||
"where state in %s"
|
||||
"and location_id=ANY(%s)"
|
||||
"and product_id=ANY(%s)"
|
||||
"group by date_planned,product_id",(['confirmed','assigned','waiting'],loc_ids ,product_ids,))
|
||||
"group by date_planned,product_id",(('confirmed','assigned','waiting'),loc_ids ,product_ids,))
|
||||
for (qty, dt, prod_id) in cr.fetchall():
|
||||
if dt<=dt_from:
|
||||
dt= (DateTime.now() + DateTime.RelativeDateTime(days=1)).strftime('%Y-%m-%d')
|
||||
|
@ -82,10 +82,10 @@ class report_stock(report_int):
|
|||
|
||||
cr.execute("select sum(r.product_qty * u.factor), r.date_planned, r.product_id "
|
||||
"from stock_move r left join product_uom u on (r.product_uom=u.id) "
|
||||
"where state=ANY(%s)"
|
||||
"where state in %s"
|
||||
"and location_dest_id=ANY(%s)"
|
||||
"and product_id=ANY(%s)"
|
||||
"group by date_planned,product_id",(['confirmed','assigned','waiting'],loc_ids ,product_ids,))
|
||||
"group by date_planned,product_id",(('confirmed','assigned','waiting'),loc_ids ,product_ids,))
|
||||
|
||||
for (qty, dt, prod_id) in cr.fetchall():
|
||||
if dt<=dt_from:
|
||||
|
|
Loading…
Reference in New Issue