Hi,
I have a child table shown below:
Field Name Data Type Option
code data
PRODUCT data
VARIATION Link Item Alternate Option
I select any value from the variation link, it get passed to a python function along with the item code and returns an item code, I am just updating the value of field code with the item code returned, but it doesn’t allow me to save and give the below error:
Traceback (most recent call last):
File "/home/vishnu/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 12, in savedocs
doc = frappe.get_doc(json.loads(doc))
File "/home/vishnu/frappe-bench/apps/frappe/frappe/__init__.py", line 606, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/document.py", line 51, in get_doc
return controller(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py", line 25, in __init__
super(SalesOrder, self).__init__(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py", line 20, in __init__
super(AccountsController, self).__init__(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/document.py", line 87, in __init__
super(Document, self).__init__(arg1)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 52, in __init__
self.update(d)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 75, in update
self.set(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 122, in set
self.extend(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 148, in extend
self.append(key, v)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 136, in append
value = self._init_child(value, key)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 163, in _init_child
value = get_controller(value["doctype"])(value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/document.py", line 87, in __init__
super(Document, self).__init__(arg1)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 52, in __init__
self.update(d)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 75, in update
self.set(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 122, in set
self.extend(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 148, in extend
self.append(key, v)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 143, in append
raise ValueError, "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'
Traceback (most recent call last):
File "/home/vishnu/frappe-bench/apps/frappe/frappe/app.py", line 56, in application
response = frappe.handler.handle()
File "/home/vishnu/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
execute_cmd(cmd)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/handler.py", line 42, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/__init__.py", line 907, in call
return fn(*args, **newargs)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 12, in savedocs
doc = frappe.get_doc(json.loads(doc))
File "/home/vishnu/frappe-bench/apps/frappe/frappe/__init__.py", line 606, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/document.py", line 51, in get_doc
return controller(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py", line 25, in __init__
super(SalesOrder, self).__init__(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py", line 20, in __init__
super(AccountsController, self).__init__(arg1, arg2)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/document.py", line 87, in __init__
super(Document, self).__init__(arg1)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 52, in __init__
self.update(d)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 75, in update
self.set(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 122, in set
self.extend(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 148, in extend
self.append(key, v)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 136, in append
value = self._init_child(value, key)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 163, in _init_child
value = get_controller(value["doctype"])(value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/document.py", line 87, in __init__
super(Document, self).__init__(arg1)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 52, in __init__
self.update(d)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 75, in update
self.set(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 122, in set
self.extend(key, value)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 148, in extend
self.append(key, v)
File "/home/vishnu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 143, in append
raise ValueError, "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'
Regards
Ruchin Sharna