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 <noreply@anthropic.com>
This commit is contained in:
parent
9c4e075527
commit
6f0758d90b
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue