diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 3b8f4e2c572..286a013e327 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -124,8 +124,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) { // close - this.frm.add_custom_button(__('Close'), - function() { me.close_sales_order() }, __("Status")) + this.frm.add_custom_button(__('Close'), () => this.close_sales_order(), __("Status")) } } else if(doc.status === 'Closed') { @@ -160,57 +159,44 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( if (this.frm.has_perm("submit")) { if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) { // hold - this.frm.add_custom_button(__('Hold'), - function() { - me.hold_sales_order(); - }, __("Status")) + this.frm.add_custom_button(__('Hold'), () => this.hold_sales_order(), __("Status")) // close - this.frm.add_custom_button(__('Close'), - function() { me.close_sales_order() }, __("Status")) + this.frm.add_custom_button(__('Close'), () => this.close_sales_order(), __("Status")) } } // delivery note if(flt(doc.per_delivered, 6) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && allow_delivery) { - this.frm.add_custom_button(__('Delivery'), - function() { me.make_delivery_note_based_on_delivery_date(); }, __('Create')); - this.frm.add_custom_button(__('Work Order'), - function() { me.make_work_order() }, __('Create')); + this.frm.add_custom_button(__('Delivery'), () => this.make_delivery_note_based_on_delivery_date(), __('Create')); + this.frm.add_custom_button(__('Work Order'), () => this.make_work_order(), __('Create')); } // sales invoice if(flt(doc.per_billed, 6) < 100) { - this.frm.add_custom_button(__('Invoice'), - function() { me.make_sales_invoice() }, __('Create')); + this.frm.add_custom_button(__('Invoice'), () => me.make_sales_invoice(), __('Create')); } // material request if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && flt(doc.per_delivered, 6) < 100) { - this.frm.add_custom_button(__('Material Request'), - function() { me.make_material_request() }, __('Create')); - this.frm.add_custom_button(__('Request for Raw Materials'), - function() { me.make_raw_material_request() }, __('Create')); + this.frm.add_custom_button(__('Material Request'), () => this.make_material_request(), __('Create')); + this.frm.add_custom_button(__('Request for Raw Materials'), () => this.make_raw_material_request(), __('Create')); } // make purchase order if(flt(doc.per_delivered, 6) < 100 && allow_purchase) { - this.frm.add_custom_button(__('Purchase Order'), - function() { me.make_purchase_order() }, __('Create')); + this.frm.add_custom_button(__('Purchase Order'), () => this.make_purchase_order(), __('Create')); } // maintenance if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) { - this.frm.add_custom_button(__('Maintenance Visit'), - function() { me.make_maintenance_visit() }, __('Create')); - this.frm.add_custom_button(__('Maintenance Schedule'), - function() { me.make_maintenance_schedule() }, __('Create')); + this.frm.add_custom_button(__('Maintenance Visit'), () => this.make_maintenance_visit(), __('Create')); + this.frm.add_custom_button(__('Maintenance Schedule'), () => this.make_maintenance_schedule(), __('Create')); } // project if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && allow_delivery) { - this.frm.add_custom_button(__('Project'), - function() { me.make_project() }, __('Create')); + this.frm.add_custom_button(__('Project'), () => this.make_project(), __('Create')); } if(!doc.auto_repeat) { @@ -221,10 +207,8 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } // payment request if(flt(doc.per_billed)==0) { - this.frm.add_custom_button(__('Payment Request'), - function() { me.make_payment_request() }, __('Create')); - this.frm.add_custom_button(__('Payment'), - function() { me.make_payment_entry() }, __('Create')); + this.frm.add_custom_button(__('Payment Request'), () => this.make_payment_request(), __('Create')); + this.frm.add_custom_button(__('Payment'), () => this.make_payment_entry(), __('Create')); } this.frm.page.set_inner_btn_group_as_primary(__('Create')); }