diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js index f53f4d279b..2bc2dbba8e 100644 --- a/buying/doctype/purchase_order/purchase_order.js +++ b/buying/doctype/purchase_order/purchase_order.js @@ -49,9 +49,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.docstatus == 1 && doc.status != 'Stopped'){ cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); - if(doc.per_received < 100) cur_frm.add_custom_button('Make Purchase Receipt', cur_frm.cscript['Make Purchase Receipt']); - if(doc.per_billed < 100) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Purchase Invoice']); - if(doc.per_billed < 100 || doc.per_received < 100) cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']); + if(flt(doc.per_received, 2) < 100) cur_frm.add_custom_button('Make Purchase Receipt', cur_frm.cscript['Make Purchase Receipt']); + if(flt(doc.per_billed, 2) < 100) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Purchase Invoice']); + if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100) cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']); } if(doc.docstatus == 1 && doc.status == 'Stopped') diff --git a/buying/doctype/purchase_request/purchase_request.js b/buying/doctype/purchase_request/purchase_request.js index 52093397c9..7a397b5784 100644 --- a/buying/doctype/purchase_request/purchase_request.js +++ b/buying/doctype/purchase_request/purchase_request.js @@ -50,7 +50,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { erpnext.hide_naming_series(); if(doc.docstatus == 1 && doc.status != 'Stopped'){ - if(doc.per_ordered < 100) { + if(flt(doc.per_ordered, 2) < 100) { cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']); cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']); } diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js index 288c1f427f..8950a559f1 100644 --- a/selling/doctype/sales_order/sales_order.js +++ b/selling/doctype/sales_order/sales_order.js @@ -66,11 +66,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.status != 'Stopped') { cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); // delivery note - if(doc.per_delivered < 100 && doc.order_type=='Sales') + if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales') cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']); // maintenance - if(doc.per_delivered < 100 && (doc.order_type !='Sales')) { + if(flt(doc.per_delivered, 2) < 100 && (doc.order_type !='Sales')) { cur_frm.add_custom_button('Make Maint. Visit', cur_frm.cscript.make_maintenance_visit); cur_frm.add_custom_button('Make Maint. Schedule', cur_frm.cscript['Make Maintenance Schedule']); } @@ -80,11 +80,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Request']); // sales invoice - if(doc.per_billed < 100) + if(flt(doc.per_billed, 2) < 100) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']); // stop - if(doc.per_delivered < 100 || doc.per_billed < 100) + if(flt(doc.per_delivered, 2) < 100 || doc.per_billed < 100) cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']); } else { // un-stop diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index 7929baa8f2..d526f96cdb 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -59,9 +59,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn); - if(doc.per_billed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']); + if(flt(doc.per_billed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']); - if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']); + if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']); if (doc.docstatus==1) cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js index 3f59d0afe7..4aa10e2b25 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/stock/doctype/purchase_receipt/purchase_receipt.js @@ -49,7 +49,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn); if(doc.docstatus == 1){ - if (doc.per_billed < 100) cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']); + if (flt(doc.per_billed, 2) < 100) cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']); cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']); }