feat: Bank Fee expense account for every Thai company

Thai banks charge transfer and collection fees that customers net off
their payments and that the bank nets off ours; Payment Entry books
them as deductions, which need an expense account. The Standard chart
has none, so every Thai company gets "Bank Fee" under Indirect Expenses
(Company.on_update, after_install and a patch for existing sites).
This commit is contained in:
kurogeek committed 2026-11-05 04:29:04 +00:00
1 parent 6dd557ee97
commit b4c7274dce
5 files changed
+34

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
from default_thai_company.tax_withholding import company_ready, get_or_create_account, thai_companies
# Thai banks charge transfer and collection fees that customers net off their
# payments and that the bank nets off ours; Payment Entry books them as
# deductions, which need an expense account. The Standard chart has none, so
# every Thai company gets one under Indirect Expenses.
BANK_FEE_ACCOUNT = "Bank Fee"
BANK_FEE_ACCOUNT_GROUPS = ("Indirect Expenses", "Expenses")
def ensure_bank_fee_account(company):
return get_or_create_account(company, BANK_FEE_ACCOUNT, "Expense", "", BANK_FEE_ACCOUNT_GROUPS)
def setup_company(doc, method=None):
"""Company.on_update: Bank Fee account for a Thai company."""
if company_ready(doc):
ensure_bank_fee_account(doc.name)
def setup_companies():
"""after_install and the create_bank_fee_accounts patch: companies that
exist before this code did never pass through `setup_company`."""
for company in thai_companies():
ensure_bank_fee_account(company)
+2
View File
@@ -157,6 +157,7 @@ after_install = [
"default_thai_company.vat.setup_companies", "default_thai_company.vat.setup_companies",
"default_thai_company.shipping.setup_companies", "default_thai_company.shipping.setup_companies",
"default_thai_company.payroll.setup_companies", "default_thai_company.payroll.setup_companies",
"default_thai_company.banking.setup_companies",
] ]
# Fixture import re-inserts the Location tree; restore lft/rgt for user-added nodes. # Fixture import re-inserts the Location tree; restore lft/rgt for user-added nodes.
after_migrate = "default_thai_company.assets.rebuild_locations" after_migrate = "default_thai_company.assets.rebuild_locations"
@@ -234,6 +235,7 @@ doc_events = {
"default_thai_company.assets.setup_company", "default_thai_company.assets.setup_company",
"default_thai_company.shipping.setup_company", "default_thai_company.shipping.setup_company",
"default_thai_company.payroll.setup_company", "default_thai_company.payroll.setup_company",
"default_thai_company.banking.setup_company",
], ],
}, },
# HRMS doctype; the hook only fires on sites that have it. # HRMS doctype; the hook only fires on sites that have it.
+1
View File
@@ -9,3 +9,4 @@ default_thai_company.patches.create_vat_templates
default_thai_company.patches.create_shipping_rules default_thai_company.patches.create_shipping_rules
default_thai_company.patches.create_payroll_periods default_thai_company.patches.create_payroll_periods
default_thai_company.patches.setup_salary_components default_thai_company.patches.setup_salary_components
default_thai_company.patches.create_bank_fee_accounts
@@ -0,0 +1,5 @@
from default_thai_company.banking import setup_companies
def execute():
setup_companies()
+1
View File
@@ -79,6 +79,7 @@ Salary Deductions,รายการหักจากเงินเดือ
Social Security,ประกันสังคม Social Security,ประกันสังคม
Social Security Payable,ประกันสังคมค้างจ่าย Social Security Payable,ประกันสังคมค้างจ่าย
Social Security Fund contribution (Sec. 33 employee),เงินสมทบกองทุนประกันสังคม (ผู้ประกันตนมาตรา 33) Social Security Fund contribution (Sec. 33 employee),เงินสมทบกองทุนประกันสังคม (ผู้ประกันตนมาตรา 33)
Bank Fee,ค่าธรรมเนียมธนาคาร
Withholding Tax Receivable,ภาษีถูกหัก ณ ที่จ่าย Withholding Tax Receivable,ภาษีถูกหัก ณ ที่จ่าย
Output VAT,ภาษีขาย Output VAT,ภาษีขาย
Input VAT,ภาษีซื้อ Input VAT,ภาษีซื้อ
1 Net Payable After Withholding Tax ยอดชำระสุทธิหลังหักภาษี ณ ที่จ่าย
79 Social Security ประกันสังคม
80 Social Security Payable ประกันสังคมค้างจ่าย
81 Social Security Fund contribution (Sec. 33 employee) เงินสมทบกองทุนประกันสังคม (ผู้ประกันตนมาตรา 33)
82 Bank Fee ค่าธรรมเนียมธนาคาร
83 Withholding Tax Receivable ภาษีถูกหัก ณ ที่จ่าย
84 Output VAT ภาษีขาย
85 Input VAT ภาษีซื้อ