From e14fdf4a3c281342093e17d2705f0af7f8910bb6 Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 30 Oct 2020 17:06:00 +0530 Subject: [PATCH] chore: RFQ cleanup and Title case for 'Get Items From' - Cleanup up RFQ Get Items From Dialogs - Title cased 'Get items from' to 'Get Items From' --- .../purchase_invoice/purchase_invoice.js | 4 +- .../doctype/sales_invoice/sales_invoice.js | 12 ++--- .../doctype/purchase_order/purchase_order.js | 4 +- .../request_for_quotation.js | 50 +++++++++++-------- .../supplier_quotation/supplier_quotation.js | 4 +- .../maintenance_schedule.js | 2 +- .../maintenance_visit/maintenance_visit.js | 6 +-- erpnext/public/js/controllers/buying.js | 2 +- .../selling/doctype/quotation/quotation.js | 2 +- .../doctype/sales_order/sales_order.js | 2 +- .../doctype/delivery_note/delivery_note.js | 2 +- .../material_request/material_request.js | 4 +- .../purchase_receipt/purchase_receipt.js | 2 +- .../stock/doctype/stock_entry/stock_entry.js | 10 ++-- 14 files changed, 58 insertions(+), 48 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index fe5301d5c8..62213abaa3 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -107,7 +107,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ company: me.frm.doc.company } }) - }, __("Get items from")); + }, __("Get Items From")); this.frm.add_custom_button(__('Purchase Receipt'), function() { erpnext.utils.map_current_doc({ @@ -125,7 +125,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ is_return: 0 } }) - }, __("Get items from")); + }, __("Get Items From")); } this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes"); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 9af584e0b1..502e65ed8d 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -199,7 +199,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte company: me.frm.doc.company } }) - }, __("Get items from")); + }, __("Get Items From")); }, quotation_btn: function() { @@ -223,7 +223,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte company: me.frm.doc.company } }) - }, __("Get items from")); + }, __("Get Items From")); }, delivery_note_btn: function() { @@ -251,7 +251,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }; } }); - }, __("Get items from")); + }, __("Get Items From")); }, tc_name: function() { @@ -812,10 +812,10 @@ frappe.ui.form.on('Sales Invoice', { if (cint(frm.doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !frm.doc.is_return) { frm.add_custom_button(__('Healthcare Services'), function() { get_healthcare_services_to_invoice(frm); - },"Get items from"); + },"Get Items From"); frm.add_custom_button(__('Prescriptions'), function() { get_drugs_to_invoice(frm); - },"Get items from"); + },"Get Items From"); } } else { @@ -1080,7 +1080,7 @@ var get_drugs_to_invoice = function(frm) { description:'Quantity will be calculated only for items which has "Nos" as UoM. You may change as required for each invoice item.', get_query: function(doc) { return { - filters: { + filters: { patient: dialog.get_value("patient"), company: frm.doc.company, docstatus: 1 diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 9f2b9714f7..3c6ebd6604 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -366,7 +366,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( per_ordered: ["<", 99.99], } }) - }, __("Get items from")); + }, __("Get Items From")); this.frm.add_custom_button(__('Supplier Quotation'), function() { @@ -382,7 +382,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( status: ["!=", "Stopped"], } }) - }, __("Get items from")); + }, __("Get Items From")); this.frm.add_custom_button(__('Update rate as per last purchase'), function() { diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index f56c9b4f0c..49f34a2b92 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -217,13 +217,15 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e source_doctype: "Material Request", target: me.frm, setters: { - company: me.frm.doc.company + schedule_date: undefined, + status: undefined }, get_query_filters: { material_request_type: "Purchase", docstatus: 1, status: ["!=", "Stopped"], - per_ordered: ["<", 99.99] + per_ordered: ["<", 99.99], + company: me.frm.doc.company } }) }, __("Get Items From")); @@ -236,32 +238,40 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e source_doctype: "Opportunity", target: me.frm, setters: { - company: me.frm.doc.company + party_name: undefined, + opportunity_from: undefined, + status: undefined }, + get_query_filters: { + status: ["not in", ["Closed", "Lost"]], + company: me.frm.doc.company + } }) }, __("Get Items From")); // Get items from open Material Requests based on supplier this.frm.add_custom_button(__('Possible Supplier'), function() { // Create a dialog window for the user to pick their supplier - var d = new frappe.ui.Dialog({ + var dialog = new frappe.ui.Dialog({ title: __('Select Possible Supplier'), fields: [ - {fieldname: 'supplier', fieldtype:'Link', options:'Supplier', label:'Supplier', reqd:1}, - {fieldname: 'ok_button', fieldtype:'Button', label:'Get Items from Material Requests'}, - ] - }); - - // On the user clicking the ok button - d.fields_dict.ok_button.input.onclick = function() { - var btn = d.fields_dict.ok_button.input; - var v = d.get_values(); - if(v) { - $(btn).set_working(); + { + fieldname: 'supplier', + fieldtype:'Link', + options:'Supplier', + label:'Supplier', + reqd:1, + description: __("Get Items from Material Requests against this Supplier") + } + ], + primary_action_label: __("Get Items"), + primary_action: (args) => { + if(!args) return; + dialog.hide(); erpnext.utils.map_current_doc({ method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_item_from_material_requests_based_on_supplier", - source_name: v.supplier, + source_name: args.supplier, target: me.frm, setters: { company: me.frm.doc.company @@ -273,11 +283,11 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e per_ordered: ["<", 99.99] } }); - $(btn).done_working(); - d.hide(); + dialog.hide(); } - } - d.show(); + }); + + dialog.show(); }, __("Get Items From")); // Get Suppliers diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index 3376e82956..ab96973ced 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -46,7 +46,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext per_ordered: ["<", 99.99] } }) - }, __("Get items from")); + }, __("Get Items From")); this.frm.add_custom_button(__("Request for Quotation"), function() { @@ -67,7 +67,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext get_query_method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_rfq_containing_supplier" }) - }, __("Get items from")); + }, __("Get Items From")); } }, diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js index e940b6050c..ddbcdfde57 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js @@ -66,7 +66,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({ company: me.frm.doc.company } }); - }, __("Get items from")); + }, __("Get Items From")); } else if (this.frm.doc.docstatus === 1) { this.frm.add_custom_button(__('Create Maintenance Visit'), function() { frappe.model.open_mapped_doc({ diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js index 2e2a9ce040..4cbb02a5b3 100644 --- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js +++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js @@ -62,7 +62,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({ company: me.frm.doc.company } }) - }, __("Get items from")); + }, __("Get Items From")); this.frm.add_custom_button(__('Warranty Claim'), function() { erpnext.utils.map_current_doc({ @@ -78,7 +78,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({ company: me.frm.doc.company } }) - }, __("Get items from")); + }, __("Get Items From")); this.frm.add_custom_button(__('Sales Order'), function() { erpnext.utils.map_current_doc({ @@ -94,7 +94,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({ order_type: me.frm.doc.order_type, } }) - }, __("Get items from")); + }, __("Get Items From")); } }, }); diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index cb76c87b62..58ac38f0a8 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -276,7 +276,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ var me = this; this.frm.add_custom_button(__("Product Bundle"), function() { erpnext.buying.get_items_from_product_bundle(me.frm); - }, __("Get items from")); + }, __("Get Items From")); }, shipping_address: function(){ diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 12f32602f5..661e107e1e 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -116,7 +116,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ company: me.frm.doc.company } }) - }, __("Get items from"), "btn-default"); + }, __("Get Items From"), "btn-default"); } this.toggle_reqd_lead_customer(); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 989bd33e42..a146ae3dd3 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -236,7 +236,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( status: ["!=", "Lost"] } }) - }, __("Get items from")); + }, __("Get Items From")); } this.order_type(doc); diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 19d0bec26c..251a26a592 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -151,7 +151,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( project: me.frm.doc.project || undefined, } }) - }, __("Get items from")); + }, __("Get Items From")); } } diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 14f0aa5816..f004e9145a 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -90,7 +90,7 @@ frappe.ui.form.on('Material Request', { make_custom_buttons: function(frm) { if (frm.doc.docstatus==0) { frm.add_custom_button(__("Bill of Materials"), - () => frm.events.get_items_from_bom(frm), __("Get items from")); + () => frm.events.get_items_from_bom(frm), __("Get Items From")); } if (frm.doc.docstatus == 1 && frm.doc.status != 'Stopped') { @@ -147,7 +147,7 @@ frappe.ui.form.on('Material Request', { if (frm.doc.docstatus===0) { frm.add_custom_button(__('Sales Order'), () => frm.events.get_items_from_sales_order(frm), - __("Get items from")); + __("Get Items From")); } if (frm.doc.docstatus == 1 && frm.doc.status == 'Stopped') { diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index c504e23677..8ee775e161 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -136,7 +136,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend company: me.frm.doc.company } }) - }, __("Get items from")); + }, __("Get Items From")); } if(this.frm.doc.docstatus == 1 && this.frm.doc.status!="Closed") { diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 39fd029a89..32923353ee 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -225,7 +225,7 @@ frappe.ui.form.on('Stock Entry', { docstatus: 1 } }) - }, __("Get items from")); + }, __("Get Items From")); frm.add_custom_button(__('Material Request'), function() { erpnext.utils.map_current_doc({ @@ -240,7 +240,7 @@ frappe.ui.form.on('Stock Entry', { status: ["not in", ["Transferred", "Issued"]] } }) - }, __("Get items from")); + }, __("Get Items From")); } if (frm.doc.docstatus===0 && frm.doc.purpose == "Material Issue") { frm.add_custom_button(__('Expired Batches'), function() { @@ -263,7 +263,7 @@ frappe.ui.form.on('Stock Entry', { } } }); - }, __("Get items from")); + }, __("Get Items From")); } frm.events.show_bom_custom_button(frm); @@ -282,7 +282,7 @@ frappe.ui.form.on('Stock Entry', { }, stock_entry_type: function(frm){ - frm.remove_custom_button('Bill of Materials', "Get items from"); + frm.remove_custom_button('Bill of Materials', "Get Items From"); frm.events.show_bom_custom_button(frm); frm.trigger('add_to_transit'); }, @@ -427,7 +427,7 @@ frappe.ui.form.on('Stock Entry', { ['Material Issue', 'Material Receipt', 'Material Transfer', 'Send to Subcontractor'].includes(frm.doc.purpose)) { frm.add_custom_button(__('Bill of Materials'), function() { frm.events.get_items_from_bom(frm); - }, __("Get items from")); + }, __("Get Items From")); } },