From 9df3d0fb8aa6ef95054636c5bd1bdec24e237200 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 1 Apr 2016 13:08:29 +0530 Subject: [PATCH 1/5] [enhance] show module flow on top of document --- .../purchase_invoice/purchase_invoice.js | 4 ++-- .../doctype/sales_invoice/sales_invoice.js | 2 +- .../doctype/purchase_order/purchase_order.js | 2 +- .../supplier_quotation/supplier_quotation.js | 2 +- .../selling/doctype/quotation/quotation.js | 2 +- .../doctype/sales_order/sales_order.js | 3 ++- erpnext/startup/boot.py | 24 +++++++++++++++++++ .../doctype/delivery_note/delivery_note.js | 2 +- .../purchase_receipt/purchase_receipt.js | 2 +- 9 files changed, 34 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index b634ccf266..5e27b6016b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -26,10 +26,10 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ this._super(); hide_fields(this.frm.doc); - + cur_frm.page.add_document_flow(cur_frm) // Show / Hide button this.show_general_ledger(); - + if(doc.update_stock==1 && doc.docstatus==1) { this.show_stock_ledger(); } diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index cc6d1e6647..6ec07c588e 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -24,7 +24,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte refresh: function(doc, dt, dn) { this._super(); - + cur_frm.page.add_document_flow(cur_frm) if(cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) { // hide new msgbox cur_frm.msgbox.hide(); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index ddaa5b4e56..1025ab981e 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -20,7 +20,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( // this.frm.dashboard.reset(); var allow_receipt = false; var is_drop_ship = false; - + cur_frm.page.add_document_flow(cur_frm) for (var i in cur_frm.doc.items) { var item = cur_frm.doc.items[i]; if(item.delivered_by_supplier !== 1) { diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index 8587a9fdd7..c24cab984b 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -7,7 +7,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({ refresh: function() { this._super(); - + cur_frm.page.add_document_flow(cur_frm); if (this.frm.doc.docstatus === 1) { cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, __("Make")); diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 9e5283cfb8..c31c919d6a 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -16,7 +16,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); - + cur_frm.page.add_document_flow(cur_frm) if(doc.docstatus == 1 && doc.status!=='Lost') { cur_frm.add_custom_button(__('Make Sales Order'), cur_frm.cscript['Make Sales Order']); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 29501f5973..d4e36c7cbc 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -21,7 +21,8 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( this.frm.dashboard.reset(); var allow_purchase = false; var allow_delivery = false; - + + cur_frm.page.add_document_flow(cur_frm) if(doc.docstatus==1) { if(doc.status != 'Closed') { diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index 7bdcb0aa9c..8ec5bfad0c 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -32,6 +32,30 @@ def boot_session(bootinfo): bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_terms, default_letter_head, default_bank_account from `tabCompany`""", as_dict=1, update={"doctype":":Company"}) + + bootinfo.module_flow = { + "Selling": { + "Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], + "Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"] + }, + "Accounts": { + "Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], + "Purchase Invoice": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"] + }, + "Buying": { + "Purchase Order": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"], + "Supplier Quotation": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"] + }, + "Stock": { + "Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], + "Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"] + } + } + def load_country_and_currency(bootinfo): country = frappe.db.get_default("country") diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 6d3138667a..45cb7c1e80 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,7 +8,7 @@ frappe.provide("erpnext.stock.delivery_note"); erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({ refresh: function(doc, dt, dn) { this._super(); - + cur_frm.page.add_document_flow(cur_frm) if (!doc.is_return && doc.status!="Closed") { if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note, __("Make")); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index a967b5b345..faf579d2f1 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -41,7 +41,7 @@ frappe.ui.form.on("Purchase Receipt", { erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ refresh: function() { this._super(); - + cur_frm.page.add_document_flow(cur_frm) if(this.frm.doc.docstatus===1) { this.show_stock_ledger(); if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) { From 2966d89e2a5a86a1a225934e87887957c37e8c70 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 1 Apr 2016 17:25:24 +0530 Subject: [PATCH 2/5] [fixes] create module flow list --- erpnext/public/build.json | 1 + erpnext/public/js/module_flow.js | 28 ++++++++++++++++++++++++++++ erpnext/startup/boot.py | 24 ------------------------ 3 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 erpnext/public/js/module_flow.js diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 340ebdb5e5..6e746d7c02 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -32,5 +32,6 @@ "stock/dashboard/item_dashboard.html", "stock/dashboard/item_dashboard_list.html", "stock/dashboard/item_dashboard.js" + "public/js/module_flow.js" ] } diff --git a/erpnext/public/js/module_flow.js b/erpnext/public/js/module_flow.js new file mode 100644 index 0000000000..3c07b598e7 --- /dev/null +++ b/erpnext/public/js/module_flow.js @@ -0,0 +1,28 @@ +// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +// MIT License. See license.txt + +// for module flow + + +frappe.module_flow = { + "Selling": { + "Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], + "Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"] + }, + "Accounts": { + "Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], + "Purchase Invoice": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"] + }, + "Buying": { + "Purchase Order": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"], + "Supplier Quotation": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"] + }, + "Stock": { + "Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], + "Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", + "Purchase Invoice", "Journal Entry"] + } +} \ No newline at end of file diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index 8ec5bfad0c..7bdcb0aa9c 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -32,30 +32,6 @@ def boot_session(bootinfo): bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_terms, default_letter_head, default_bank_account from `tabCompany`""", as_dict=1, update={"doctype":":Company"}) - - bootinfo.module_flow = { - "Selling": { - "Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], - "Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"] - }, - "Accounts": { - "Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], - "Purchase Invoice": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", - "Purchase Invoice", "Journal Entry"] - }, - "Buying": { - "Purchase Order": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", - "Purchase Invoice", "Journal Entry"], - "Supplier Quotation": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", - "Purchase Invoice", "Journal Entry"] - }, - "Stock": { - "Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], - "Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", - "Purchase Invoice", "Journal Entry"] - } - } - def load_country_and_currency(bootinfo): country = frappe.db.get_default("country") From 7d0e78d3996e5fa45db526ccf07d832d7ddbe78b Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 1 Apr 2016 17:34:25 +0530 Subject: [PATCH 3/5] [fixes] this.frm instead of cur_frm --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 2 +- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- erpnext/buying/doctype/purchase_order/purchase_order.js | 2 +- erpnext/buying/doctype/supplier_quotation/supplier_quotation.js | 2 +- erpnext/selling/doctype/quotation/quotation.js | 2 +- erpnext/selling/doctype/sales_order/sales_order.js | 2 +- erpnext/stock/doctype/delivery_note/delivery_note.js | 2 +- erpnext/stock/doctype/purchase_receipt/purchase_receipt.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 5e27b6016b..85f7748b9a 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -26,7 +26,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ this._super(); hide_fields(this.frm.doc); - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(cur_frm) // Show / Hide button this.show_general_ledger(); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 6ec07c588e..cdb2652f46 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -24,7 +24,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte refresh: function(doc, dt, dn) { this._super(); - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(this.frm) if(cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) { // hide new msgbox cur_frm.msgbox.hide(); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 1025ab981e..c1fe693c5a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -20,7 +20,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( // this.frm.dashboard.reset(); var allow_receipt = false; var is_drop_ship = false; - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(this.frm) for (var i in cur_frm.doc.items) { var item = cur_frm.doc.items[i]; if(item.delivered_by_supplier !== 1) { diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index c24cab984b..25504485e0 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -7,7 +7,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({ refresh: function() { this._super(); - cur_frm.page.add_document_flow(cur_frm); + this.frm.page.add_document_flow(this.frm); if (this.frm.doc.docstatus === 1) { cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, __("Make")); diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index c31c919d6a..d1ca691079 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -16,7 +16,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(this.frm) if(doc.docstatus == 1 && doc.status!=='Lost') { cur_frm.add_custom_button(__('Make Sales Order'), cur_frm.cscript['Make Sales Order']); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index d4e36c7cbc..3ffa68592b 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -22,7 +22,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( var allow_purchase = false; var allow_delivery = false; - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(this.frm) if(doc.docstatus==1) { if(doc.status != 'Closed') { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 45cb7c1e80..9b51cfda78 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,7 +8,7 @@ frappe.provide("erpnext.stock.delivery_note"); erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({ refresh: function(doc, dt, dn) { this._super(); - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(this.frm) if (!doc.is_return && doc.status!="Closed") { if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note, __("Make")); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index faf579d2f1..6fdb8473dc 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -41,7 +41,7 @@ frappe.ui.form.on("Purchase Receipt", { erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ refresh: function() { this._super(); - cur_frm.page.add_document_flow(cur_frm) + this.frm.page.add_document_flow(this.frm) if(this.frm.doc.docstatus===1) { this.show_stock_ledger(); if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) { From a8217dc7e933bcee422c5f5f8a7c22caf53f2624 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 7 Jun 2016 11:27:54 +0530 Subject: [PATCH 4/5] [fixes] build json fixes --- erpnext/public/build.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 6e746d7c02..d912b68a2b 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -26,12 +26,12 @@ "public/js/payment/pos_payment.html", "public/js/payment/payment_details.html", "public/js/templates/item_selector.html", - "public/js/utils/item_selector.js" + "public/js/utils/item_selector.js", + "public/js/module_flow.js" ], "js/item-dashboard.min.js": [ "stock/dashboard/item_dashboard.html", "stock/dashboard/item_dashboard_list.html", "stock/dashboard/item_dashboard.js" - "public/js/module_flow.js" ] } From 16e2442278bd6d76362da72647486978acdc907e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 7 Jun 2016 18:55:23 +0530 Subject: [PATCH 5/5] [cleanup] document flow --- .../accounts/doctype/purchase_invoice/purchase_invoice.js | 3 +-- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 1 - erpnext/buying/doctype/purchase_order/purchase_order.js | 1 - .../doctype/supplier_quotation/supplier_quotation.js | 1 - erpnext/public/build.json | 2 +- .../public/js/{module_flow.js => utils/document_flow.js} | 6 +++--- erpnext/selling/doctype/quotation/quotation.js | 1 - erpnext/selling/doctype/sales_order/sales_order.js | 1 - erpnext/stock/doctype/delivery_note/delivery_note.js | 1 - erpnext/stock/doctype/purchase_receipt/purchase_receipt.js | 7 +++---- 10 files changed, 8 insertions(+), 16 deletions(-) rename erpnext/public/js/{module_flow.js => utils/document_flow.js} (93%) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 85f7748b9a..7a83c7b0b2 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -26,10 +26,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ this._super(); hide_fields(this.frm.doc); - this.frm.page.add_document_flow(cur_frm) // Show / Hide button this.show_general_ledger(); - + if(doc.update_stock==1 && doc.docstatus==1) { this.show_stock_ledger(); } diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index cdb2652f46..be8a846bd8 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -24,7 +24,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte refresh: function(doc, dt, dn) { this._super(); - this.frm.page.add_document_flow(this.frm) if(cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) { // hide new msgbox cur_frm.msgbox.hide(); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index c1fe693c5a..d90c0da28e 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -20,7 +20,6 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( // this.frm.dashboard.reset(); var allow_receipt = false; var is_drop_ship = false; - this.frm.page.add_document_flow(this.frm) for (var i in cur_frm.doc.items) { var item = cur_frm.doc.items[i]; if(item.delivered_by_supplier !== 1) { diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index 25504485e0..b3030f7745 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -7,7 +7,6 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({ refresh: function() { this._super(); - this.frm.page.add_document_flow(this.frm); if (this.frm.doc.docstatus === 1) { cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, __("Make")); diff --git a/erpnext/public/build.json b/erpnext/public/build.json index d912b68a2b..cf412e1943 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -27,7 +27,7 @@ "public/js/payment/payment_details.html", "public/js/templates/item_selector.html", "public/js/utils/item_selector.js", - "public/js/module_flow.js" + "public/js/utils/document_flow.js" ], "js/item-dashboard.min.js": [ "stock/dashboard/item_dashboard.html", diff --git a/erpnext/public/js/module_flow.js b/erpnext/public/js/utils/document_flow.js similarity index 93% rename from erpnext/public/js/module_flow.js rename to erpnext/public/js/utils/document_flow.js index 3c07b598e7..31aec8e14d 100644 --- a/erpnext/public/js/module_flow.js +++ b/erpnext/public/js/utils/document_flow.js @@ -3,8 +3,8 @@ // for module flow - -frappe.module_flow = { +frappe.provide('frappe.document_flow'); +$.extend(frappe.document_flow, { "Selling": { "Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"], "Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"] @@ -25,4 +25,4 @@ frappe.module_flow = { "Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice", "Journal Entry"] } -} \ No newline at end of file +}); diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index d1ca691079..f61f0e9849 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -16,7 +16,6 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); - this.frm.page.add_document_flow(this.frm) if(doc.docstatus == 1 && doc.status!=='Lost') { cur_frm.add_custom_button(__('Make Sales Order'), cur_frm.cscript['Make Sales Order']); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 3ffa68592b..ce9c958e46 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -22,7 +22,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( var allow_purchase = false; var allow_delivery = false; - this.frm.page.add_document_flow(this.frm) if(doc.docstatus==1) { if(doc.status != 'Closed') { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 9b51cfda78..c5fce7d760 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,7 +8,6 @@ frappe.provide("erpnext.stock.delivery_note"); erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({ refresh: function(doc, dt, dn) { this._super(); - this.frm.page.add_document_flow(this.frm) if (!doc.is_return && doc.status!="Closed") { if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note, __("Make")); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 6fdb8473dc..f622b63568 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -29,7 +29,7 @@ frappe.ui.form.on("Purchase Receipt", { } }) }) - + frm.set_query("supplier_warehouse", function() { return { filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]] @@ -41,7 +41,6 @@ frappe.ui.form.on("Purchase Receipt", { erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ refresh: function() { this._super(); - this.frm.page.add_document_flow(this.frm) if(this.frm.doc.docstatus===1) { this.show_stock_ledger(); if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) { @@ -71,9 +70,9 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend if (this.frm.has_perm("submit")) { cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt, __("Status")) } - + cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __("Make")); - + if(flt(this.frm.doc.per_billed) < 100) { cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __("Make")); }