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)