If I select Milk supplier1, I want to automatically change to the default value “ROO1” in the field of the item table.
Hi @THANGAPANDIAN:
Create a client script for Purchase Invoice doctype, and enable it.
frappe.ui.form.on('Purchase Invoice Item', {
items_add (frm,cdt,cdn) {
row = locals[cdt][cdn]
if (frm.doc.supplier=="Milk supplier 1") {
row.item_code = "ROO1"
}
}
})
Hope this helps.
Hi @THANGAPANDIAN,
If the @avc script has not worked then please apply it.
frappe.ui.form.on('Purchase Invoice', {
supplier: function(frm) {
if (frm.doc.supplier == "Mike supplier 1") {
frm.clear_table('items');
var row = frm.add_child('items');
frappe.model.set_value(row.doctype, row.name, 'item_code', "ROO1");
frm.refresh_field('items');
}
}
});
Thank You!
5 Likes
working
its working thank so much