fix(ui): hide "Update Items" button based on subcontracting conditions
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 2b1e3ce..582f23e 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -157,14 +157,17 @@
if(!in_list(["Closed", "Delivered"], doc.status)) {
if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received) < 100 && flt(this.frm.doc.per_billed) < 100) {
- this.frm.add_custom_button(__('Update Items'), () => {
- erpnext.utils.update_child_items({
- frm: this.frm,
- child_docname: "items",
- child_doctype: "Purchase Order Detail",
- cannot_add_row: false,
- })
- });
+ // Don't add Update Items button if the PO is following the new subcontracting flow.
+ if (!(this.frm.doc.is_subcontracted && !this.frm.doc.is_old_subcontracting_flow)) {
+ this.frm.add_custom_button(__('Update Items'), () => {
+ erpnext.utils.update_child_items({
+ frm: this.frm,
+ child_docname: "items",
+ child_doctype: "Purchase Order Detail",
+ cannot_add_row: false,
+ })
+ });
+ }
}
if (this.frm.has_perm("submit")) {
if(flt(doc.per_billed, 6) < 100 || flt(doc.per_received, 6) < 100) {