اضافة حقلين الى فاتورة نقاط البيع

frappe.ui.form.on(‘POS Invoice’, {
refresh(frm) {
// your code here
}
})

frappe.ui.form.on(‘POS Invoice Item’, {
previous_reading: function(frm, cdt, cdn) {
calculateQuantity(frm, cdt, cdn);
},
current_reading: function(frm, cdt, cdn) {
calculateQuantit(frm, cdt, cdn);
}
});

function calculateQuantit(frm, cdt, cdn) {
var doc = locals[cdt][cdn];
var previous_reading = doc.previous_reading;
var current_reading = doc.current_reading;

if (previous_reading && current_reading) {
    var difference = current_reading - previous_reading;
    frappe.model.set_value(cdt, cdn, 'qty', difference);
}

}

هل هذا صحيح لم يتنفذ عندي

Use English to get better support, what are you trying to do exactly? Update the stock level from POS?

Also, there is a typo in your function

calculateQuantit(frm, cdt, cdn)

Should be Quantity