JoEz
April 18, 2017, 9:29am
#1
Hi there,
i’m feeling quite stupid …but i’m fighting to get disabled
and is_frozen
value from Supplier
and save on Item Supplier
custom field, aka supplier_disabled
, on each item update.
I’m not sure why, but i can’t get that values on item validate.
Any hint on this?
Thx a lot
JoEz
April 18, 2017, 11:41am
#2
See code:
frappe.ui.form.on("Item", {
validate: function (frm) {
$.each(frm.doc.supplier_items || [], function (i, d) {
if (d.supplier) {
frappe.call({
method: "myapp.api.get_supplier_status",
args: {
supplier: d.supplier
},
callback: function (r) {
if (!r.exc) {
frappe.model.set_value("Item Supplier", d.name, "supplier_disabled", r.message);
}
}
});
}
});
},
myapp.api.get_supplier_status
return correctly 0 or 1
Value are not changed in db, what i’m doing wrong?
JoEz
April 18, 2017, 12:25pm
#3
@makarand_b can u help on this?
rmehta
April 18, 2017, 5:18pm
#4
Please don’t @-tag users for replies. This is a voluntary forum, and no one is responsible to give help.
Edit: Priority free help will be given if you make a contribution.
JoEz
April 18, 2017, 5:50pm
#5
@rmehta , sorry for tagging …btw by tagging i mean …“when u have time, can u help?” … …and i’m a contributor …a small one …but contributed