mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-08 23:09:33 +00:00
fix: resolve conflicts
This commit is contained in:
@@ -966,12 +966,9 @@ class ProductionPlan(Document):
|
||||
material_request_list = []
|
||||
material_request_map = {}
|
||||
|
||||
if all([item.requested_qty == item.quantity for item in self.mr_items]):
|
||||
msgprint(_("All items are already requested"))
|
||||
return
|
||||
|
||||
for item in self.mr_items:
|
||||
if item.quantity == item.requested_qty:
|
||||
qty_to_request = flt(flt(item.quantity) - flt(item.requested_qty), item.precision("quantity"))
|
||||
if qty_to_request <= 0:
|
||||
continue
|
||||
|
||||
item_doc = frappe.get_cached_doc("Item", item.item_code)
|
||||
@@ -1006,7 +1003,7 @@ class ProductionPlan(Document):
|
||||
"from_warehouse": item.from_warehouse
|
||||
if material_request_type == "Material Transfer"
|
||||
else None,
|
||||
"qty": item.quantity - item.requested_qty,
|
||||
"qty": qty_to_request,
|
||||
"uom": item.uom,
|
||||
"schedule_date": schedule_date,
|
||||
"warehouse": item.warehouse,
|
||||
@@ -1019,6 +1016,10 @@ class ProductionPlan(Document):
|
||||
},
|
||||
)
|
||||
|
||||
if not material_request_list:
|
||||
msgprint(_("All items are already requested"))
|
||||
return
|
||||
|
||||
for material_request in material_request_list:
|
||||
# submit
|
||||
material_request.flags.ignore_permissions = 1
|
||||
|
||||
@@ -341,6 +341,23 @@ class TestProductionPlan(ERPNextTestSuite):
|
||||
pln = frappe.get_doc("Production Plan", pln.name)
|
||||
pln.cancel()
|
||||
|
||||
def test_production_plan_material_request_skips_zero_qty_items(self):
|
||||
pln = create_production_plan(item_code="Test Production Item 1")
|
||||
zero_qty_item, requested_item = pln.mr_items
|
||||
zero_qty_item.quantity = "0"
|
||||
|
||||
pln.make_material_request()
|
||||
|
||||
material_request_items = frappe.get_all(
|
||||
"Material Request Item",
|
||||
filters={"production_plan": pln.name},
|
||||
fields=["item_code", "qty"],
|
||||
)
|
||||
self.assertEqual(
|
||||
material_request_items,
|
||||
[{"item_code": requested_item.item_code, "qty": requested_item.quantity}],
|
||||
)
|
||||
|
||||
def _plan_for_safety_stock(self, rm_item, qty_per_order, bom_quantity=1):
|
||||
fg_item = make_item(properties={"is_stock_item": 1}).name
|
||||
make_bom(
|
||||
|
||||
Reference in New Issue
Block a user