Thai customers withhold tax at payment; ERPNext's customer-side handling
is Indian TCS which adds tax on top of the Sales Invoice. Override
SalesInvoice.set_tax_withholding to no-op for Thai companies, expose
"Apply Tax Withholding Amount" on Customer/Receive Payment Entries, and
on validate compute rate x pre-VAT amount of each allocated reference
(prorated, single threshold honoured) as a deduction to "Withholding Tax
Receivable". Client script fetches the Customer's category when the box
is ticked.
Add 22 Tax Withholding Category fixtures covering Thailand domestic
withholding (Taw.Paw. 4/2528, Sec. 50(2), Sec. 70) with rates and
thresholds. Fixtures ship without accounts; on import each Thai company
gets "Withholding Tax Payable" (Liability) and "Withholding Tax
Receivable" (Asset) created and the payable account linked. Company
on_update does the same for companies created later. Site-configured
accounts survive fixture re-import on migrate.