How sum 2 numbers in doctype EASY

hi, i a new to frappe/erpnext and try to make a very simple doctype(demo) but can’t make a simple operation.

In resumen need just sum 2 numbers in a field. but all post are “script” or someting and unknow how make a script and of course documentation is more complex.

Any SIMPLE explain how make this simple action?

frappe.ui.form.on('DEMO', {
    refresh(frm){
        frm.doc.sumatoria = frm.doc.numero1 + frm.doc.numero2;
        refresh_field("sumatoria");
    }
});
3 Likes

tanks, is working. The only aditional question is how to update after modify a value because is working when save but refresh_field not update in real time when change a value.

1 Like
frappe.ui.form.on('DEMO', {
    numero1: function(frm){
        frm.doc.sumatoria = frm.doc.numero1 + frm.doc.numero2;
        refresh_field("sumatoria");
    },
    numero2: function(frm){
        frm.doc.sumatoria = frm.doc.numero1 + frm.doc.numero2;
        refresh_field("sumatoria");
    }
});
4 Likes

how to compare 6 field values using custom script.
ex:- set of a+b, c+d,e+f
from same document…
please help …

Elaborate your query