Try ERPNext Buy Support Partners Foundation

Table Multiselect - TypeError: undefined is not an object (evaluating 'e.fields')

@Iulian_Olaru
Are you using Itinerary DocType (which doesn’t has is_child_table ticked) as a Table field in Event Doctype?

True, the itinerary doctype is not child table.

Only child table DocType can be linked to a Table field in another DocType.

I’ve tried that before and I tried it now again.

Dive guide doctype - child_table
Itinerary doctype - child_table

The result is this error in the browser console:

Uncaught TypeError: Cannot read property 'fields' of undefined
    at o.get_link_field (table_multiselect.js:137)
    at o.set_formatted_input (table_multiselect.js:110)
    at o.set_formatted_input (class.js:53)
    at o.set_input (data.js:76)
    at n (base_input.js:69)
    at o.refresh_input (base_input.js:88)
    at o.refresh (base_control.js:85)
    at init.attach_doc_and_docfields (layout.js:325)
    at init.refresh (layout.js:223)
    at GridRowForm.render (grid_row_form.js:24)

Earlier I put Dive guide doctype as a normal doctype… I refreshed the event and the table multi select worked.

After I refreshed the event to test it again, it didn’t work anymore.

Such a weird thing haha

Keep on being a pain on this subject …

As communicated, the current frappe form does not support 3 tier doctypes: main doctype-child doctype-grand child doctype, because on backend(python side) the base document.py hard coded the CRUD(Create/Read/Update/Delete) logic for the main doctype’s child records only .

To fix your reported issue, I am trying to create a new LinkMultiSelect base on existing TableMultiSelect.

Yeah, let’s see if we can find a work around. I am very happy to sponsor a new type of field as long as we make erpnext more flexible.

Finally I created another new MultiLinkSelect control which now can be used in child table also

this new control is derived from Link ,
, the options in doctype definition is same as Link field’s options, no need to create a separate doctype with at least one link field to be created for MultiTableSelect field/control.

the field is a kind of normal data field field with multi selected linked name separated by comma as the content, see below

in conclusion, this new control is simple and straight forward compared to TableMultiSelect.

1 Like

Finally PR https://github.com/frappe/frappe/pull/8832 created, thanks Julian who funded this development and agreed to contribute to Frappe core.

2 Likes

Hey @szufisher

I can’t seem to find Link Multiselect in my form types. Here’s what I’ve tried:

  • I’ve double-checked making all the changes shown on https://github.com/frappe/frappe/pull/8832/files
  • Run bench build
  • Run bench restart
  • Run bench update --patch
  • Clear cache with Fn + F5 / Settings > Reload
  • Login with different user and browser

goto doctype, find docfield, goto type field, add Link MultiSelect to option

1 Like

Awesome. Thanks ALOT @szufisher, this actually works!

good,if possible please upvote the PR.