Revert "test: fix POS Closing Entry Test"

This reverts commit 8f1a3aef2e.
This commit is contained in:
marination 2021-08-11 17:00:46 +05:30
parent 867939fcae
commit 455d300fca
2 changed files with 6 additions and 40 deletions

View File

@ -19,7 +19,6 @@ class TestPOSClosingEntry(unittest.TestCase):
def tearDown(self):
frappe.set_user("Administrator")
frappe.db.sql("delete from `tabPOS Profile`")
frappe.db.rollback()
def test_pos_closing_entry(self):
test_user, pos_profile = init_user_and_profile()
@ -51,8 +50,7 @@ class TestPOSClosingEntry(unittest.TestCase):
self.assertEqual(pcv_doc.total_quantity, 2)
self.assertEqual(pcv_doc.net_total, 6700)
def test_cancelling_of_consolidated_sales_invoice(self):
"Check if cancelling consolidated Sales Invoice with submitted POS Closing Entry is blocked."
def test_cancelling_of_pos_closing_entry(self):
test_user, pos_profile = init_user_and_profile()
opening_entry = create_opening_entry(pos_profile, test_user.name)
@ -85,45 +83,13 @@ class TestPOSClosingEntry(unittest.TestCase):
si_doc = frappe.get_doc("Sales Invoice", pos_inv1.consolidated_invoice)
self.assertRaises(frappe.ValidationError, si_doc.cancel)
def test_cancelling_of_pos_closing_entry(self):
"Check impact of cancelling POS Closing Entry."
test_user, pos_profile = init_user_and_profile()
opening_entry = create_opening_entry(pos_profile, test_user.name)
pos_inv1 = create_pos_invoice(rate=3500, do_not_submit=1)
pos_inv1.append('payments', {
'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': 3500
})
pos_inv1.submit()
pos_inv2 = create_pos_invoice(rate=3200, do_not_submit=1)
pos_inv2.append('payments', {
'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': 3200
})
pos_inv2.submit()
pcv_doc = make_closing_entry_from_opening(opening_entry)
for d in pcv_doc.payment_reconciliation:
if d.mode_of_payment == 'Cash':
d.closing_amount = 6700
pcv_doc.submit()
pos_inv1.load_from_db()
si_name = pos_inv1.consolidated_invoice
pcv_doc.load_from_db()
pcv_doc.cancel()
si_doc.load_from_db()
pos_inv1.load_from_db()
# After POS Closing Entry cancel, SI doc gets cancelled, unlinked and renamed
# There's no reference doc to fetch SI with new cancelled name
# which is why we are hardcoding suffix
si_docstatus = frappe.db.get_value("Sales Invoice", si_name+"-CANC-0", "docstatus")
self.assertEqual(si_docstatus, 2)
self.assertEqual(si_doc.docstatus, 2)
self.assertEqual(pos_inv1.status, 'Paid')
self.assertIsNone(pos_inv1.consolidated_invoice)
def init_user_and_profile(**args):
user = 'test@example.com'

View File

@ -51,7 +51,7 @@ class TestAssetMovement(unittest.TestCase):
reference_doctype = 'Purchase Receipt', reference_name = pr.name)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
movement2 = create_asset_movement(purpose = 'Transfer', company = asset.company,
create_asset_movement(purpose = 'Transfer', company = asset.company,
assets = [{ 'asset': asset.name , 'source_location': 'Test Location 2', 'target_location': 'Test Location'}],
reference_doctype = 'Purchase Receipt', reference_name = pr.name)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
@ -60,7 +60,7 @@ class TestAssetMovement(unittest.TestCase):
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
employee = make_employee("testassetmovemp@example.com", company="_Test Company")
movement3 = create_asset_movement(purpose = 'Issue', company = asset.company,
create_asset_movement(purpose = 'Issue', company = asset.company,
assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'to_employee': employee}],
reference_doctype = 'Purchase Receipt', reference_name = pr.name)