Merge branch 'saurabh6790-module_flow' into develop
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index b634ccf..7a83c7b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -26,7 +26,6 @@
this._super();
hide_fields(this.frm.doc);
-
// 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 cc6d1e6..be8a846 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -24,7 +24,6 @@
refresh: function(doc, dt, dn) {
this._super();
-
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 ddaa5b4..d90c0da 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -20,7 +20,6 @@
// this.frm.dashboard.reset();
var allow_receipt = false;
var is_drop_ship = false;
-
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 8587a9f..b3030f7 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();
-
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 340ebdb..cf412e1 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -26,7 +26,8 @@
"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/utils/document_flow.js"
],
"js/item-dashboard.min.js": [
"stock/dashboard/item_dashboard.html",
diff --git a/erpnext/public/js/utils/document_flow.js b/erpnext/public/js/utils/document_flow.js
new file mode 100644
index 0000000..31aec8e
--- /dev/null
+++ b/erpnext/public/js/utils/document_flow.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// MIT License. See license.txt
+
+// for 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"]
+ },
+ "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"]
+ }
+});
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 9e5283c..f61f0e9 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -16,7 +16,6 @@
},
refresh: function(doc, dt, dn) {
this._super(doc, dt, dn);
-
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 29501f5..ce9c958 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -21,7 +21,7 @@
this.frm.dashboard.reset();
var allow_purchase = false;
var allow_delivery = false;
-
+
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 6d31386..c5fce7d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -8,7 +8,6 @@
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
this._super();
-
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 a967b5b..f622b63 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -29,7 +29,7 @@
}
})
})
-
+
frm.set_query("supplier_warehouse", function() {
return {
filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
@@ -41,7 +41,6 @@
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
refresh: function() {
this._super();
-
if(this.frm.doc.docstatus===1) {
this.show_stock_ledger();
if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
@@ -71,9 +70,9 @@
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"));
}