cur_frm.cscript.custom_refresh = function(doc, dt, dn) {
// Loop through Item
var sales_invoice = locals[dt][dn];
var total_com = 0;
var sales_person = wn.model.get("Sales Invoice");
cur_frm.set_value('sales_commission_value', -2); // This code works, it set the 'sales_commission_value' field to -2
wn.call({
method: "accounts.doctype.sales_invoice.sales_invoice.get_sale_commission",
args: {},
callback: function(r) {
console.log("Received value ", r); // Received r = {message:'1'}
cur_frm.set_value('sales_commission_value', r.message); // This doesn't work, however, it does not set value of the field to 1
}
});
}
--
Note:
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c2d6b886-6830-42dd-a88f-e97f89b002cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bcfab877-f97a-4b7b-b068-60062ede8c34%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/96cd0498-c557-4662-8e5a-cdb33d7b62ea%40googlegroups.com.
The main wn.call to get_sale_commission is also ajax right ? Will the cur_frm variable inside the callback refer to the current form ?
I just wonder why it works when the Sale Invoice saved, only not working when make a new one...