From bca52c20852a68600a99c0d904cb7c51df660457 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 22 Feb 2024 09:22:05 +0530 Subject: [PATCH 1/2] fix: remove microsecond from posting datetime (#40017) --- erpnext/patches.txt | 4 ++-- ...te_posting_datetime_and_dropped_indexes.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v14_0/update_posting_datetime_and_dropped_indexes.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 430ebaf749f..4351d5736ff 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -279,8 +279,8 @@ execute:frappe.rename_doc("Report", "Fichier des Ecritures Comptables [FEC]", "F [post_model_sync] execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings') -erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents #2022-08-19 -erpnext.patches.v14_0.delete_einvoicing_doctypes +erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes #22-02-2024 +erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents erpnext.patches.v14_0.delete_shopify_doctypes erpnext.patches.v14_0.delete_datev_doctypes erpnext.patches.v14_0.rearrange_company_fields diff --git a/erpnext/patches/v14_0/update_posting_datetime_and_dropped_indexes.py b/erpnext/patches/v14_0/update_posting_datetime_and_dropped_indexes.py new file mode 100644 index 00000000000..ca126a40a40 --- /dev/null +++ b/erpnext/patches/v14_0/update_posting_datetime_and_dropped_indexes.py @@ -0,0 +1,19 @@ +import frappe + + +def execute(): + frappe.db.sql( + """ + UPDATE `tabStock Ledger Entry` + SET posting_datetime = DATE_FORMAT(timestamp(posting_date, posting_time), '%Y-%m-%d %H:%i:%s') + """ + ) + + drop_indexes() + + +def drop_indexes(): + if not frappe.db.has_index("tabStock Ledger Entry", "posting_sort_index"): + return + + frappe.db.sql_ddl("ALTER TABLE `tabStock Ledger Entry` DROP INDEX `posting_sort_index`") -- GitLab From 43f5cf95a34f1b16838242f9975d50bfa168ab2e Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Thu, 22 Feb 2024 06:52:10 +0000 Subject: [PATCH 2/2] fix: merge conflict --- erpnext/patches.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 4351d5736ff..556e83d0773 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -280,7 +280,8 @@ execute:frappe.rename_doc("Report", "Fichier des Ecritures Comptables [FEC]", "F [post_model_sync] execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings') erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes #22-02-2024 -erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents +erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents #2022-08-19 +erpnext.patches.v14_0.delete_einvoicing_doctypes erpnext.patches.v14_0.delete_shopify_doctypes erpnext.patches.v14_0.delete_datev_doctypes erpnext.patches.v14_0.rearrange_company_fields -- GitLab