Hello;
I am facing this error only when I need to print the document and after I clicked on button that run js and py scripts:
"Document attached to child table must be a dict or BaseDocument, not " + str(type(value))[1:-1]
ValueError: Document attached to child table must be a dict or BaseDocument, not type ‘list’
In my py script, I used db sql and in the js I converted some values to float because I need to do arithmetic calculations. So what is the solution?
Note: if I need to print the document and I did not click on the button, there is no errors appear.
SUM_TA_board = 0
SUM_RC_board = 0
SUM_CC_board = 0
SUM_FC_board = 0
SUM_SwPFCSS_board = frappe.db.sql("""
select sum(amount) as total
from `tabSalary Detail`
where parent in (select name from `tabSalary Slip`
where employee in (select employee from tabEmployee where employment_type like %(emp_type)s)
and start_date >= %(from_date)s)
and abbr = 'SwPFCSS'
""", {"emp_type": "Board%", "from_date": from_period})
return SUM_SwPFCSS_board
If I used as_dict=True in the sql query, then the error disappear.
Any help how to overcome this error without need to use as_dict=True?
Again, it is appearing only when I need to print. So, what is the relation between this error and the print?