Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

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

By
priyankahdp
on 3/15/13, 2:13 AM 2,818 views

issues corrected

def _random_letter(self, cr, uid, ids, name, args, context):
    num=[]
    for i in range(5):
        res = random.choice([1, 2, 3, 5, 9])
        num.append(res)
        print  (num)
        return num

def _mytest_query(self, cr, uid, ids, name, args, context):
    cr.execute("""update checkroll_plucker set worker_name =concat('worker','%s') where id='1'""", self._random_letter(cr, uid, ids, name, args, context))
    cr.commit()

Error :

  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/sql_db.py", line 219, in execute
    raise ValueError("SQL query parameters should be a tuple, list or dict; got %r" % (params,))
ValueError: SQL query parameters should be a tuple, list or dict; got 5

also I'm still confusing in parameters which we pass in functions. i go through developer book also.but haven't got clear idea.i'll mention those below please correct me if they correct .!

ex :

self, cr, uid, ids, name, args, context

self = call to current class of that method called
cr = current row in the table
uid = user id for check if he authorized or not for run this function
name = column name we need to insert
context = language/time details  (but what is the use of it.more times it equals to None)

hope now this will help you

priyankahdp
on 3/15/13, 2:34 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/15/13, 2:13 AM
Seen: 2818 times
Last updated: 3/16/15, 8:10 AM