Doctype List view doesn't show changed Child Table values

I have a child table select field named “status” that indicates several possible states for an item.

That field appears in the parent DocType list view.

Users can change the value of that field, but the value can also be altered by client-side script in response to other changes.

Unfortunately, if the value in the child table record is changed by a script event, the List View does not show the change.

To force the list value to match the child table item value the user must open and close the child table details.

I have tried refreshing in various ways, but with no success.

erpnext 13.39.2
frappe 13.41.3

Questions:

  1. Is this a known issue in V13?
  2. Is there a way to force the parent List View to reread the select field settings of each child table item.

@MartinHBramwell use a client script to fetch data from child table into parent every time it changes .

1 Like

I am already making quite complex client-side and server-side manipulations to the child table data model. What isn’t clear to me is how to tweak the displayed/viewable representation of the data in the list.

Could I ask you to show me a snippet of how to update a List View value of a child table?

Do I use a jQuery locator? a CSS locator?

@MartinHBramwell now I m just more confused . child tables has no list view .
can you share screenshots to explain your question .

1 Like

Sorry to confuse you. You are right, List View is a confusing term.

That’s true. except that child doc fields have a setting In List View

image

So I was referring to the list (table) representation of child docs when viewing the parent document.

What I have:

  • The parent DocType is “Route Planner”.
  • The child table DocType is “Route Stop”.
  • The status field is defined in “Route Stop”, with In List View set true.
  • Route Planner shows a number of header fields followed by the table of Route Stops.

In four steps:

  1. The Route Stop status field is altered by script
  2. The status field in the table row representation will not show the alteration
  3. If the user opens the detailed view of the table row the correct status will show there
  4. When the user reverts to looking at the parent document again, the Route Stop status field will have been corrected.

I am trying to find the JavaScript technique to add to my code in step #1 to change not only the data value of the status field but also the list view representation of it, to correct the defect of set #2.

@MartinHBramwell just refresh the table after setting the status field by script . refresh_field(“table_name”);

1 Like

OH!

That looks right.

I can no longer check it though. I had to write a work around and have moved on to other things.

Hopefully this will be helpful to someone else someday.

I am grateful for your willingness to help with the problem.
Thank you.

It works! Thank you!

I tried your solution in a different context from before. Same problem different table.

Parent DocType is Customer.

Child DocType is Bought Returnable with two relevant fields:

  1. Motive: Type = Select, Name = motivo
  2. Quantity: Type = Int, Name = cantidad

The Client Script sets the value of cantidad when motivo === 'Remove All'

Child table variable name is compras.

frappe.ui.form.on("Bought Returnable", {
    motivo(frm, cdt, cdn) {
 
              :
         (find relevant row while summing quantities)
              :
              :

        frm.doc.compras[rowMotivo].cantidad = total * -1;
        refresh_field(frm.doc.compras);
    }
  }
);