跳至内容
菜单
此问题已终结
4 回复
16403 查看

When iam running code iam getting  error like this 'SQL query parameters should be a tuple, list or dict'

This is my code

@api.multi

def issue_material(self):

jobsheet_no = self.jobsheet_no

self.ensure_one()

result = []

self.env.cr.execute("""SELECT move.name as product,move.product_uom_qty as quantity,pick.name as                 delivered from stock_move move,stock_picking pick where move.picking_id = pick.id and                 move.state = 'done' and move.location_id!=9 and pick.jobsheet_no=%s""",(jobsheet_no.id))

形象
丢弃
最佳答案

Hi Shayar,

Inspite of COMMA ',' try using '%'

pick.jobsheet_no=%s"""%(jobsheet_no.id)

形象
丢弃
最佳答案

hello shayar,

try jobsheet_no.ids  instead of jobsheet_no.id

self.env.cr.execute("""SELECT move.name as product,move.product_uom_qty as quantity,pick.name as                 delivered from stock_move move,stock_picking pick where move.picking_id = pick.id and                 move.state = 'done' and move.location_id!=9 and pick.jobsheet_no=%s""",(jobsheet_no.ids))

形象
丢弃
最佳答案

Use this one

self.env.cr.execute("""SELECT move.name as product,move.product_uom_qty as quantity,pick.name as                 
delivered    from stock_move move,stock_picking pick where move.picking_id = pick.id
and                 move.state = 'done'
and move.location_id!=9
and pick.jobsheet_no="""+str(jobsheet_no.id)+"""""")


形象
丢弃
最佳答案

in sql query you are using %s parameter

so you have to pass arguments using %s only

but here end of the query you are passing , operator instead of %s


 

形象
丢弃