Help error on frappe metod

Hi,

i just got the following error :

Traceback (innermost last):
File “/home/sigma/frappe-bench/apps/frappe/frappe/widgets/form/save.py”, line 18, in savedocs
doc.save()
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 175, in save
self.insert()
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 162, in insert
self.run_post_save_methods()
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 442, in run_post_save_methods
self.run_method(“on_update”)
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 412, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 493, in composer
return composed(self, method, *args, **kwargs)
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 476, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 406, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/sigma/frappe-bench/apps/manufacture_costing/manufacture_costing/manufacture_costing/doctype/production_actual_cost/production_actual_cost.py”, line 29, in on_update
monthly=self.get_monthly_cost(filters)
File “/home/sigma/frappe-bench/apps/manufacture_costing/manufacture_costing/manufacture_costing/doctype/production_actual_cost/production_actual_cost.py”, line 273, in get_monthly_cost
monthly_cost=frappe.db.sql(""“SELECT sum(credit-debit) as total from tabJournal Voucher Detail jvd JOIN tabJournal Voucher jv on jvd.parent=jv.name where jvd.docstatus=1 and jv.docstatus=1 and (jvd.against_account like “522%” or jvd.against_account like “523%”) and jv.posting_date between %(from_date)s and %(to_date)s group by NULL”"",filters,as_dict=1)
File “/home/sigma/frappe-bench/apps/frappe/frappe/database.py”, line 110, in sql
self._cursor.execute(query, values)
File “/home/sigma/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 185, in execute
for key, item in args.iteritems())
ValueError: unsupported format character ‘"’ (0x22) at index 198

Traceback (innermost last):
File “/home/sigma/frappe-bench/apps/frappe/frappe/app.py”, line 49, in application
response = frappe.handler.handle()
File “/home/sigma/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/sigma/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/sigma/frappe-bench/apps/frappe/frappe/init.py”, line 531, in call
return fn(*args, **newargs)
File “/home/sigma/frappe-bench/apps/frappe/frappe/widgets/form/save.py”, line 18, in savedocs
doc.save()
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 175, in save
self.insert()
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 162, in insert
self.run_post_save_methods()
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 442, in run_post_save_methods
self.run_method(“on_update”)
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 412, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 493, in composer
return composed(self, method, *args, **kwargs)
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 476, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py”, line 406, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/sigma/frappe-bench/apps/manufacture_costing/manufacture_costing/manufacture_costing/doctype/production_actual_cost/production_actual_cost.py”, line 29, in on_update
monthly=self.get_monthly_cost(filters)
File “/home/sigma/frappe-bench/apps/manufacture_costing/manufacture_costing/manufacture_costing/doctype/production_actual_cost/production_actual_cost.py”, line 273, in get_monthly_cost
monthly_cost=frappe.db.sql(""“SELECT sum(credit-debit) as total from tabJournal Voucher Detail jvd JOIN tabJournal Voucher jv on jvd.parent=jv.name where jvd.docstatus=1 and jv.docstatus=1 and (jvd.against_account like “522%” or jvd.against_account like “523%”) and jv.posting_date between %(from_date)s and %(to_date)s group by NULL”"",filters,as_dict=1)
File “/home/sigma/frappe-bench/apps/frappe/frappe/database.py”, line 110, in sql
self._cursor.execute(query, values)
File “/home/sigma/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 185, in execute
for key, item in args.iteritems())

on my code :
filters is a dict that contains :
from_date=“2001-01-01”
to_date=“2014-11-11”
filters={“from_date”:from_date,“to_date”:to_date}

def get_monthly_cost(self,filters):
monthly_cost=frappe.db.sql(""“SELECT sum(credit-debit) as total from tabJournal Voucher Detail jvd JOIN tabJournal Voucher jv on jvd.parent=jv.name where jvd.docstatus=1 and jv.docstatus=1 and (jvd.against_account like “522%” or jvd.against_account like “523%”) and jv.posting_date between %(from_date)s and %(to_date)s group by NULL”"",filters,as_dict=1)
if monthly_cost and monthly_cost[0]:
return monthly_cost[0]
return 0

i dont know what was the cause , please advise

thanks

@bobzz_zoneb HI
I am facing same problem!
Did you find solution for this?

Hi,

For me i got problem with the queries values

hope this will fix yours too

Thanks