mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
fix in material request test case
This commit is contained in:
@@ -17,6 +17,43 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200",
|
self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200",
|
||||||
"warehouse": "_Test Warehouse"}, "indented_qty")), qty2)
|
"warehouse": "_Test Warehouse"}, "indented_qty")), qty2)
|
||||||
|
|
||||||
|
def _insert_stock_entry(self, qty1, qty2):
|
||||||
|
se = webnotes.bean([
|
||||||
|
{
|
||||||
|
"company": "_Test Company",
|
||||||
|
"doctype": "Stock Entry",
|
||||||
|
"posting_date": "2013-03-01",
|
||||||
|
"posting_time": "00:00:00",
|
||||||
|
"purpose": "Material Receipt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conversion_factor": 1.0,
|
||||||
|
"doctype": "Stock Entry Detail",
|
||||||
|
"item_code": "_Test Item Home Desktop 100",
|
||||||
|
"parentfield": "mtn_details",
|
||||||
|
"incoming_rate": 100,
|
||||||
|
"qty": qty1,
|
||||||
|
"stock_uom": "_Test UOM",
|
||||||
|
"transfer_qty": qty1,
|
||||||
|
"uom": "_Test UOM",
|
||||||
|
"t_warehouse": "_Test Warehouse 1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conversion_factor": 1.0,
|
||||||
|
"doctype": "Stock Entry Detail",
|
||||||
|
"item_code": "_Test Item Home Desktop 200",
|
||||||
|
"parentfield": "mtn_details",
|
||||||
|
"incoming_rate": 100,
|
||||||
|
"qty": qty2,
|
||||||
|
"stock_uom": "_Test UOM",
|
||||||
|
"transfer_qty": qty2,
|
||||||
|
"uom": "_Test UOM",
|
||||||
|
"t_warehouse": "_Test Warehouse 1",
|
||||||
|
},
|
||||||
|
])
|
||||||
|
se.insert()
|
||||||
|
se.submit()
|
||||||
|
|
||||||
def test_completed_qty_for_purchase(self):
|
def test_completed_qty_for_purchase(self):
|
||||||
webnotes.conn.sql("""delete from `tabBin`""")
|
webnotes.conn.sql("""delete from `tabBin`""")
|
||||||
|
|
||||||
@@ -70,6 +107,7 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_completed_qty_for_transfer(self):
|
def test_completed_qty_for_transfer(self):
|
||||||
webnotes.conn.sql("""delete from `tabBin`""")
|
webnotes.conn.sql("""delete from `tabBin`""")
|
||||||
|
webnotes.conn.sql("""delete from `tabStock Ledger Entry`""")
|
||||||
|
|
||||||
# submit material request of type Purchase
|
# submit material request of type Purchase
|
||||||
mr = webnotes.bean(copy=test_records[0])
|
mr = webnotes.bean(copy=test_records[0])
|
||||||
@@ -87,7 +125,7 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
|
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
|
||||||
se_doclist[0].fields.update({
|
se_doclist[0].fields.update({
|
||||||
"posting_date": "2013-03-01",
|
"posting_date": "2013-03-01",
|
||||||
"posting_time": "00:00"
|
"posting_time": "01:00"
|
||||||
})
|
})
|
||||||
se_doclist[1].fields.update({
|
se_doclist[1].fields.update({
|
||||||
"qty": 27.0,
|
"qty": 27.0,
|
||||||
@@ -102,6 +140,9 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
"incoming_rate": 1.0
|
"incoming_rate": 1.0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# make available the qty in _Test Warehouse 1 before transfer
|
||||||
|
self._insert_stock_entry(27.0, 1.5)
|
||||||
|
|
||||||
# check for stopped status of Material Request
|
# check for stopped status of Material Request
|
||||||
se = webnotes.bean(copy=se_doclist)
|
se = webnotes.bean(copy=se_doclist)
|
||||||
se.insert()
|
se.insert()
|
||||||
@@ -127,6 +168,7 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_completed_qty_for_over_transfer(self):
|
def test_completed_qty_for_over_transfer(self):
|
||||||
webnotes.conn.sql("""delete from `tabBin`""")
|
webnotes.conn.sql("""delete from `tabBin`""")
|
||||||
|
webnotes.conn.sql("""delete from `tabStock Ledger Entry`""")
|
||||||
|
|
||||||
# submit material request of type Purchase
|
# submit material request of type Purchase
|
||||||
mr = webnotes.bean(copy=test_records[0])
|
mr = webnotes.bean(copy=test_records[0])
|
||||||
@@ -159,6 +201,9 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
"incoming_rate": 1.0
|
"incoming_rate": 1.0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# make available the qty in _Test Warehouse 1 before transfer
|
||||||
|
self._insert_stock_entry(60.0, 3.0)
|
||||||
|
|
||||||
# check for stopped status of Material Request
|
# check for stopped status of Material Request
|
||||||
se = webnotes.bean(copy=se_doclist)
|
se = webnotes.bean(copy=se_doclist)
|
||||||
se.insert()
|
se.insert()
|
||||||
@@ -245,5 +290,5 @@ test_records = [
|
|||||||
"uom": "_Test UOM",
|
"uom": "_Test UOM",
|
||||||
"warehouse": "_Test Warehouse"
|
"warehouse": "_Test Warehouse"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user