Merge pull request #34953 from s-aga-r/FIX-ISS-23-24-00209

fix: `PermissionError` in Work Order
This commit is contained in:
Sagar Sharma 2023-04-20 15:57:25 +05:30 committed by GitHub
commit 76c4d9011f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -625,20 +625,18 @@ erpnext.work_order = {
// all materials transferred for manufacturing, make this primary // all materials transferred for manufacturing, make this primary
finish_btn.addClass('btn-primary'); finish_btn.addClass('btn-primary');
} }
} else { } else if (frm.doc.__onload && frm.doc.__onload.overproduction_percentage) {
frappe.db.get_doc("Manufacturing Settings").then((doc) => { let allowance_percentage = frm.doc.__onload.overproduction_percentage;
let allowance_percentage = doc.overproduction_percentage_for_work_order;
if (allowance_percentage > 0) { if (allowance_percentage > 0) {
let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty); let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty);
if ((flt(doc.produced_qty) < allowed_qty)) { if ((flt(doc.produced_qty) < allowed_qty)) {
frm.add_custom_button(__('Finish'), function() { frm.add_custom_button(__('Finish'), function() {
erpnext.work_order.make_se(frm, 'Manufacture'); erpnext.work_order.make_se(frm, 'Manufacture');
}); });
}
} }
}); }
} }
} }
} else { } else {