Dear ErpNext Community,
I want to create a custom script to fetch Current doctype (for example, Stock Entry) child table values and assign the values to variabls so that i want to use the variables as arguments to call Python function in other doctype ( for example, Material Request). I tried to use locals[cdt][cdn] but with no success.
Please can any one help me resolving this issue?
Thank you In advance for your help.
I am also having some trouble creating something similar… However I want to run everything server side if possible.
Perhaps if we work together we can resolve it.
In my case, I have added a custom field to the Item doctype, which holds currency data, basically an excise tax amount.
When users creates a new Purchase Invoice, the child table has empty rows of Purchase Invoice Items. User adds the first item_code, which has an excise_tax_amount field with data on it.
The expected behavior is that upon refreshing or modifying the item_code field for Purchase Invoice Item, the excise_tax_amount field should be updated with the desired value using:
frm.add_fetch("item_code", "excise_tax_amount", "excise_tax_amount");
frm.add_fetch("[LINK_FIELD]", "[SOURCE_FIELD]", "[TARGET_FIELD]");
The problem I have is that the script works intermittently, so it DOES pull the date, but it is not reliable in doing so. I am trying to find a way to replicate it.
Once the data has been pulled, I can pull the contents of the newly updated field, right after the previous line of code with:
var your_variable = frm.doc.excise_tax_amount;
But until I resolve the trigger problem I will not get anywhere. Once the data has been loaded, the next problem is running a calculation right there and accumulate the data