refactor: minor problems in production plan (backport #55577) (#55595)

Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
mergify[bot]
2026-06-03 21:02:31 +05:30
committed by GitHub
parent 40cf77e7f0
commit 9a2549dc32
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

@@ -18,6 +18,7 @@ from frappe.utils import (
cint,
comma_and,
flt,
get_filtered_list_link,
get_link_to_form,
getdate,
now_datetime,
@@ -836,7 +837,6 @@ class ProductionPlan(Document):
for field in [
"production_item",
"item_name",
"qty",
"fg_warehouse",
"description",
"bom_no",
@@ -918,9 +918,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
@@ -1094,8 +1092,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"))
@@ -1830,7 +1828,9 @@ def get_items_for_material_requests(doc, warehouses=None, get_parent_warehouse_d
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 = (
_(
@@ -1848,9 +1848,7 @@ def get_items_for_material_requests(doc, warehouses=None, get_parent_warehouse_d
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"),