From 6f0758d90bcbc24552fb4858525023dc9ea78e41 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Wed, 3 Jun 2026 14:30:48 +0000 Subject: [PATCH] refactor(patch): make Tax Articles grid-column injection additive Insert custom_tax_articles_display into saved layouts independently instead of replacing the legacy tax_article column (which is still used by other flows). Position it after item_tax_template; leave legacy untouched. Idempotent. Co-Authored-By: Claude Opus 4.8 --- jey_erp/patches/add_tax_articles_to_si_grid_views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jey_erp/patches/add_tax_articles_to_si_grid_views.py b/jey_erp/patches/add_tax_articles_to_si_grid_views.py index fdcaa9f..baa617d 100644 --- a/jey_erp/patches/add_tax_articles_to_si_grid_views.py +++ b/jey_erp/patches/add_tax_articles_to_si_grid_views.py @@ -12,9 +12,9 @@ def execute(): ignores the new in_list_view field, so the "Tax Articles" cell never appears for those users until they add it manually via the grid gear. - Replace the legacy `tax_article` entry (or, lacking it, insert after - `item_tax_template`) with `custom_tax_articles_display` in every saved layout that - doesn't already have it. Idempotent. + Add `custom_tax_articles_display` to every saved layout that doesn't already have + it, positioned near the tax fields. This is purely additive: the legacy + `tax_article` column (if present) is left untouched. Idempotent. """ rows = frappe.db.sql( "select user, data from `__UserSettings` where doctype = 'Sales Invoice'", @@ -36,10 +36,10 @@ def execute(): continue new_col = {"fieldname": "custom_tax_articles_display", "columns": 2} - if "tax_article" in names: - cols[names.index("tax_article")] = new_col - elif "item_tax_template" in names: + if "item_tax_template" in names: cols.insert(names.index("item_tax_template") + 1, new_col) + elif "tax_article" in names: + cols.insert(names.index("tax_article") + 1, new_col) else: cols.append(new_col)