From fa0ef7a63db14533b0f6db2417c4a5dde832fd2f Mon Sep 17 00:00:00 2001 From: "Nihantra C. Patel" <141945075+Nihantra-Patel@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:02:18 +0530 Subject: [PATCH] fix: creation of return/credit note from sales invoice --- .../accounts/doctype/sales_invoice/sales_invoice.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index bf899a0e70e..9d8d37d3ce1 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -112,10 +112,13 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e return item.is_delivered_by_supplier ? true : false; }) - if(doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) { - cur_frm.add_custom_button(__('Return / Credit Note'), - this.make_sales_return, __('Create')); - cur_frm.page.set_inner_btn_group_as_primary(__('Create')); + if (doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) { + this.frm.add_custom_button( + __("Return / Credit Note"), + this.make_sales_return.bind(this), + __("Create") + ); + this.frm.page.set_inner_btn_group_as_primary(__("Create")); } if(cint(doc.update_stock)!=1) { -- GitLab