Skip to content

Commit bdd297a

Browse files
committed
fix: always fetch rm rate if phantom bom
1 parent dd99ab3 commit bdd297a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

erpnext/manufacturing/doctype/bom/bom.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@
387387
"read_only": 1
388388
},
389389
{
390+
"depends_on": "eval:!doc.is_phantom_bom",
390391
"fieldname": "project",
391392
"fieldtype": "Link",
392393
"label": "Project",
@@ -682,7 +683,7 @@
682683
"image_field": "image",
683684
"is_submittable": 1,
684685
"links": [],
685-
"modified": "2025-11-05 11:24:02.042055",
686+
"modified": "2025-11-06 15:27:54.806116",
686687
"modified_by": "Administrator",
687688
"module": "Manufacturing",
688689
"name": "BOM",

erpnext/manufacturing/doctype/bom/bom.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ def get_rm_rate(self, arg):
488488
if not frappe.db.get_value("Item", arg["item_code"], "is_customer_provided_item") and not arg.get(
489489
"sourced_by_supplier"
490490
):
491-
if arg.get("bom_no") and self.set_rate_of_sub_assembly_item_based_on_bom:
491+
if arg.get("bom_no") and (
492+
self.set_rate_of_sub_assembly_item_based_on_bom or arg.get("is_phantom_item")
493+
):
492494
rate = flt(self.get_bom_unitcost(arg["bom_no"])) * (arg.get("conversion_factor") or 1)
493495
else:
494496
rate = get_bom_item_rate(arg, self)
@@ -889,7 +891,7 @@ def calculate_rm_cost(self, save=False):
889891

890892
for d in self.get("items"):
891893
old_rate = d.rate
892-
if not self.bom_creator and d.is_stock_item:
894+
if not self.bom_creator and (d.is_stock_item or d.is_phantom_item):
893895
d.rate = self.get_rm_rate(
894896
{
895897
"company": self.company,
@@ -900,6 +902,7 @@ def calculate_rm_cost(self, save=False):
900902
"stock_uom": d.stock_uom,
901903
"conversion_factor": d.conversion_factor,
902904
"sourced_by_supplier": d.sourced_by_supplier,
905+
"is_phantom_item": d.is_phantom_item,
903906
}
904907
)
905908

0 commit comments

Comments
 (0)