refactor(test): repost utility deletion flag test
This commit is contained in:
parent
d34787cf6d
commit
cc15f695b4
@ -177,26 +177,6 @@ class TestRepostAccountingLedger(AccountsTestMixin, FrappeTestCase):
|
|||||||
pe = get_payment_entry(si.doctype, si.name)
|
pe = get_payment_entry(si.doctype, si.name)
|
||||||
pe.save().submit()
|
pe.save().submit()
|
||||||
|
|
||||||
# without deletion flag set
|
|
||||||
ral = frappe.new_doc("Repost Accounting Ledger")
|
|
||||||
ral.company = self.company
|
|
||||||
ral.delete_cancelled_entries = False
|
|
||||||
ral.append("vouchers", {"voucher_type": si.doctype, "voucher_no": si.name})
|
|
||||||
ral.append("vouchers", {"voucher_type": pe.doctype, "voucher_no": pe.name})
|
|
||||||
ral.save()
|
|
||||||
|
|
||||||
# assert preview data is generated
|
|
||||||
preview = ral.generate_preview()
|
|
||||||
self.assertIsNotNone(preview)
|
|
||||||
|
|
||||||
ral.save().submit()
|
|
||||||
|
|
||||||
# background jobs don't run on test cases. Manually triggering repost function.
|
|
||||||
start_repost(ral.name)
|
|
||||||
|
|
||||||
self.assertIsNotNone(frappe.db.exists("GL Entry", {"voucher_no": si.name, "is_cancelled": 1}))
|
|
||||||
self.assertIsNotNone(frappe.db.exists("GL Entry", {"voucher_no": pe.name, "is_cancelled": 1}))
|
|
||||||
|
|
||||||
# with deletion flag set
|
# with deletion flag set
|
||||||
ral = frappe.new_doc("Repost Accounting Ledger")
|
ral = frappe.new_doc("Repost Accounting Ledger")
|
||||||
ral.company = self.company
|
ral.company = self.company
|
||||||
@ -208,3 +188,29 @@ class TestRepostAccountingLedger(AccountsTestMixin, FrappeTestCase):
|
|||||||
start_repost(ral.name)
|
start_repost(ral.name)
|
||||||
self.assertIsNone(frappe.db.exists("GL Entry", {"voucher_no": si.name, "is_cancelled": 1}))
|
self.assertIsNone(frappe.db.exists("GL Entry", {"voucher_no": si.name, "is_cancelled": 1}))
|
||||||
self.assertIsNone(frappe.db.exists("GL Entry", {"voucher_no": pe.name, "is_cancelled": 1}))
|
self.assertIsNone(frappe.db.exists("GL Entry", {"voucher_no": pe.name, "is_cancelled": 1}))
|
||||||
|
|
||||||
|
def test_05_without_deletion_flag(self):
|
||||||
|
si = create_sales_invoice(
|
||||||
|
item=self.item,
|
||||||
|
company=self.company,
|
||||||
|
customer=self.customer,
|
||||||
|
debit_to=self.debit_to,
|
||||||
|
parent_cost_center=self.cost_center,
|
||||||
|
cost_center=self.cost_center,
|
||||||
|
rate=100,
|
||||||
|
)
|
||||||
|
|
||||||
|
pe = get_payment_entry(si.doctype, si.name)
|
||||||
|
pe.save().submit()
|
||||||
|
|
||||||
|
# without deletion flag set
|
||||||
|
ral = frappe.new_doc("Repost Accounting Ledger")
|
||||||
|
ral.company = self.company
|
||||||
|
ral.delete_cancelled_entries = False
|
||||||
|
ral.append("vouchers", {"voucher_type": si.doctype, "voucher_no": si.name})
|
||||||
|
ral.append("vouchers", {"voucher_type": pe.doctype, "voucher_no": pe.name})
|
||||||
|
ral.save().submit()
|
||||||
|
|
||||||
|
start_repost(ral.name)
|
||||||
|
self.assertIsNotNone(frappe.db.exists("GL Entry", {"voucher_no": si.name, "is_cancelled": 1}))
|
||||||
|
self.assertIsNotNone(frappe.db.exists("GL Entry", {"voucher_no": pe.name, "is_cancelled": 1}))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user