Skip to content

Commit 0d5ff3c

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

File tree

1 file changed

+5
-2
lines changed
  • erpnext/manufacturing/doctype/bom

1 file changed

+5
-2
lines changed

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)