Hi there
I need help in creating a custom script, which would allow me to enter sales order item using customer ref_code, instead of item_code, it gives us speed in entering sales orders.
any help would be appreciated.
Hi there
I need help in creating a custom script, which would allow me to enter sales order item using customer ref_code, instead of item_code, it gives us speed in entering sales orders.
any help would be appreciated.
It would be easy if we can use the “search_field” in the item master. But since it is a child table in item master we can’t use that feature.
What I would suggest is:
Your script should look like:
frappe.ui.form.on("Sales Order", {
customer_ref_search : function(frm, cdt, cdn) {
if (frm.doc.customer_ref_search) {
let item_info = frappe.db.get_list("ITEM CUSTOMER TABLE", ...
var rowSOItem = frappe.model.add_child(frm.doc, 'Sales Order Item', 'items');
frappe.model.set_value(rowSOItem.doctype, rowSOItem.name, 'item_code', item_info.item_code);
PS: I hope you get the idea.