Getting disabled and is_frozen value from supplier

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

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?

@makarand_b can u help on this?

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.

@rmehta, sorry for tagging …btw by tagging i mean …“when u have time, can u help?” … :slight_smile: …and i’m a contributor …a small one …but contributed :wink: