This is my first post and do kindly excuse me for any mistakes.
I have been struggling to find a solution for this, really appreciate if you could help me please. Basically i am trying to enable/disable editing two fields namely invoice_quantity and invoice_amount in grid table based on a parent field value(Select field with options as “Item Based”/“Milestone Based”/“Piece Rate Work Based(PRW)”) as mentioned below. But the problem is it works for the first time, when i select another option from the parent select field, same settings of previous selection are still applied instead of getting overwritten by the new settings. And the strange thing is new changes are applied inside when i click on grid table’s edit(arrow mark on the right) but the same not applied on grid row.
For example, if i select parent field option “Item Based” then invoice_amount in grid table should not be editable for the end user, when i select parent field option “Milestone Based” then invoice_quantity in grid table should not be editable. Below is the code which i am calling from onload and refresh events of the parent doctype.
Only difference with what you suggested is from where i call the function toggle_items_based_on_boq_type, instead of calling the function on option change for frm.doc.boq_type i am calling on refresh and onload, i have to do this because the value is actually coming from a mapped document using get_mapped_doc.
First i tried boq_type as “Item Based”, and it worked fine i.e., invoice_quantity field is enabled and invoice_amount field is disabled as desired. And the variable values are
And for the second try, i tried boq_type as “Milestone Based” and here comes the problem, invoice_quantity field is still enabled instead of disabled and invoice_amount field is still disabled instead of getting enabled. But when i edit the row, the changes are taken effect inside “Edit row” i.e., invoice_quantity is disabled and invoice_amount is enabled. And the variable values are
I tried calling the function on change of boq_type too, but it never gets called as boq_type is a readonly field in this doctype(“Project Invoice”) and gets the values populated from master doctype “BOQ” via get_mapped_doc.
Just uploaded this video(without audio) for your understanding - YouTube