Calculations / Custom Script

Hi all,

I have asked already a few weeks ago regarding custom script and calculation…the script itself works…but in order to be calculated I need to enter a value like 1 oder 10 and then save it.

Is there a possibility to be calculated automatically and immediately.

Best,
Daniel

Yes, It is possible,
You can perform any calculation and also set values from custom script.

Here is my script:

cur_frm.cscript.custom_netto_wert = function(doc) {
   rate_calc = (doc.net_total_export / 1.2);
doc.netto_wert = rate_calc;
}

And in the field “netto_wert” I type under options script.custom_netto_wert and then it will be calculated. Optionaly I would like to have a script that does it immediately on save or something like that…how would you do that?

I tried a few other scripts…but it seems that it is not working another way :frowning:

This should work

cur_frm.cscript.netto_wert = function(doc) {
   rate_calc = (doc.net_total_export / 1.2);
   doc.netto_wert = rate_calc;
   refresh_field("netto_wert");
}

Thank you very much. Will Try it

where to call the script? in options from netto_wert or somewhere else?

Can you please explain your usecase?

sorry…this topic simply went out of my sight.

Basically all of the calculations should be done immediately.

Netto_Wert takes the Value from net_total_export and devides it by 1.2 to get a reported “netto_wert”.
This netto_wert ist also printed on the printout. When we forget to enter any digit in “netto_wert” it is not being calculated…but it should be done at least on Save?

Dan

@kolate_sambhaji
have you got a clue?

Maybe anyone else?