Compare commits

..

2 Commits

Author SHA1 Message Date
rohitwaghchaure
547b21e450 fix: calculate operating cost based on BOM Quantity (#27464)
* fix: calculate operating cost based on BOM Quantity

* fix: added test cases

(cherry picked from commit 2e2985e4f1)

# Conflicts:
#	erpnext/manufacturing/doctype/bom/bom.py
#	erpnext/manufacturing/doctype/bom/test_bom.py
#	erpnext/manufacturing/doctype/bom_operation/bom_operation.json
2025-02-24 00:12:08 +00:00
mergify[bot]
f5160dc83d fix: use Stock Qty while getting POS Reserved Qty (backport #38962) (#38983)
fix: use `Stock Qty` while getting `POS Reserved Qty`

(cherry picked from commit 7223106417)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
2023-12-28 12:00:04 +05:30
5 changed files with 20 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import frappe
from erpnext.hooks import regional_overrides
__version__ = "13.55.2"
__version__ = "13.54.4"
def get_default_company(user=None):

View File

@@ -704,7 +704,7 @@ def get_pos_reserved_qty(item_code, warehouse):
reserved_qty = (
frappe.qb.from_(p_inv)
.from_(p_item)
.select(Sum(p_item.qty).as_("qty"))
.select(Sum(p_item.stock_qty).as_("stock_qty"))
.where(
(p_inv.name == p_item.parent)
& (IfNull(p_inv.consolidated_invoice, "") == "")
@@ -715,7 +715,7 @@ def get_pos_reserved_qty(item_code, warehouse):
)
).run(as_dict=True)
return reserved_qty[0].qty or 0 if reserved_qty else 0
return flt(reserved_qty[0].stock_qty) if reserved_qty else 0
@frappe.whitelist()

View File

@@ -621,6 +621,12 @@ class BOM(WebsiteGenerator):
if d.set_cost_based_on_bom_qty:
operating_cost = flt(d.cost_per_unit) * flt(self.quantity)
base_operating_cost = flt(d.base_cost_per_unit) * flt(self.quantity)
<<<<<<< HEAD
=======
self.operating_cost += flt(operating_cost)
self.base_operating_cost += flt(base_operating_cost)
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
self.operating_cost += flt(operating_cost)
self.base_operating_cost += flt(base_operating_cost)

View File

@@ -140,7 +140,11 @@ class TestBOM(FrappeTestCase):
for op_row in bom.operations:
self.assertAlmostEqual(op_row.cost_per_unit, op_row.operating_cost / 2)
<<<<<<< HEAD
self.assertAlmostEqual(bom.operating_cost, op_cost / 2)
=======
self.assertAlmostEqual(bom.operating_cost, op_cost/2)
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
bom.delete()
def test_bom_cost_multi_uom_multi_currency_based_on_price_list(self):

View File

@@ -11,7 +11,10 @@
"col_break1",
"workstation",
"time_in_mins",
<<<<<<< HEAD
"fixed_time",
=======
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
"costing_section",
"hour_rate",
"base_hour_rate",
@@ -186,7 +189,11 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2022-08-22 01:18:33.547481",
=======
"modified": "2021-09-13 16:45:01.092868",
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Operation",