From cf6d4546063f66a36dede61941800c18e19fbed2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 19:26:29 +0530 Subject: [PATCH] fix: use hash based naming for tax withheld vouchers child table (backport #33643) (#33748) fix: use hash based naming for tax withheld vouchers child table (#33643) (cherry picked from commit 17045f88a196336544632d50e4180b9ab7ab7c5f) Co-authored-by: Ritwik Puri --- .../tax_withheld_vouchers/tax_withheld_vouchers.json | 6 +++--- erpnext/patches.txt | 1 + .../change_autoname_for_tax_withheld_vouchers.py | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 erpnext/patches/v14_0/change_autoname_for_tax_withheld_vouchers.py diff --git a/erpnext/accounts/doctype/tax_withheld_vouchers/tax_withheld_vouchers.json b/erpnext/accounts/doctype/tax_withheld_vouchers/tax_withheld_vouchers.json index ce8c0c370865..46b430c6594b 100644 --- a/erpnext/accounts/doctype/tax_withheld_vouchers/tax_withheld_vouchers.json +++ b/erpnext/accounts/doctype/tax_withheld_vouchers/tax_withheld_vouchers.json @@ -1,6 +1,6 @@ { "actions": [], - "autoname": "autoincrement", + "autoname": "hash", "creation": "2022-09-13 16:18:59.404842", "doctype": "DocType", "editable_grid": 1, @@ -36,11 +36,11 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2022-09-13 23:40:41.479208", + "modified": "2023-01-13 13:40:41.479208", "modified_by": "Administrator", "module": "Accounts", "name": "Tax Withheld Vouchers", - "naming_rule": "Autoincrement", + "naming_rule": "Random", "owner": "Administrator", "permissions": [], "sort_field": "modified", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7b06aa00cfaa..a6c822a1a14d 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -324,3 +324,4 @@ erpnext.patches.v14_0.create_incoterms_and_migrate_shipment erpnext.patches.v14_0.setup_clear_repost_logs erpnext.patches.v14_0.create_accounting_dimensions_for_payment_request erpnext.patches.v14_0.update_entry_type_for_journal_entry +erpnext.patches.v14_0.change_autoname_for_tax_withheld_vouchers diff --git a/erpnext/patches/v14_0/change_autoname_for_tax_withheld_vouchers.py b/erpnext/patches/v14_0/change_autoname_for_tax_withheld_vouchers.py new file mode 100644 index 000000000000..e20ba73dbbfb --- /dev/null +++ b/erpnext/patches/v14_0/change_autoname_for_tax_withheld_vouchers.py @@ -0,0 +1,12 @@ +import frappe + + +def execute(): + if ( + frappe.db.sql( + """select data_type FROM information_schema.columns + where column_name = 'name' and table_name = 'tabTax Withheld Vouchers'""" + )[0][0] + == "bigint" + ): + frappe.db.change_column_type("Tax Withheld Vouchers", "name", "varchar(140)")