mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 13:38:27 +00:00
fix(stock): inward stock for pick list test record
(cherry picked from commit f22b9e297b)
# Conflicts:
# erpnext/stock/doctype/material_request/test_material_request.py
This commit is contained in:
@@ -902,15 +902,27 @@ class TestMaterialRequest(FrappeTestCase):
|
||||
import json
|
||||
|
||||
from erpnext.stock.doctype.pick_list.pick_list import create_stock_entry
|
||||
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
||||
|
||||
mr = make_material_request(material_request_type="Material Transfer")
|
||||
new_item = create_item("_Test Pick List Item", is_stock_item=1)
|
||||
item_code = new_item.name
|
||||
|
||||
make_stock_entry(
|
||||
item_code=item_code,
|
||||
target="_Test Warehouse - _TC",
|
||||
qty=10,
|
||||
do_not_save=False,
|
||||
do_not_submit=False,
|
||||
)
|
||||
|
||||
mr = make_material_request(item_code=item_code, material_request_type="Material Transfer")
|
||||
pl = create_pick_list(mr.name)
|
||||
pl.save()
|
||||
pl.locations[0].qty = 5
|
||||
pl.locations[0].stock_qty = 5
|
||||
pl.submit()
|
||||
|
||||
to_warehouse = create_warehouse("Test To Warehouse")
|
||||
to_warehouse = create_warehouse("_Test Warehouse - _TC")
|
||||
|
||||
se_data = create_stock_entry(json.dumps(pl.as_dict()))
|
||||
se = frappe.get_doc(se_data)
|
||||
@@ -927,6 +939,37 @@ class TestMaterialRequest(FrappeTestCase):
|
||||
pl_for_pending = create_pick_list(mr.name)
|
||||
self.assertEqual(pl_for_pending.locations[0].qty, 5)
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
def test_mr_pick_list_qty_validation(self):
|
||||
"""Test for checking pick list qty validation from Material Request"""
|
||||
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
||||
|
||||
make_stock_entry(
|
||||
item_code="_Test Item",
|
||||
target="_Test Warehouse - _TC",
|
||||
qty=10,
|
||||
do_not_save=False,
|
||||
do_not_submit=False,
|
||||
)
|
||||
|
||||
mr = make_material_request(material_request_type="Material Transfer")
|
||||
pl = create_pick_list(mr.name)
|
||||
pl.locations[0].qty = 9
|
||||
pl.locations[0].stock_qty = 9
|
||||
pl.submit()
|
||||
|
||||
mr.reload()
|
||||
self.assertEqual(mr.items[0].picked_qty, 9)
|
||||
|
||||
pl = create_pick_list(mr.name)
|
||||
self.assertEqual(pl.locations[0].qty, 1)
|
||||
|
||||
pl.locations[0].qty = 2
|
||||
pl.locations[0].stock_qty = 2
|
||||
self.assertRaises(frappe.ValidationError, pl.submit)
|
||||
|
||||
>>>>>>> f22b9e297b (fix(stock): inward stock for pick list test record)
|
||||
def test_mr_status_with_partial_and_excess_end_transit(self):
|
||||
material_request = make_material_request(
|
||||
material_request_type="Material Transfer",
|
||||
|
||||
Reference in New Issue
Block a user