Hello,
I created a Python file that contains the code, then I creates a JS file that contains the code bellow which call the py file, but it doesn’t works, I make. Could you help me please to solve it. Thanks
1- bench --site [site name] migrate
2- bench --site site name] clear-cache
3- service supervisor restart
4-service nginx restart
The new field “custom_big_total_outstanding_amount” which exists in Customer doctype will be updated each time the sales order is saved
The js Code :
frappe.ui.form.on(“Sales Order”, {
before_save: function(frm) {
// Trigger the function after a new Sales Order is inserted
fetchBigTotalOutstandingAmount(frm.doc.customer);
function fetchBigTotalOutstandingAmount(customer) {
// Call the Python function via API
frappe.call({
method: “greenglow_dev.greenglow_development.big_total_outstanding_amount.get_big_total_outstanding_amount”,
args: {
customer: customer
},
callback: function(response) {
// Update the Customer document with the total outstanding amount
frappe.model.set_value(“Customer”, customer, “custom_big_total_outstanding_amount”, response.message)
frm.refresh_field(“custom_big_total_outstanding_amount”);
}
});
}
}
});