Skip to content

Commit

Permalink
chore: remove rate of material based on Manual
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure committed Apr 2, 2024
1 parent 271fea6 commit 0b63dbf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions erpnext/manufacturing/doctype/bom/bom.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
"fieldname": "rm_cost_as_per",
"fieldtype": "Select",
"label": "Rate Of Materials Based On",
"options": "Valuation Rate\nLast Purchase Rate\nPrice List\nManual"
"options": "Valuation Rate\nLast Purchase Rate\nPrice List"
},
{
"allow_on_submit": 1,
Expand Down Expand Up @@ -637,7 +637,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2024-03-27 13:06:40.214929",
"modified": "2024-04-02 16:22:47.518411",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",
Expand Down
7 changes: 3 additions & 4 deletions erpnext/manufacturing/doctype/bom/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class BOM(WebsiteGenerator):
quality_inspection_template: DF.Link | None
quantity: DF.Float
raw_material_cost: DF.Currency
rm_cost_as_per: DF.Literal["Valuation Rate", "Last Purchase Rate", "Price List", "Manual"]
rm_cost_as_per: DF.Literal["Valuation Rate", "Last Purchase Rate", "Price List"]
route: DF.SmallText | None
routing: DF.Link | None
scrap_items: DF.Table[BOMScrapItem]
Expand Down Expand Up @@ -737,6 +737,7 @@ def update_rate_and_time(self, row, update_hour_rate=False):

def calculate_rm_cost(self, save=False):
"""Fetch RM rate as per today's valuation rate and calculate totals"""

total_rm_cost = 0
base_total_rm_cost = 0

Expand All @@ -745,7 +746,7 @@ def calculate_rm_cost(self, save=False):
continue

old_rate = d.rate
if self.rm_cost_as_per != "Manual":
if not self.bom_creator:
d.rate = self.get_rm_rate(
{
"company": self.company,
Expand Down Expand Up @@ -1017,8 +1018,6 @@ def get_bom_item_rate(args, bom_doc):
item_doc = frappe.get_cached_doc("Item", args.get("item_code"))
price_list_data = get_price_list_rate(bom_args, item_doc)
rate = price_list_data.price_list_rate
elif bom_doc.rm_cost_as_per == "Manual":
return

return flt(rate)

Expand Down
4 changes: 2 additions & 2 deletions erpnext/manufacturing/doctype/bom_creator/bom_creator.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"fieldname": "rm_cost_as_per",
"fieldtype": "Select",
"label": "Rate Of Materials Based On",
"options": "Valuation Rate\nLast Purchase Rate\nPrice List\nManual",
"options": "Valuation Rate\nLast Purchase Rate\nPrice List",
"reqd": 1
},
{
Expand Down Expand Up @@ -288,7 +288,7 @@
"link_fieldname": "bom_creator"
}
],
"modified": "2024-03-27 13:06:40.535884",
"modified": "2024-04-02 16:30:59.779190",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Creator",
Expand Down
6 changes: 1 addition & 5 deletions erpnext/manufacturing/doctype/bom_creator/bom_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BOMCreator(Document):
qty: DF.Float
raw_material_cost: DF.Currency
remarks: DF.TextEditor | None
rm_cost_as_per: DF.Literal["Valuation Rate", "Last Purchase Rate", "Price List", "Manual"]
rm_cost_as_per: DF.Literal["Valuation Rate", "Last Purchase Rate", "Price List"]
set_rate_based_on_warehouse: DF.Check
status: DF.Literal["Draft", "Submitted", "In Progress", "Completed", "Failed", "Cancelled"]
uom: DF.Link | None
Expand Down Expand Up @@ -141,9 +141,6 @@ def add_boms(self):
self.submit()

def set_rate_for_items(self):
if self.rm_cost_as_per == "Manual":
return

amount = self.get_raw_material_cost()
self.raw_material_cost = amount

Expand Down Expand Up @@ -282,7 +279,6 @@ def create_bom(self, row, production_item_wise_rm):
"allow_alternative_item": 1,
"bom_creator": self.name,
"bom_creator_item": bom_creator_item,
"rm_cost_as_per": "Manual",
}
)

Expand Down

0 comments on commit 0b63dbf

Please sign in to comment.