Skip to content

Commit

Permalink
fix: force to do reposting for cancelled document
Browse files Browse the repository at this point in the history
(cherry picked from commit 6e661e7)

# Conflicts:
#	erpnext/controllers/stock_controller.py
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed May 29, 2023
1 parent 139a193 commit 0228933
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions erpnext/controllers/stock_controller.py
Expand Up @@ -689,7 +689,14 @@ def repost_future_sle_and_gle(self):
}
)

<<<<<<< HEAD
if future_sle_exists(args) or repost_required_for_queue(self):
=======
if self.docstatus == 2:
force = True

if force or future_sle_exists(args) or repost_required_for_queue(self):
>>>>>>> 6e661e7c0e (fix: force to do reposting for cancelled document)
item_based_reposting = cint(
frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting")
)
Expand Down
Expand Up @@ -294,3 +294,19 @@ def test_account_freeze_validation(self):
self.assertRaises(frappe.ValidationError, riv.save)
accounts_settings.acc_frozen_upto = ""
accounts_settings.save()

def test_create_repost_entry_for_cancelled_document(self):
pr = make_purchase_receipt(
company="_Test Company with perpetual inventory",
warehouse="Stores - TCP1",
get_multiple_items=True,
)

self.assertTrue(pr.docstatus == 1)
self.assertFalse(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name}))

pr.load_from_db()

pr.cancel()
self.assertTrue(pr.docstatus == 2)
self.assertTrue(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name}))

0 comments on commit 0228933

Please sign in to comment.