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