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

Error: not enough arguments for format string

By
nasim
on 8/3/15, 3:51 AM 706 views

Error: not enough arguments for format string

Code python:

def _getnametahlili(self, user, fromDate, toDate):

sql = " SELECT aaa.name,round(sum(aal.unit_amount)) FROM                              account_analytic_account as aaa,
account_analytic_line as aal
WHERE aaa.id=aal.account_id and aal.user_id=%d and aal.date BETWEEN \'%s\' AND \'%s\' Group By aaa.name
except
SELECT aaa.name,round(sum(aal.unit_amount)) FROM account_analytic_account as aaa
inner join account_analytic_line as aal on aal.account_id=aaa.id
inner join project_project as pp on pp.analytic_account_id=aal.account_id
WHERE aal.user_id=%d and aal.date BETWEEN \'%s\' AND \'%s\'
 Group By aaa.name"
%(user.id, fromDate, toDate)
  self.cr.execute(sql)
  return self.cr.fetchall()

please Help me…………………………..


0
Timo Talvitie
On 8/3/15, 5:43 AM

It looks like your SQL query expects 6 parameters, but it is receiving only 3. Try setting the parameters like this

% (user.id, fromDate, toDate, user.id, fromDate, toDate)

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: 8/3/15, 3:51 AM
Seen: 706 times
Last updated: 8/3/15, 5:49 AM