fix: remove v16-incompatible supplier tax field set_value

ERPNext v16 dropped the per-supplier default_purchase_taxes_and_charges
_template column. URD tax bypass is now entirely handled by the server
script (Before Save on Purchase Invoice) via the is_urd_purchase flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
SUBHANKAR DHAR 2026-06-12 16:12:27 +05:30
parent 356fec8c38
commit 1f5bb6d942

View file

@ -457,23 +457,13 @@ def create_suppliers():
frappe.db.commit()
# Set URD tax default — look up by title+company (name includes abbr)
urd_template = "No GST - URD Purchase"
urd_full = exists_filter("Purchase Taxes and Charges Template",
{"title": urd_template, "company": COMPANY})
if urd_full:
urd_suppliers = frappe.db.sql(
"""SELECT name FROM `tabSupplier`
WHERE supplier_group = 'Local Market Vendor (Unregistered)'""",
as_dict=1
)
for s in urd_suppliers:
frappe.db.set_value(
"Supplier", s.name,
"default_purchase_taxes_and_charges_template", urd_full
)
frappe.db.commit()
ok(f"Set '{urd_full}' as default tax on {len(urd_suppliers)} URD supplier(s)")
# ERPNext v16 removed the per-supplier default tax template field.
# URD tax bypass is handled instead by the server script:
# "Furnitex - Clear GST on URD Purchase" (Before Save on Purchase Invoice)
# Tick the "URD Purchase (No GST)" checkbox on any invoice to auto-clear taxes.
urd_suppliers_count = frappe.db.count("Supplier",
{"supplier_group": "Local Market Vendor (Unregistered)"})
ok(f"URD tax via server script — {urd_suppliers_count} URD suppliers registered")
# ─────────────────────────────────────────────────────────────