Problem fetching values to child table after update

Hi ,

I was using the below code to fetch values into a child table , it was working perfectly but after the update the below code is not working , please help


frappe.ui.form.on("Customer TDC", "refresh", function(frm, doctype, name) 
		cur_frm.get_field("percnt_carbon_min").get_query = function(doc, cdt, cdn) 
			var item = frappe.get_doc(cdt, cdn);
			var c = " ";
            if (item.grade) c=item.grade ;
            return { filters: {'grade': c}} 

Is any function depreciated in the update ?


can you share the console logs ?

Thanks, Makarand

1 Like

Thank you @makarand_b for responding , I am not getting any error in the console log ?

check the add_fetch method syntax, You are missing target_fieldname

add_fetch(link_fieldname, source_fieldname, target_fieldname)

Thanks, Makarand

1 Like

@makarand_b .Thanks for the reply . Yes I did , but it is not working , the code works perfectly in a parent but does not work for a child table , it was working even in the child before the update . What should I do ?

I even tried with the below function , but no clue why it is not working ? Can anyone help me with this please

frappe.ui.form.on('Purchase Order Item', 'grade', function(frm, cdt, cdn){{
        'method': 'frappe.client.get_value',
        'args': {
            'doctype': 'Grade',
            'filters': [
                ['Grade', 'grade', '=', locals[cdt][cdn].grade]
        'callback': function(r){
            frappe.mode.set_value(cdt, cdn, 'percnt_carbon_min', r.message.percnt_carbon_min);

Hi @Muthu,

it should be frappe.model.set_value(doctype, docname, fieldname, value)

Thanks, Makarand

1 Like

Hi @makarand_b Thanks for the reply I tried and I got this , please help.

Source field percnt_carbon_min
Target field percnt_carbon_min
link field name grade
module grade

Traceback (most recent call last):
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 55, in application
    response = frappe.handler.handle()
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 19, in handle
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 36, in execute_cmd
    ret =, **frappe.form_dict)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 876, in call
    return fn(*args, **newargs)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 47, in get_value
    return frappe.db.get_value(doctype, filters, fieldname, as_dict=as_dict, debug=debug)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 410, in get_value
    ret = self.get_values(doctype, filters, fieldname, ignore, as_dict, debug, cache=cache)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 439, in get_values
    out = self._get_value_for_many_names(doctype, filters, fieldname, debug=debug)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 572, in _get_value_for_many_names
    % (field, doctype, ", ".join(["%s"]*len(names))), names, debug=debug))
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 137, in sql
    self._cursor.execute(query, values)
  File "/home/ommi/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/ommi/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1241, 'Operand should contain 1 column(s)')

After trying in for hours together I almost gave up . Could anyone please help me , I am not able to fetch data into a child table .

Could anyone please tell me how do I go back to v6.27 I am now on v7 beta , in earlier version I din have this problem.