Skip to content

Commit

Permalink
test: Check for FinishedGoodError if 0 FG in repack entry
Browse files Browse the repository at this point in the history
  • Loading branch information
marination committed Jan 13, 2022
1 parent 3922a39 commit c49dff3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions erpnext/stock/doctype/stock_entry/test_stock_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_material_transfer_gl_entry(self):
mtn.cancel()

def test_repack_multiple_fg(self):
"Test `is_finsihed_item` for one item repacked into two items."
"Test `is_finished_item` for one item repacked into two items."
make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC", qty=100, basic_rate=100)

repack = frappe.copy_doc(test_records[3])
Expand All @@ -237,7 +237,6 @@ def test_repack_multiple_fg(self):
repack.items[0].qty = 100.0
repack.items[0].transfer_qty = 100.0
repack.items[1].qty = 50.0
repack.items[1].basic_rate = 200

repack.append("items", {
"conversion_factor": 1.0,
Expand All @@ -259,6 +258,14 @@ def test_repack_multiple_fg(self):
self.assertEqual(repack.items[1].is_finished_item, 1)
self.assertEqual(repack.items[2].is_finished_item, 1)

repack.items[1].is_finished_item = 0
repack.items[2].is_finished_item = 0

# must raise error if 0 fg in repack entry
self.assertRaises(FinishedGoodError, repack.validate_finished_goods)

repack.delete() # teardown

def test_repack_no_change_in_valuation(self):
make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC", qty=50, basic_rate=100)
make_stock_entry(item_code="_Test Item Home Desktop 100", target="_Test Warehouse - _TC",
Expand Down

0 comments on commit c49dff3

Please sign in to comment.