From 1772ccc61a8c71fca3625fe52f5520c61b8ca5c3 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sun, 21 Jun 2026 11:00:50 +0530 Subject: [PATCH] test(stock): order get_sle by posting_datetime, not MySQL timestamp() test_stock_entry.get_sle ordered by `timestamp(posting_date, posting_time)`, a MySQL-only two-arg function that errors on Postgres ("function timestamp(date, time) does not exist"), so every test using get_sle (test_fifo, test_stock_entry_qty, ...) failed to run on Postgres. Order by the precomputed `posting_datetime` column instead (identical value on MariaDB, valid on both engines). Co-Authored-By: Claude Opus 4.8 (1M context) --- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 545e6744b35..5dcad431d21 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -47,8 +47,9 @@ def get_sle(**args): values.append(value) return frappe.db.sql( + # posting_datetime is the precomputed date+time column; MySQL-only timestamp(date,time) errors on Postgres """select * from `tabStock Ledger Entry` %s - order by timestamp(posting_date, posting_time) desc, creation desc limit 1""" + order by posting_datetime desc, creation desc limit 1""" % condition, values, as_dict=1,