mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-20 23:35:11 +00:00
Merge pull request #50273 from rohitwaghchaure/fixed-mps-workspace
fix: added MPS, MRP report in the manufacturing workspace
This commit is contained in:
@@ -457,3 +457,13 @@ def get_item_lead_time(item_code):
|
||||
return result[0].cumulative_lead_time or 0
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_mps_details(mps):
|
||||
return frappe.db.get_value(
|
||||
"Master Production Schedule",
|
||||
mps,
|
||||
["name", "from_date", "to_date", "company", "posting_date"],
|
||||
as_dict=True,
|
||||
)
|
||||
|
||||
@@ -52,6 +52,23 @@ frappe.query_reports["Material Requirements Planning Report"] = {
|
||||
fieldtype: "Link",
|
||||
options: "Master Production Schedule",
|
||||
reqd: 1,
|
||||
on_change() {
|
||||
let mps = frappe.query_report.get_filter_value("mps");
|
||||
if (mps) {
|
||||
frappe.call({
|
||||
method: "erpnext.manufacturing.doctype.master_production_schedule.master_production_schedule.get_mps_details",
|
||||
args: {
|
||||
mps: mps,
|
||||
},
|
||||
callback: function (r) {
|
||||
if (r.message) {
|
||||
frappe.query_report.set_filter_value("from_date", r.message.from_date);
|
||||
frappe.query_report.set_filter_value("to_date", r.message.to_date);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "type_of_material",
|
||||
|
||||
@@ -13,69 +13,6 @@
|
||||
"is_hidden": 0,
|
||||
"label": "Manufacturing",
|
||||
"links": [
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Production",
|
||||
"link_count": 0,
|
||||
"onboard": 0,
|
||||
"type": "Card Break"
|
||||
},
|
||||
{
|
||||
"dependencies": "Item, BOM",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Work Order",
|
||||
"link_count": 0,
|
||||
"link_to": "Work Order",
|
||||
"link_type": "DocType",
|
||||
"onboard": 1,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "Item, BOM",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Production Plan",
|
||||
"link_count": 0,
|
||||
"link_to": "Production Plan",
|
||||
"link_type": "DocType",
|
||||
"onboard": 1,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "Item",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Stock Entry",
|
||||
"link_count": 0,
|
||||
"link_to": "Stock Entry",
|
||||
"link_type": "DocType",
|
||||
"onboard": 1,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Job Card",
|
||||
"link_count": 0,
|
||||
"link_to": "Job Card",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Downtime Entry",
|
||||
"link_count": 0,
|
||||
"link_to": "Downtime Entry",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
@@ -199,11 +136,90 @@
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting",
|
||||
"link_count": 7,
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Card Break"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "BOM",
|
||||
"link_count": 0,
|
||||
"link_to": "BOM",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting BOM",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracting BOM",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting Order",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracting Order",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting Receipt",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracting Receipt",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Subcontract Order Summary",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontract Order Summary",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Subcontracted Raw Materials To Be Transferred",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracted Raw Materials To Be Transferred",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Subcontracted Item To Be Received",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracted Item To Be Received",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Reports",
|
||||
"link_count": 10,
|
||||
"link_count": 11,
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Card Break"
|
||||
@@ -219,6 +235,16 @@
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Material Requirements Planning",
|
||||
"link_count": 0,
|
||||
"link_to": "Material Requirements Planning Report",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "Work Order",
|
||||
"hidden": 0,
|
||||
@@ -320,18 +346,73 @@
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting",
|
||||
"label": "Production",
|
||||
"link_count": 7,
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Card Break"
|
||||
},
|
||||
{
|
||||
"dependencies": "Item, BOM",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "BOM",
|
||||
"label": "Work Order",
|
||||
"link_count": 0,
|
||||
"link_to": "BOM",
|
||||
"link_to": "Work Order",
|
||||
"link_type": "DocType",
|
||||
"onboard": 1,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "Item, BOM",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Production Plan",
|
||||
"link_count": 0,
|
||||
"link_to": "Production Plan",
|
||||
"link_type": "DocType",
|
||||
"onboard": 1,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "Item",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Stock Entry",
|
||||
"link_count": 0,
|
||||
"link_to": "Stock Entry",
|
||||
"link_type": "DocType",
|
||||
"onboard": 1,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Master Production Schedule",
|
||||
"link_count": 0,
|
||||
"link_to": "Master Production Schedule",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Job Card",
|
||||
"link_count": 0,
|
||||
"link_to": "Job Card",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "",
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Downtime Entry",
|
||||
"link_count": 0,
|
||||
"link_to": "Downtime Entry",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
@@ -339,65 +420,15 @@
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting BOM",
|
||||
"label": "Sales Forecast",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracting BOM",
|
||||
"link_to": "Sales Forecast",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting Order",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracting Order",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
"label": "Subcontracting Receipt",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracting Receipt",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Subcontract Order Summary",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontract Order Summary",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Subcontracted Raw Materials To Be Transferred",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracted Raw Materials To Be Transferred",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "Subcontracted Item To Be Received",
|
||||
"link_count": 0,
|
||||
"link_to": "Subcontracted Item To Be Received",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
}
|
||||
],
|
||||
"modified": "2025-01-06 10:43:08.754978",
|
||||
"modified": "2025-10-30 11:49:35.589944",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Manufacturing",
|
||||
@@ -466,16 +497,19 @@
|
||||
{
|
||||
"label": "Forecasting",
|
||||
"link_to": "Exponential Smoothing Forecasting",
|
||||
"report_ref_doctype": "Sales Order",
|
||||
"type": "Report"
|
||||
},
|
||||
{
|
||||
"label": "BOM Stock Report",
|
||||
"link_to": "BOM Stock Report",
|
||||
"report_ref_doctype": "BOM",
|
||||
"type": "Report"
|
||||
},
|
||||
{
|
||||
"label": "Production Planning Report",
|
||||
"link_to": "Production Planning Report",
|
||||
"report_ref_doctype": "Work Order",
|
||||
"type": "Report"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -6,18 +6,6 @@ frappe.ui.form.on("Item Lead Time", {
|
||||
frm.trigger("setup_queries");
|
||||
},
|
||||
|
||||
setup_queries(frm) {
|
||||
frm.set_query("bom_no", () => {
|
||||
return {
|
||||
filters: {
|
||||
item: frm.doc.item_code,
|
||||
docstatus: 1,
|
||||
with_operations: 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
shift_time_in_hours(frm) {
|
||||
frm.trigger("calculate_total_workstation_time");
|
||||
},
|
||||
@@ -30,6 +18,10 @@ frappe.ui.form.on("Item Lead Time", {
|
||||
frm.trigger("calculate_total_workstation_time");
|
||||
},
|
||||
|
||||
validate(frm) {
|
||||
frm.trigger("calculate_total_workstation_time");
|
||||
},
|
||||
|
||||
calculate_total_workstation_time(frm) {
|
||||
let total_workstation_time =
|
||||
frm.doc.shift_time_in_hours * frm.doc.no_of_workstations * frm.doc.no_of_shift;
|
||||
@@ -45,8 +37,7 @@ frappe.ui.form.on("Item Lead Time", {
|
||||
},
|
||||
|
||||
calculate_no_of_units_produced(frm) {
|
||||
let no_of_units_produced =
|
||||
Math.ceil(frm.doc.total_workstation_time / frm.doc.manufacturing_time_in_mins) * 60;
|
||||
let no_of_units_produced = (frm.doc.total_workstation_time / frm.doc.manufacturing_time_in_mins) * 60;
|
||||
frm.set_value("no_of_units_produced", no_of_units_produced);
|
||||
},
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"item_code",
|
||||
"column_break_qwyo",
|
||||
"manufacturing_section",
|
||||
"bom_no",
|
||||
"shift_time_in_hours",
|
||||
"no_of_workstations",
|
||||
"column_break_cdqv",
|
||||
@@ -19,7 +18,6 @@
|
||||
"section_break_wuqi",
|
||||
"column_break_yilv",
|
||||
"manufacturing_time_in_mins",
|
||||
"no_of_days",
|
||||
"no_of_units_produced",
|
||||
"column_break_bbsv",
|
||||
"daily_yield",
|
||||
@@ -78,12 +76,6 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Workstation"
|
||||
},
|
||||
{
|
||||
"fieldname": "bom_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Default BOM",
|
||||
"options": "BOM"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "no_of_shift",
|
||||
@@ -101,7 +93,7 @@
|
||||
"label": "Manufacturing Time"
|
||||
},
|
||||
{
|
||||
"description": "Per Day",
|
||||
"description": "Per Day\nShift Time (In Hours) * No of Workstations * No of Shift",
|
||||
"fieldname": "total_workstation_time",
|
||||
"fieldtype": "Int",
|
||||
"label": "Total Workstation Time (In Hours)"
|
||||
@@ -111,15 +103,17 @@
|
||||
"description": "(Good Units Produced / Total Units Produced) \u00d7 100",
|
||||
"fieldname": "daily_yield",
|
||||
"fieldtype": "Percent",
|
||||
"label": "Daily Yield"
|
||||
"label": "Daily Yield (%)"
|
||||
},
|
||||
{
|
||||
"description": "(Daily Yield * No of Units Produced) / 100",
|
||||
"fieldname": "capacity_per_day",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Capacity"
|
||||
},
|
||||
{
|
||||
"description": "(Total Workstation Time / Manufacturing Time) * 60",
|
||||
"fieldname": "no_of_units_produced",
|
||||
"fieldtype": "Int",
|
||||
"label": "No of Units Produced"
|
||||
@@ -174,12 +168,6 @@
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Purchase Time"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "no_of_days",
|
||||
"fieldtype": "Int",
|
||||
"label": "No of Days"
|
||||
},
|
||||
{
|
||||
"fieldname": "manufacturing_time_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
@@ -189,7 +177,7 @@
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-08-31 13:12:38.458052",
|
||||
"modified": "2025-10-30 11:45:03.602345",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Lead Time",
|
||||
|
||||
@@ -14,14 +14,12 @@ class ItemLeadTime(Document):
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
bom_no: DF.Link | None
|
||||
buffer_time: DF.Int
|
||||
capacity_per_day: DF.Int
|
||||
daily_yield: DF.Percent
|
||||
item_code: DF.Link | None
|
||||
item_name: DF.Data | None
|
||||
manufacturing_time_in_mins: DF.Int
|
||||
no_of_days: DF.Int
|
||||
no_of_shift: DF.Int
|
||||
no_of_units_produced: DF.Int
|
||||
no_of_workstations: DF.Int
|
||||
|
||||
Reference in New Issue
Block a user