[solved] Cur_frm.add_fetch() between "Sale Invoice" and "File" not working

I have added a custom script to Sales Invoice:

cur_frm.add_fetch('xml_file',  'file_url',  'file_url');

The "file" doctype defines the correspondant field like this:

FileDocType_file_url

The customized form section looks like this:

I want to hide the field "XML File" and show only the "File URL", but I cannot get the latter to show any value.

I fear I have missed some important setting, but I don’t understand what it might be.
I tried setting file_url to read-only but all that does is hide the empty "File URL" field.

Question: Can you see what I might be doing wrong?

My form customization json for the xml_file field looks like this:

 {
   "allow_on_submit": 1,
        :           :
   "depends_on": null,
        :           :
   "dt": "Sales Invoice",
   "fetch_from": null,
        :           :
   "fieldname": "xml_file",
   "fieldtype": "Link",
   "hidden": 0,
   "idx": 30,
   "ignore_user_permissions": 0,
   "ignore_xss_filter": 0,
        :           :
   "label": "XML File",
        :           :
   "name": "Sales Invoice-xml_file",
   "no_copy": 0,
   "options": "File",
        :           :
   "read_only": 0,
 },

My form customization json for the file_url field looks like this:

{
   "allow_on_submit": 1,
        :           :
   "depends_on": null,
        :           :
   "dt": "Sales Invoice",
   "fetch_from": null,
        :           :
   "fieldname": "file_url",
   "fieldtype": "Data",
   "hidden": 0,
   "idx": 31,
   "ignore_user_permissions": 0,
   "ignore_xss_filter": 0,
        :           :
   "label": "File URL",
        :           :
   "name": "Sales Invoice-file_url",
   "no_copy": 0,
   "options": null,
        :           :
   "read_only": 1,
  }


Full listing:

{
 "custom_fields": [
  {
  },

        :           :
  {
   "_assign": null,
   "_comments": null,
   "_liked_by": null,
   "_user_tags": null,
   "allow_in_quick_entry": 0,
   "allow_on_submit": 1,
   "bold": 0,
   "collapsible": 0,
   "collapsible_depends_on": "",
   "columns": 0,
   "creation": "2020-05-04 11:58:55.492362",
   "default": null,
   "depends_on": null,
   "description": null,
   "docstatus": 0,
   "dt": "Sales Invoice",
   "fetch_from": null,
   "fetch_if_empty": 0,
   "fieldname": "xml_file",
   "fieldtype": "Link",
   "hidden": 0,
   "idx": 30,
   "ignore_user_permissions": 0,
   "ignore_xss_filter": 0,
   "in_global_search": 0,
   "in_list_view": 0,
   "in_standard_filter": 0,
   "insert_after": "column_break_27",
   "label": "XML File",
   "length": 0,
   "modified": "2020-05-04 11:58:55.492362",
   "modified_by": "Administrator",
   "name": "Sales Invoice-xml_file",
   "no_copy": 0,
   "options": "File",
   "owner": "Administrator",
   "parent": null,
   "parentfield": null,
   "parenttype": null,
   "permlevel": 0,
   "precision": "",
   "print_hide": 0,
   "print_hide_if_no_value": 0,
   "print_width": null,
   "read_only": 0,
   "report_hide": 0,
   "reqd": 0,
   "search_index": 0,
   "translatable": 0,
   "unique": 0,
   "width": null
  },
        :           :
  {
   "_assign": null,
   "_comments": null,
   "_liked_by": null,
   "_user_tags": null,
   "allow_in_quick_entry": 0,
   "allow_on_submit": 1,
   "bold": 0,
   "collapsible": 0,
   "collapsible_depends_on": "",
   "columns": 0,
   "creation": "2020-05-04 12:10:35.320865",
   "default": null,
   "depends_on": null,
   "description": null,
   "docstatus": 0,
   "dt": "Sales Invoice",
   "fetch_from": null,
   "fetch_if_empty": 0,
   "fieldname": "file_url",
   "fieldtype": "Data",
   "hidden": 0,
   "idx": 31,
   "ignore_user_permissions": 0,
   "ignore_xss_filter": 0,
   "in_global_search": 0,
   "in_list_view": 0,
   "in_standard_filter": 0,
   "insert_after": "xml_file",
   "label": "File URL",
   "length": 0,
   "modified": "2020-05-04 12:10:35.320865",
   "modified_by": "Administrator",
   "name": "Sales Invoice-file_url",
   "no_copy": 0,
   "options": null,
   "owner": "Administrator",
   "parent": null,
   "parentfield": null,
   "parenttype": null,
   "permlevel": 0,
   "precision": "",
   "print_hide": 0,
   "print_hide_if_no_value": 0,
   "print_width": null,
   "read_only": 1,
   "report_hide": 0,
   "reqd": 0,
   "search_index": 0,
   "translatable": 1,
   "unique": 0,
   "width": null
  }
]
1 Like

affs

I was making changes and continuously reloading my example invoice.

Out of desperation I changed to a different uploaded file and "Hah! Hah! Hah! Hah! " it had been working all the time.

1 Like