BugFix: Sales Order with Order Type as Shopping Cart
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 96b7105..75a2c39 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -17,40 +17,40 @@
refresh: function(doc, dt, dn) {
this._super();
this.frm.dashboard.reset();
-
+
if(doc.docstatus==1) {
if(doc.status != 'Stopped') {
-
- cur_frm.dashboard.add_progress(cint(doc.per_delivered) + __("% Delivered"),
+
+ cur_frm.dashboard.add_progress(cint(doc.per_delivered) + __("% Delivered"),
doc.per_delivered);
- cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"),
+ cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"),
doc.per_billed);
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
// delivery note
- if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales')
+ if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1)
cur_frm.add_custom_button(__('Make Delivery'), this.make_delivery_note);
-
+
// maintenance
- if(flt(doc.per_delivered, 2) < 100 && (doc.order_type !='Sales')) {
+ if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) {
cur_frm.add_custom_button(__('Make Maint. Visit'), this.make_maintenance_visit);
- cur_frm.add_custom_button(__('Make Maint. Schedule'),
+ cur_frm.add_custom_button(__('Make Maint. Schedule'),
this.make_maintenance_schedule);
}
// indent
- if(!doc.order_type || (doc.order_type == 'Sales'))
- cur_frm.add_custom_button(__('Make ') + __('Material Request'),
+ if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1)
+ cur_frm.add_custom_button(__('Make ') + __('Material Request'),
this.make_material_request);
-
+
// sales invoice
if(flt(doc.per_billed, 2) < 100)
cur_frm.add_custom_button(__('Make Invoice'), this.make_sales_invoice);
-
+
// stop
if(flt(doc.per_delivered, 2) < 100 || doc.per_billed < 100)
cur_frm.add_custom_button(__('Stop!'), cur_frm.cscript['Stop Sales Order'],"icon-exclamation");
- } else {
+ } else {
// un-stop
cur_frm.dashboard.set_headline_alert(__("Stopped"), "alert-danger", "icon-stop");
cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Sales Order'], "icon-check");
@@ -58,7 +58,7 @@
}
if (this.frm.doc.docstatus===0) {
- cur_frm.add_custom_button(__('From Quotation'),
+ cur_frm.add_custom_button(__('From Quotation'),
function() {
frappe.model.map_current_doc({
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
@@ -76,7 +76,7 @@
this.order_type(doc);
},
-
+
order_type: function() {
this.frm.toggle_reqd("delivery_date", this.frm.doc.order_type == "Sales");
},
@@ -84,7 +84,7 @@
tc_name: function() {
this.get_terms();
},
-
+
warehouse: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
if(item.item_code && item.warehouse) {
@@ -119,14 +119,14 @@
source_name: cur_frm.doc.name
})
},
-
+
make_maintenance_schedule: function() {
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
source_name: cur_frm.doc.name
})
- },
-
+ },
+
make_maintenance_visit: function() {
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
@@ -161,7 +161,7 @@
if (check) {
return $c('runserverobj', {
- 'method':'stop_sales_order',
+ 'method':'stop_sales_order',
'docs': doc
}, function(r,rt) {
cur_frm.refresh();
@@ -176,7 +176,7 @@
if (check) {
return $c('runserverobj', {
- 'method':'unstop_sales_order',
+ 'method':'unstop_sales_order',
'docs': doc
}, function(r,rt) {
cur_frm.refresh();