refactor: minor problems in production plan (#55577)

This commit is contained in:
Mihir Kandoi
2026-06-03 15:21:59 +05:30
committed by GitHub
parent d2d28c9e03
commit 4ee8bbb06b
2 changed files with 9 additions and 10 deletions

View File

@@ -693,6 +693,7 @@ frappe.ui.form.on("Production Plan Sub Assembly Item", {
callback: function (r) {
if (r.message && r.message.length) {
frappe.model.set_value(cdt, cdn, "actual_qty", r.message[0].actual_qty);
frappe.model.set_value(cdt, cdn, "projected_qty", r.message[0].projected_qty);
}
},
});

View File

@@ -17,6 +17,7 @@ from frappe.utils import (
cint,
comma_and,
flt,
get_filtered_list_link,
get_link_to_form,
getdate,
now_datetime,
@@ -835,7 +836,6 @@ class ProductionPlan(Document):
for field in [
"production_item",
"item_name",
"qty",
"fg_warehouse",
"description",
"bom_no",
@@ -917,9 +917,7 @@ class ProductionPlan(Document):
return
frappe.flags.mute_messages = False
if doc_list:
doc_list = [get_link_to_form(doctype, p) for p in doc_list]
msgprint(_("{0} created").format(comma_and(doc_list)))
msgprint(_("{0} created").format(get_filtered_list_link(doctype, doc_list)))
def create_work_order(self, item):
from erpnext.manufacturing.doctype.work_order.work_order import OverProductionError
@@ -1093,8 +1091,8 @@ class ProductionPlan(Document):
).format(self.sub_assembly_warehouse)
+ "<br><br>"
)
message += _(
"If you still want to proceed, please disable 'Skip Available Sub Assembly Items' checkbox."
message += _("If you still want to proceed, please disable '{0}' checkbox.").format(
self.meta.get_field("skip_available_sub_assembly_item").label
)
frappe.msgprint(message, title=_("Note"))
@@ -1835,7 +1833,9 @@ def get_items_for_material_requests(
mr_items = new_mr_items
if not mr_items:
to_enable = frappe.bold(_("Ignore Existing Projected Quantity"))
to_enable = frappe.bold(
frappe.get_meta("Production Plan").get_field("ignore_existing_ordered_qty").label
)
warehouse = frappe.bold(doc.get("for_warehouse"))
message = (
_(
@@ -1853,9 +1853,7 @@ def get_items_for_material_requests(
def get_materials_from_other_locations(item, warehouses, new_mr_items, company):
from erpnext.stock.doctype.pick_list.pick_list import get_available_item_locations
stock_uom, purchase_uom = frappe.db.get_value(
"Item", item.get("item_code"), ["stock_uom", "purchase_uom"]
)
purchase_uom = frappe.db.get_value("Item", item.get("item_code"), "purchase_uom")
locations = get_available_item_locations(
item.get("item_code"),