test: test cases to test clash timestamp entries
This commit is contained in:
parent
d80ca523a4
commit
f04676aaed
@ -263,6 +263,7 @@ execute:frappe.rename_doc("Report", "TDS Payable Monthly", "Tax Withholding Deta
|
|||||||
|
|
||||||
[post_model_sync]
|
[post_model_sync]
|
||||||
execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
|
execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
|
||||||
|
erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes
|
||||||
erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents
|
erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents
|
||||||
erpnext.patches.v14_0.delete_shopify_doctypes
|
erpnext.patches.v14_0.delete_shopify_doctypes
|
||||||
erpnext.patches.v14_0.delete_healthcare_doctypes
|
erpnext.patches.v14_0.delete_healthcare_doctypes
|
||||||
@ -357,4 +358,3 @@ erpnext.patches.v15_0.create_advance_payment_status
|
|||||||
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
|
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
|
||||||
erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20
|
erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20
|
||||||
erpnext.patches.v14_0.set_maintain_stock_for_bom_item
|
erpnext.patches.v14_0.set_maintain_stock_for_bom_item
|
||||||
erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes
|
|
||||||
@ -2,6 +2,7 @@
|
|||||||
# See license.txt
|
# See license.txt
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import time
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
@ -1154,6 +1155,89 @@ class TestStockLedgerEntry(FrappeTestCase, StockTestMixin):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Double processing of qty for clashing timestamp.")
|
self.fail("Double processing of qty for clashing timestamp.")
|
||||||
|
|
||||||
|
def test_previous_sle_with_clashed_timestamp(self):
|
||||||
|
|
||||||
|
item = make_item().name
|
||||||
|
warehouse = "_Test Warehouse - _TC"
|
||||||
|
|
||||||
|
reciept1 = make_stock_entry(
|
||||||
|
item_code=item,
|
||||||
|
to_warehouse=warehouse,
|
||||||
|
qty=100,
|
||||||
|
rate=10,
|
||||||
|
posting_date="2021-01-01",
|
||||||
|
posting_time="02:00:00",
|
||||||
|
)
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
reciept2 = make_stock_entry(
|
||||||
|
item_code=item,
|
||||||
|
to_warehouse=warehouse,
|
||||||
|
qty=5,
|
||||||
|
posting_date="2021-01-01",
|
||||||
|
rate=10,
|
||||||
|
posting_time="02:00:00.1234",
|
||||||
|
)
|
||||||
|
|
||||||
|
sle = frappe.get_all(
|
||||||
|
"Stock Ledger Entry",
|
||||||
|
filters={"voucher_no": reciept1.name},
|
||||||
|
fields=["qty_after_transaction", "actual_qty"],
|
||||||
|
)
|
||||||
|
self.assertEqual(sle[0].qty_after_transaction, 100)
|
||||||
|
self.assertEqual(sle[0].actual_qty, 100)
|
||||||
|
|
||||||
|
sle = frappe.get_all(
|
||||||
|
"Stock Ledger Entry",
|
||||||
|
filters={"voucher_no": reciept2.name},
|
||||||
|
fields=["qty_after_transaction", "actual_qty"],
|
||||||
|
)
|
||||||
|
self.assertEqual(sle[0].qty_after_transaction, 105)
|
||||||
|
self.assertEqual(sle[0].actual_qty, 5)
|
||||||
|
|
||||||
|
def test_backdated_sle_with_same_timestamp(self):
|
||||||
|
|
||||||
|
item = make_item().name
|
||||||
|
warehouse = "_Test Warehouse - _TC"
|
||||||
|
|
||||||
|
reciept1 = make_stock_entry(
|
||||||
|
item_code=item,
|
||||||
|
to_warehouse=warehouse,
|
||||||
|
qty=5,
|
||||||
|
posting_date="2021-01-01",
|
||||||
|
rate=10,
|
||||||
|
posting_time="02:00:00.1234",
|
||||||
|
)
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
# backdated entry with same timestamp but different ms part
|
||||||
|
reciept2 = make_stock_entry(
|
||||||
|
item_code=item,
|
||||||
|
to_warehouse=warehouse,
|
||||||
|
qty=100,
|
||||||
|
rate=10,
|
||||||
|
posting_date="2021-01-01",
|
||||||
|
posting_time="02:00:00",
|
||||||
|
)
|
||||||
|
|
||||||
|
sle = frappe.get_all(
|
||||||
|
"Stock Ledger Entry",
|
||||||
|
filters={"voucher_no": reciept1.name},
|
||||||
|
fields=["qty_after_transaction", "actual_qty"],
|
||||||
|
)
|
||||||
|
self.assertEqual(sle[0].qty_after_transaction, 105)
|
||||||
|
self.assertEqual(sle[0].actual_qty, 5)
|
||||||
|
|
||||||
|
sle = frappe.get_all(
|
||||||
|
"Stock Ledger Entry",
|
||||||
|
filters={"voucher_no": reciept2.name},
|
||||||
|
fields=["qty_after_transaction", "actual_qty"],
|
||||||
|
)
|
||||||
|
self.assertEqual(sle[0].qty_after_transaction, 100)
|
||||||
|
self.assertEqual(sle[0].actual_qty, 100)
|
||||||
|
|
||||||
@change_settings("System Settings", {"float_precision": 3, "currency_precision": 2})
|
@change_settings("System Settings", {"float_precision": 3, "currency_precision": 2})
|
||||||
def test_transfer_invariants(self):
|
def test_transfer_invariants(self):
|
||||||
"""Extact stock value should be transferred."""
|
"""Extact stock value should be transferred."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user