diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 9e3a76b12ca3..79ed7d0a8361 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -302,8 +302,13 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe return; } + let show_qc_button = true; + if (["Sales Invoice", "Purchase Invoice"].includes(this.frm.doc.doctype)) { + show_qc_button = this.frm.doc.update_stock; + } + const me = this; - if (!this.frm.is_new() && this.frm.doc.docstatus === 0 && frappe.model.can_create("Quality Inspection") && this.frm.doc.update_stock) { + if (!this.frm.is_new() && this.frm.doc.docstatus === 0 && frappe.model.can_create("Quality Inspection") && show_qc_button) { this.frm.add_custom_button(__("Quality Inspection(s)"), () => { me.make_quality_inspection(); }, __("Create"));