Help

2

ValueError: SQL query parameters should be a tuple, list or dict

Avatar
shayar

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))

Avatar
Discard
4 Answers
2
Avatar
Pawan
Best Answer

Hi Shayar,

Inspite of COMMA ',' try using '%'

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

Avatar
Discard
1
Avatar
Thayif kabir
Best Answer

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))

Avatar
Discard
0
Avatar
Sehrish
Best Answer

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)+"""""")


Avatar
Discard
0
Avatar
subbarao
Best Answer

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


 

Avatar
Discard