This question has been flagged
4 Replies
14097 Views

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
Best Answer

Hi Shayar,

Inspite of COMMA ',' try using '%'

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

Avatar
Discard
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
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
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