Skip to content

Commit 9cc5d14

Browse files
committed
fix: handle Get Items From buttons when is_return is set on document load
1 parent 6bdf311 commit 9cc5d14

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

erpnext/accounts/doctype/sales_invoice/sales_invoice.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,16 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
255255
}
256256

257257
toggle_get_items() {
258-
// Show buttons only when pos view is inactive and not is_return
259-
if (
260-
cint(this.frm.doc.docstatus == 0) &&
261-
this.frm.page.current_view_name !== "pos" &&
262-
!this.frm.doc.is_return
263-
) {
264-
this.frm.cscript.sales_order_btn();
258+
if (cint(this.frm.doc.docstatus == 0) && this.frm.page.current_view_name !== "pos") {
259+
if (!this.frm.doc.is_return) {
260+
this.frm.cscript.sales_order_btn();
261+
this.frm.cscript.quotation_btn();
262+
} else {
263+
["Sales Order", "Quotation", "Timesheet"].forEach((label) => {
264+
this.frm.remove_custom_button(label, "Get Items From");
265+
});
266+
}
265267
this.frm.cscript.delivery_note_btn();
266-
this.frm.cscript.quotation_btn();
267268
} else {
268269
["Sales Order", "Quotation", "Timesheet"].forEach((label) => {
269270
this.frm.remove_custom_button(label, "Get Items From");

0 commit comments

Comments
 (0)