This commit is contained in:
gsinghpal
2026-04-03 15:45:18 -04:00
parent 4cd7357aa0
commit c66bdf5089
71 changed files with 6721 additions and 118 deletions

17
fix_no_tax.sql Normal file
View File

@@ -0,0 +1,17 @@
BEGIN;
-- Fix ALL model lines that have NO explicit tax set.
-- These inherit the account's default tax (HST PURCHASE) which is WRONG
-- for bank fees, foreign vendors, insurance, interest, etc.
-- Set them all to NO TAX PURCHASE (ID 32) explicitly.
INSERT INTO account_reconcile_model_line_account_tax_rel (account_reconcile_model_line_id, account_tax_id)
SELECT rml.id, 32
FROM account_reconcile_model rm
JOIN account_reconcile_model_line rml ON rml.model_id = rm.id
LEFT JOIN account_reconcile_model_line_account_tax_rel tr ON tr.account_reconcile_model_line_id = rml.id
WHERE rm.active = true AND rm.company_id = 1
AND tr.account_tax_id IS NULL
ON CONFLICT DO NOTHING;
COMMIT;