feat: request_for_quotation

- Show supplier name if supplier ID is not equal to supplier name
This commit is contained in:
Ahmad 2022-04-27 12:04:04 +05:00 committed by Ahmad
parent 85e8dd9a49
commit b226e7d2ac

View File

@ -31,7 +31,7 @@ frappe.ui.form.on("Request for Quotation",{
if (frm.doc.docstatus === 1) {
frm.add_custom_button(__('Supplier Quotation'),
function(){ frm.trigger("make_suppplier_quotation") }, __("Create"));
function(){ frm.trigger("make_supplier_quotation") }, __("Create"));
frm.add_custom_button(__("Send Emails to Suppliers"), function() {
@ -87,14 +87,20 @@ frappe.ui.form.on("Request for Quotation",{
},
make_suppplier_quotation: function(frm) {
make_supplier_quotation: function(frm) {
var doc = frm.doc;
var dialog = new frappe.ui.Dialog({
title: __("Create Supplier Quotation"),
fields: [
{ "fieldtype": "Select", "label": __("Supplier"),
"fieldname": "supplier",
"options": doc.suppliers.map(d => d.supplier),
"options": doc.suppliers.map(d => {
if (d.supplier !== d.supplier_name){
return `${d.supplier_name} [${d.supplier}]`
}else {
return d.supplier
}
}),
"reqd": 1,
"default": doc.suppliers.length === 1 ? doc.suppliers[0].supplier_name : "" },
],