chore: remove microsecond from posting_datetime
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 99c050a..9d1a3f7 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -1611,24 +1611,22 @@
item_code = "Test Negative Item - 001"
item_doc = create_item(item_code=item_code, is_stock_item=1, valuation_rate=10)
- make_stock_entry(
+ se1 = make_stock_entry(
item_code=item_code,
posting_date=add_days(today(), -3),
posting_time="00:00:00",
- purpose="Material Receipt",
+ target="_Test Warehouse - _TC",
qty=10,
to_warehouse="_Test Warehouse - _TC",
- do_not_save=True,
)
- make_stock_entry(
+ se2 = make_stock_entry(
item_code=item_code,
posting_date=today(),
posting_time="00:00:00",
- purpose="Material Receipt",
+ source="_Test Warehouse - _TC",
qty=8,
from_warehouse="_Test Warehouse - _TC",
- do_not_save=True,
)
sr_doc = create_stock_reconciliation(
diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
index 26c5c64..40a2d5a 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
@@ -1227,7 +1227,7 @@
filters={"voucher_no": reciept1.name},
fields=["qty_after_transaction", "actual_qty"],
)
- self.assertEqual(sle[0].qty_after_transaction, 105)
+ self.assertEqual(sle[0].qty_after_transaction, 5)
self.assertEqual(sle[0].actual_qty, 5)
sle = frappe.get_all(
@@ -1235,7 +1235,7 @@
filters={"voucher_no": reciept2.name},
fields=["qty_after_transaction", "actual_qty"],
)
- self.assertEqual(sle[0].qty_after_transaction, 100)
+ self.assertEqual(sle[0].qty_after_transaction, 105)
self.assertEqual(sle[0].actual_qty, 100)
@change_settings("System Settings", {"float_precision": 3, "currency_precision": 2})
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index e8bd3fc..2ae6c19 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -11,7 +11,6 @@
from frappe.model.meta import get_field_precision
from frappe.query_builder.functions import Sum
from frappe.utils import (
- add_to_date,
cint,
cstr,
flt,
@@ -637,7 +636,7 @@
posting_datetime = %(posting_datetime)s
)
order by
- posting_datetime ASC, creation ASC
+ creation ASC
for update
""",
self.args,
@@ -1403,17 +1402,12 @@
def get_previous_sle_of_current_voucher(args, operator="<", exclude_current_voucher=False):
"""get stock ledger entries filtered by specific posting datetime conditions"""
- args["time_format"] = "%H:%i:%s"
if not args.get("posting_date"):
args["posting_datetime"] = "1900-01-01 00:00:00"
if not args.get("posting_datetime"):
args["posting_datetime"] = get_combine_datetime(args["posting_date"], args["posting_time"])
- if operator == "<=":
- # Add 1 second to handle millisecond for less than and equal to condition
- args["posting_datetime"] = add_to_date(args["posting_datetime"], seconds=1)
-
voucher_condition = ""
if exclude_current_voucher:
voucher_no = args.get("voucher_no")
@@ -1701,7 +1695,6 @@
datetime_limit_condition = ""
qty_shift = args.actual_qty
- args["time_format"] = "%H:%i:%s"
args["posting_datetime"] = get_combine_datetime(args["posting_date"], args["posting_time"])
# find difference/shift in qty caused by stock reconciliation
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 5dc9dd4..93e2fa4 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -671,4 +671,4 @@
if isinstance(posting_time, datetime.timedelta):
posting_time = (datetime.datetime.min + posting_time).time()
- return datetime.datetime.combine(posting_date, posting_time)
+ return datetime.datetime.combine(posting_date, posting_time).replace(microsecond=0)
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
index 5523c31..0450038 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
@@ -643,10 +643,6 @@
)
scr = make_subcontracting_receipt(sco.name)
scr.save()
- for row in scr.supplied_items:
- self.assertNotEqual(row.rate, 300.00)
- self.assertFalse(row.serial_and_batch_bundle)
-
scr.submit()
scr.reload()