From 6bf507a54bca2057921c97cf7b09ee5ac2c9ba7c Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 30 Oct 2020 13:59:47 +0530 Subject: [PATCH 01/13] chore: (MR)Added delivery date in SO dialog --- erpnext/stock/doctype/material_request/material_request.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 8c470988c8..14f0aa5816 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -173,7 +173,8 @@ frappe.ui.form.on('Material Request', { source_doctype: "Sales Order", target: frm, setters: { - customer: frm.doc.customer || undefined + customer: frm.doc.customer || undefined, + delivery_date: undefined, }, get_query_filters: { docstatus: 1, From e14fdf4a3c281342093e17d2705f0af7f8910bb6 Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 30 Oct 2020 17:06:00 +0530 Subject: [PATCH 02/13] 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")); } }, From 08e5031be2d41f1d2e42fe9e3a58659c19f3beea Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 30 Oct 2020 17:36:20 +0530 Subject: [PATCH 03/13] chore: Supplier Quotation Get Items From cleanup --- .../doctype/supplier_quotation/supplier_quotation.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index ab96973ced..a7cab5015e 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -37,13 +37,15 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext 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")); @@ -58,11 +60,11 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext source_doctype: "Request for Quotation", target: me.frm, setters: { - company: me.frm.doc.company, transaction_date: null }, get_query_filters: { - supplier: me.frm.doc.supplier + supplier: me.frm.doc.supplier, + company: me.frm.doc.company }, get_query_method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_rfq_containing_supplier" From 66b2b544f88764a394f37e523db4aef98bf8d759 Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 30 Oct 2020 17:45:28 +0530 Subject: [PATCH 04/13] chore: Purchase Receipt, added required by date in PO popup --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 8ee775e161..bc1d81d356 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -128,6 +128,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend target: me.frm, setters: { supplier: me.frm.doc.supplier, + schedule_date: undefined }, get_query_filters: { docstatus: 1, From 97d38548aa6ba48e731c31ec80c0dfae84f9d8ce Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 30 Oct 2020 17:50:25 +0530 Subject: [PATCH 05/13] chore: Purchase Invoice Get Items From cleanup --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 62213abaa3..1d41d0fa2a 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -99,6 +99,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ target: me.frm, setters: { supplier: me.frm.doc.supplier || undefined, + schedule_date: undefined }, get_query_filters: { docstatus: 1, @@ -114,9 +115,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice", source_doctype: "Purchase Receipt", target: me.frm, - date_field: "posting_date", setters: { supplier: me.frm.doc.supplier || undefined, + posting_date: undefined }, get_query_filters: { docstatus: 1, From 542ae6ab97f1ffbc873e80cc492b88e14a7b3c92 Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 2 Nov 2020 08:50:48 +0530 Subject: [PATCH 06/13] chore: Linter and Sider fixes - Translatable strings cannot be multi line or be formatted by '+' - Reduce no of tabs in stock_entry.js --- erpnext/buying/doctype/purchase_order/purchase_order.js | 2 +- erpnext/stock/doctype/material_request/material_request.js | 3 +-- erpnext/stock/doctype/stock_entry/stock_entry.js | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 3c6ebd6604..2f52a9e035 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -299,7 +299,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( if(me.values) { me.values.sub_con_rm_items.map((row,i) => { if (!row.item_code || !row.rm_item_code || !row.warehouse || !row.qty || row.qty === 0) { - frappe.throw(__("Item Code, warehouse, quantity are required on row" + (i+1))); + frappe.throw(__("Item Code, warehouse, quantity are required on row {0}", [i+1])); } }) me._make_rm_stock_entry(me.dialog.fields_dict.sub_con_rm_items.grid.get_selected_children()) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index f004e9145a..01edd99e9d 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -281,8 +281,7 @@ frappe.ui.form.on('Material Request', { fieldname:'default_supplier', fieldtype: 'Link', options: 'Supplier', - description: __('Select a Supplier from the Default Suppliers of the items below. \ - On selection, a Purchase Order will be made against items belonging to the selected Supplier only.'), + description: __('Select a Supplier from the Default Suppliers of the items below. On selection, a Purchase Order will be made against items belonging to the selected Supplier only.'), get_query: () => { return{ query: "erpnext.stock.doctype.material_request.material_request.get_default_supplier_query", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 32923353ee..91217582ca 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -425,9 +425,9 @@ frappe.ui.form.on('Stock Entry', { show_bom_custom_button: function(frm){ if (frm.doc.docstatus === 0 && ['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")); + frm.add_custom_button(__('Bill of Materials'), function() { + frm.events.get_items_from_bom(frm); + }, __("Get Items From")); } }, From 59ccb64e18422f34e9b34f9149913d2db52437fc Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 5 Nov 2020 16:29:34 +0530 Subject: [PATCH 07/13] fix: Auto Statewise gst tax template --- erpnext/regional/india/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 69e47a43c4..bc8cb11a95 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -236,7 +236,7 @@ def get_tax_template(master_doctype, company, is_inter_state, state_code): if tax_category.gst_state == number_state_mapping[state_code] or \ (not default_tax and not tax_category.gst_state): default_tax = frappe.db.get_value(master_doctype, - {'disabled': 0, 'tax_category': tax_category.name}, 'name') + {'company': company, 'disabled': 0, 'tax_category': tax_category.name}, 'name') return default_tax def get_tax_template_for_sez(party_details, master_doctype, company, party_type): From 815341d45457e7c6ea7bde896d3f7b20b82d37eb Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 5 Nov 2020 16:57:23 +0100 Subject: [PATCH 08/13] feat: validate fiscal year --- .../regional/germany/utils/datev/datev_csv.py | 2 +- erpnext/regional/report/datev/datev.py | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/erpnext/regional/germany/utils/datev/datev_csv.py b/erpnext/regional/germany/utils/datev/datev_csv.py index aae734f8e2..fb7ca71e79 100644 --- a/erpnext/regional/germany/utils/datev/datev_csv.py +++ b/erpnext/regional/germany/utils/datev/datev_csv.py @@ -104,7 +104,7 @@ def get_header(filters, csv_class): # L = Tax client number (Mandantennummer) datev_settings.get('client_number', '00000'), # M = Start of the fiscal year (Wirtschaftsjahresbeginn) - frappe.utils.formatdate(frappe.defaults.get_user_default('year_start_date'), 'yyyyMMdd'), + frappe.utils.formatdate(filters.get('fiscal_year_start'), 'yyyyMMdd'), # N = Length of account numbers (Sachkontenlänge) datev_settings.get('account_number_length', '4'), # O = Transaction batch start date (YYYYMMDD) diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py index dd818e6054..04f8928c6a 100644 --- a/erpnext/regional/report/datev/datev.py +++ b/erpnext/regional/report/datev/datev.py @@ -13,7 +13,7 @@ import json import frappe from frappe import _ from six import string_types -from erpnext.regional.germany.utils.datev.datev_csv import download_csv_files_as_zip, get_datev_csv +from erpnext.accounts.utils import get_fiscal_year from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames COLUMNS = [ @@ -98,21 +98,33 @@ def execute(filters=None): def validate(filters): """Make sure all mandatory filters and settings are present.""" - if not filters.get('company'): + company = filters.get('company') + if not company: frappe.throw(_('Company is a mandatory filter.')) - if not filters.get('from_date'): + from_date = filters.get('from_date') + if not from_date: frappe.throw(_('From Date is a mandatory filter.')) - if not filters.get('to_date'): + to_date = filters.get('to_date') + if not to_date: frappe.throw(_('To Date is a mandatory filter.')) + validate_fiscal_year(from_date, to_date, company) + try: frappe.get_doc('DATEV Settings', filters.get('company')) except frappe.DoesNotExistError: frappe.throw(_('Please create DATEV Settings for Company {}.').format(filters.get('company'))) +def validate_fiscal_year(from_date, to_date, company): + from_fiscal_year = get_fiscal_year(date=from_date, company=company) + to_fiscal_year = get_fiscal_year(date=to_date, company=company) + if from_fiscal_year != to_fiscal_year: + frappe.throw(_('Dates {} and {} are not in the same fiscal year.').format(from_date, to_date)) + + def get_transactions(filters, as_dict=1): """ Get a list of accounting entries. @@ -317,9 +329,13 @@ def download_datev_csv(filters): filters = json.loads(filters) validate(filters) + company = filters.get('company') + + fiscal_year = get_fiscal_year(date=filters.get('from_date'), company=company) + filters['fiscal_year_start'] = fiscal_year[1] # set chart of accounts used - coa = frappe.get_value('Company', filters.get('company'), 'chart_of_accounts') + coa = frappe.get_value('Company', company, 'chart_of_accounts') filters['skr'] = '04' if 'SKR04' in coa else ('03' if 'SKR03' in coa else '') transactions = get_transactions(filters) From f91d82b5389972d0f952115cb41a30089a054c6b Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 5 Nov 2020 17:28:39 +0100 Subject: [PATCH 09/13] fix: imports --- erpnext/regional/report/datev/datev.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py index 04f8928c6a..738806321c 100644 --- a/erpnext/regional/report/datev/datev.py +++ b/erpnext/regional/report/datev/datev.py @@ -14,6 +14,7 @@ import frappe from frappe import _ from six import string_types from erpnext.accounts.utils import get_fiscal_year +from erpnext.regional.germany.utils.datev.datev_csv import download_csv_files_as_zip, get_datev_csv from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames COLUMNS = [ From c3307f79004f534fa95be13dd3de5c96dbce8089 Mon Sep 17 00:00:00 2001 From: Anupam Date: Fri, 6 Nov 2020 12:28:38 +0530 Subject: [PATCH 10/13] fix: replaced formatdate -> format_date --- .../bank_and_cash_payment_voucher.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html index 6fe6999051..e588ed6609 100644 --- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -19,7 +19,7 @@
- +
Date: {{ frappe.utils.formatdate(doc.creation) }}
Date: {{ frappe.utils.format_date(doc.creation) }}
From 06ba92be7a2f53e39e0adeecbbfd006388c554cb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Nov 2020 12:57:25 +0530 Subject: [PATCH 11/13] fix: Added link of bank reconciliation and clearance in accounting desk page --- erpnext/accounts/desk_page/accounting/accounting.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/desk_page/accounting/accounting.json b/erpnext/accounts/desk_page/accounting/accounting.json index b0371e7c09..1d9236b81e 100644 --- a/erpnext/accounts/desk_page/accounting/accounting.json +++ b/erpnext/accounts/desk_page/accounting/accounting.json @@ -43,7 +43,7 @@ { "hidden": 0, "label": "Bank Statement", - "links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Transaction Entry\",\n \"name\": \"Bank Statement Transaction Entry\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Settings\",\n \"name\": \"Bank Statement Settings\",\n \"type\": \"doctype\"\n }\n]" + "links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Clearance\",\n \"name\": \"Bank Clearance\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Reconciliation\",\n \"name\": \"bank-reconciliation\",\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Reconciliation Statement\",\n \"name\": \"Bank Reconciliation Statement\",\n \"type\": \"report\"\n }\n]" }, { "hidden": 0, @@ -98,7 +98,7 @@ "idx": 0, "is_standard": 1, "label": "Accounting", - "modified": "2020-10-08 20:31:46.022470", + "modified": "2020-11-04 13:05:37.922171", "modified_by": "Administrator", "module": "Accounts", "name": "Accounting", @@ -108,7 +108,7 @@ "pin_to_top": 0, "shortcuts": [ { - "label": "Chart of Accounts", + "label": "Chart Of Accounts", "link_to": "Account", "type": "DocType" }, From 0b4946ba2799750eae91174d755d36dbffe68bb4 Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 6 Nov 2020 13:08:53 +0530 Subject: [PATCH 12/13] fix: Add missing links - Added Bank Transaction Statement Entry and Bank Statement Settings --- erpnext/accounts/desk_page/accounting/accounting.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/desk_page/accounting/accounting.json b/erpnext/accounts/desk_page/accounting/accounting.json index 1d9236b81e..9172792411 100644 --- a/erpnext/accounts/desk_page/accounting/accounting.json +++ b/erpnext/accounts/desk_page/accounting/accounting.json @@ -43,7 +43,7 @@ { "hidden": 0, "label": "Bank Statement", - "links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Clearance\",\n \"name\": \"Bank Clearance\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Reconciliation\",\n \"name\": \"bank-reconciliation\",\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Reconciliation Statement\",\n \"name\": \"Bank Reconciliation Statement\",\n \"type\": \"report\"\n }\n]" + "links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Clearance\",\n \"name\": \"Bank Clearance\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Reconciliation\",\n \"name\": \"bank-reconciliation\",\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Reconciliation Statement\",\n \"name\": \"Bank Reconciliation Statement\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Bank Statement Transaction Entry\",\n \"name\": \"Bank Statement Transaction Entry\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Settings\",\n \"name\": \"Bank Statement Settings\",\n \"type\": \"doctype\"\n }\n]" }, { "hidden": 0, @@ -98,7 +98,7 @@ "idx": 0, "is_standard": 1, "label": "Accounting", - "modified": "2020-11-04 13:05:37.922171", + "modified": "2020-11-06 13:05:58.650150", "modified_by": "Administrator", "module": "Accounts", "name": "Accounting", From e0af8fe8e5778b285cf800f9439e032fad5198d2 Mon Sep 17 00:00:00 2001 From: Saqib Date: Fri, 6 Nov 2020 18:19:36 +0530 Subject: [PATCH 13/13] fix: auto fetch sr nos with modifed conversion factor (#23854) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 8 ++++++-- erpnext/selling/page/point_of_sale/pos_controller.js | 2 ++ erpnext/selling/page/point_of_sale/pos_item_details.js | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index b0a7547ce8..a7e20a0c32 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -132,15 +132,19 @@ class POSInvoice(SalesInvoice): msg = "" item_code = frappe.bold(d.item_code) + serial_nos = get_serial_nos(d.serial_no) if serialized and batched and (no_batch_selected or no_serial_selected): msg = (_('Row #{}: Please select a serial no and batch against item: {} or remove it to complete transaction.') .format(d.idx, item_code)) - if serialized and no_serial_selected: + elif serialized and no_serial_selected: msg = (_('Row #{}: No serial number selected against item: {}. Please select one or remove it to complete transaction.') .format(d.idx, item_code)) - if batched and no_batch_selected: + elif batched and no_batch_selected: msg = (_('Row #{}: No batch selected against item: {}. Please select a batch or remove it to complete transaction.') .format(d.idx, item_code)) + elif serialized and not no_serial_selected and len(serial_nos) != d.qty: + msg = (_("Row #{}: You must select {} serial numbers for item {}.").format(d.idx, frappe.bold(cint(d.qty)), item_code)) + if msg: error_msg.append(msg) diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index f7d1fa4ded..970d840665 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -555,6 +555,8 @@ erpnext.PointOfSale.Controller = class { frappe.utils.play_sound("error"); return; } + if (!item_code) return; + item_selected_from_selector && (value = flt(value)) const args = { item_code, batch_no, [field]: value }; diff --git a/erpnext/selling/page/point_of_sale/pos_item_details.js b/erpnext/selling/page/point_of_sale/pos_item_details.js index 9874d1b5f9..a4de9f165d 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_details.js +++ b/erpnext/selling/page/point_of_sale/pos_item_details.js @@ -372,12 +372,13 @@ erpnext.PointOfSale.ItemDetails = class { this.$form_container.on('click', '.auto-fetch-btn', () => { this.batch_no_control && this.batch_no_control.set_value(''); let qty = this.qty_control.get_value(); + let conversion_factor = this.conversion_factor_control.get_value(); let expiry_date = this.item_row.has_batch_no ? this.events.get_frm().doc.posting_date : ""; let numbers = frappe.call({ method: "erpnext.stock.doctype.serial_no.serial_no.auto_fetch_serial_number", args: { - qty, + qty: qty * conversion_factor, item_code: this.current_item.item_code, warehouse: this.warehouse_control.get_value() || '', batch_nos: this.current_item.batch_no || '',