feat: default Location tree and Asset Categories
Location fixture: "All Locations" group with Head Office, Branch Office and Warehouse. Fixture import re-inserts tree nodes with fresh lft/rgt, which strands locations users add beneath them, so after_migrate rebuilds the Location tree. Asset Category fixture: Land (non-depreciable), Buildings (20 years), Plant and Machinery, Vehicles, Furniture and Fixtures, Office Equipment, Computers and Electronics, Software (5 years) and Intangible Assets (10 years), per Royal Decree 145 rates; monthly straight-line, daily pro-rata. The accounts table is company-specific and therefore not shipped: an Asset Category before_import hook links every Thai company (same contract as the WHT categories), reusing the Standard chart's fixed asset accounts and creating Land, Vehicles and Intangible Assets under Fixed Assets. Company.on_update links new companies. Depreciation accounts are left to the Company defaults. get_or_create_account now takes account_type and parent_groups.
This commit is contained in:
@@ -105,6 +105,30 @@ fixtures = [
|
||||
],
|
||||
},
|
||||
{"doctype": "Tax Withholding Category", "filters": [["name", "like", "WHT %"]]},
|
||||
{
|
||||
"doctype": "Location",
|
||||
"filters": [["name", "in", ["All Locations", "Head Office", "Branch Office", "Warehouse"]]],
|
||||
},
|
||||
{
|
||||
"doctype": "Asset Category",
|
||||
"filters": [
|
||||
[
|
||||
"name",
|
||||
"in",
|
||||
[
|
||||
"Land",
|
||||
"Buildings",
|
||||
"Plant and Machinery",
|
||||
"Vehicles",
|
||||
"Furniture and Fixtures",
|
||||
"Office Equipment",
|
||||
"Computers and Electronics",
|
||||
"Software",
|
||||
"Intangible Assets",
|
||||
],
|
||||
]
|
||||
],
|
||||
},
|
||||
# HRMS doctypes; skipped by sync_fixtures on sites without hrms
|
||||
{"doctype": "Employee Tax Exemption Category"},
|
||||
{"doctype": "Employee Tax Exemption Sub Category"},
|
||||
@@ -117,6 +141,8 @@ fixtures = [
|
||||
# before_install = "default_thai_company.install.before_install"
|
||||
# Fixtures are synced before this runs; VAT schemes for companies that already exist.
|
||||
after_install = "default_thai_company.vat.setup_companies"
|
||||
# Fixture import re-inserts the Location tree; restore lft/rgt for user-added nodes.
|
||||
after_migrate = "default_thai_company.assets.rebuild_locations"
|
||||
|
||||
# Uninstallation
|
||||
# ------------
|
||||
@@ -179,10 +205,14 @@ doc_events = {
|
||||
"Tax Withholding Category": {
|
||||
"before_import": "default_thai_company.tax_withholding.prepare_fixture_accounts",
|
||||
},
|
||||
"Asset Category": {
|
||||
"before_import": "default_thai_company.assets.prepare_fixture_accounts",
|
||||
},
|
||||
"Company": {
|
||||
"on_update": [
|
||||
"default_thai_company.tax_withholding.setup_company",
|
||||
"default_thai_company.vat.setup_company",
|
||||
"default_thai_company.assets.setup_company",
|
||||
],
|
||||
},
|
||||
"Payment Entry": {
|
||||
|
||||
Reference in New Issue
Block a user