Merge branch 'develop' into fix_asset_scrap_and_sale_dep
This commit is contained in:
commit
cf72931816
@ -557,8 +557,8 @@ erpnext.work_order = {
|
||||
|
||||
if(!frm.doc.skip_transfer){
|
||||
// If "Material Consumption is check in Manufacturing Settings, allow Material Consumption
|
||||
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))
|
||||
&& frm.doc.status != 'Stopped') {
|
||||
if (flt(doc.material_transferred_for_manufacturing) > 0 && frm.doc.status != 'Stopped') {
|
||||
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) {
|
||||
frm.has_finish_btn = true;
|
||||
|
||||
if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) {
|
||||
@ -589,6 +589,21 @@ erpnext.work_order = {
|
||||
// all materials transferred for manufacturing, make this primary
|
||||
finish_btn.addClass('btn-primary');
|
||||
}
|
||||
} else {
|
||||
frappe.db.get_doc("Manufacturing Settings").then((doc) => {
|
||||
let allowance_percentage = doc.overproduction_percentage_for_work_order;
|
||||
|
||||
if (allowance_percentage > 0) {
|
||||
let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty);
|
||||
|
||||
if ((flt(doc.produced_qty) < allowed_qty)) {
|
||||
frm.add_custom_button(__('Finish'), function() {
|
||||
erpnext.work_order.make_se(frm, 'Manufacture');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
|
||||
|
@ -1073,8 +1073,8 @@ class StockEntry(StockController):
|
||||
# No work order could mean independent Manufacture entry, if so skip validation
|
||||
if self.work_order and self.fg_completed_qty > allowed_qty:
|
||||
frappe.throw(
|
||||
_("For quantity {0} should not be greater than work order quantity {1}").format(
|
||||
flt(self.fg_completed_qty), wo_qty
|
||||
_("For quantity {0} should not be greater than allowed quantity {1}").format(
|
||||
flt(self.fg_completed_qty), allowed_qty
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user