When we create Supplier Quotation from Request For Quotation, It only asks supplier name.
I want to add 2 more fields on this dialogue, how can I extend the ERPnext code to add fields on it?
When we create Supplier Quotation from Request For Quotation, It only asks supplier name.
I want to add 2 more fields on this dialogue, how can I extend the ERPnext code to add fields on it?
The Request for Quotation dialog is overriding. You will add fields as per your requirements.
frappe.ui.form.on('Request for Quotation', {
refresh(frm) {
if (frm.doc.docstatus === 1) {
frm.add_custom_button(__('Supplier Quotation'),
function(){ frm.trigger("make_supplier_quotation") }, __("Create"));
}
},
make_supplier_quotation:function(frm){
var doc = frm.doc;
var dialog = new frappe.ui.Dialog({
title: __("Create Supplier Quotation"),
fields: [
{
"fieldtype": "Link",
"label": __("Supplier"),
"fieldname": "supplier",
"options": 'Supplier',
"reqd": 1,
get_query: () => {
return {
filters: [
["Supplier", "name", "in", frm.doc.suppliers.map((row) => {return row.supplier;})]
]
}
}
}
],
primary_action_label: __("Create"),
primary_action: (args) => {
if(!args) return;
dialog.hide();
return frappe.call({
type: "GET",
method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.make_supplier_quotation_from_rfq",
args: {
"source_name": doc.name,
"for_supplier": args.supplier
},
freeze: true,
callback: function(r) {
if(!r.exc) {
var doc = frappe.model.sync(r.message);
frappe.set_route("Form", r.message.doctype, r.message.name);
}
}
});
}
});
dialog.show()
}
})
I hope it’s working
Thank You!