hi
the master doctype (materials) have a child table (location_and_price) with two fields ( location and price)
In another doctype (cbd) I have a link field ( material ) linked to the doc type (materials)
and also another two fields ( location and price) with field type “select”
so now when I select material on cbd the two fields should automatically populate form the materials chlid table
i tried
i tried cur_frm.add_fetch('material_name', 's_location', 'd_location')
but the source field “s_location” is found in a child table called “LocationAndPirce” doctype
it returns Server Error: OperationalError: (1054, "Unknown column 's_location' in 'field list'")
Traceback (most recent call last):
File "/home/ommi/frappe-bench/apps/frappe/frappe/app.py", line 55, in application
response = frappe.handler.handle()
File "/home/ommi/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
execute_cmd(cmd)
File "/home/ommi/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File "/home/ommi/frappe-bench/apps/frappe/frappe/__init__.py", line 876, in call
return fn(*args, **newargs)
File "/home/ommi/frappe-bench/apps/frappe/frappe/desk/form/utils.py", line 44, in validate_link
% (fetch, frappe.db.escape(options), '%s'), (value,))[0]]
File "/home/ommi/frappe-bench/apps/frappe/frappe/database.py", line 137, in sql
self._cursor.execute(query, values)
File "/home/ommi/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/home/ommi/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'item_code' in 'field list'")
source field must be a linked doctype parent field
link field and target field must be part of the same doctype. If link field is in parent form, target field also should be in parent form, otherwise both fields should be part of the same child table.
In the above case, as bom_no is a field of parent and item code is in child table, it should nto work. You have to write some other custom scripts for it.