I made one method to fetch the record of child table
Py Method is
@frappe.whitelist(allow_guest=True)
def fetchTable(self,method):
frappe.msgprint(self.flat_tax)
doc_req = []
if not self.flat_table and self.flat_tax:
doc_master = frappe.get_doc(“MasterTable”, self.flat_tax)
#frappe.msgprint(doc_master)
for value in doc_master.get(“child_table”):
doc_req = {
“doctype”: “ChildTable”,
“description”: value.description,
“rate”: value.rate,
“amount”:self.flat_total*value.rate/100
}
self.append(“flat_table”, doc_req)
If i am calling this method from hooks.py ex: as follows
doc_events = {
“Sales Invoice”: {
“validate”: “erpnext.crm.ef_doc.fetchTable”
},
}
Successfully run and my table getting filed , But when i calling this same function through Custom Script which is as follows
cur_frm.cscript.flat_tax= function(doc) {
if(1) {
cur_frm.call({
method: “erpnext.crm.ef_doc.fetchTable”,
args: {
“flat_tax”: doc.flat_tax,
},
callback: function(r, rt) {
if(r.message) {
}
}
});
}
}
I getting this error
Traceback (innermost last):
File “/home/erpnext4/frappe-bench/apps/frappe/frappe/app.py”, line 51, in application
response = frappe.handler.handle()
File “/home/erpnext4/frappe-bench/apps/frappe/frappe/handler.py”, line 69, in handle
execute_cmd(cmd)
File “/home/erpnext4/frappe-bench/apps/frappe/frappe/handler.py”, line 92, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/erpnext4/frappe-bench/apps/frappe/frappe/init.py”, line 751, in call
return fn(*args, **newargs)
TypeError: fetchTable() takes exactly 2 arguments (0 given)
Which type of argument error it’s giving (only one args required to fetch the table)