Merge pull request #25110 from ankush/mr_stopped_validation_v12

fix: do not fetch stopped MR in production plan
This commit is contained in:
Marica
2021-04-02 13:16:13 +05:30
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -24,6 +24,16 @@ frappe.ui.form.on('Production Plan', {
}
});
frm.set_query('material_request', 'material_requests', function() {
return {
filters: {
material_request_type: "Manufacture",
docstatus: 1,
status: ["!=", "Stopped"],
}
};
});
frm.fields_dict['po_items'].grid.get_field('item_code').get_query = function(doc) {
return {
query: "erpnext.controllers.queries.item_query",

View File

@@ -68,7 +68,7 @@ class ProductionPlan(Document):
from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
where mr_item.parent = mr.name
and mr.material_request_type = "Manufacture"
and mr.docstatus = 1 and mr.company = %(company)s
and mr.docstatus = 1 and mr.status != "Stopped" and mr.company = %(company)s
and mr_item.qty > ifnull(mr_item.ordered_qty,0) {0} {1}
and (exists (select name from `tabBOM` bom where bom.item=mr_item.item_code
and bom.is_active = 1))