feat(nexa_coa_setup): module skeleton with hooks stub
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
26
nexa_coa_setup/README.md
Normal file
26
nexa_coa_setup/README.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Nexa Systems — Chart of Accounts Setup
|
||||||
|
|
||||||
|
Custom Odoo 19 module that configures the chart of accounts, taxes,
|
||||||
|
fiscal positions, analytic plans, and partner records for Nexa Systems Inc.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
docker exec odoo-nexa-app odoo -c /etc/odoo/odoo.conf -d nexamain \
|
||||||
|
-i nexa_coa_setup --no-http --stop-after-init
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update
|
||||||
|
|
||||||
|
```
|
||||||
|
docker exec odoo-nexa-app odoo -c /etc/odoo/odoo.conf -d nexamain \
|
||||||
|
-u nexa_coa_setup --no-http --stop-after-init
|
||||||
|
```
|
||||||
|
|
||||||
|
## Design reference
|
||||||
|
|
||||||
|
See `docs/superpowers/specs/2026-05-12-nexa-coa-design.md`.
|
||||||
|
|
||||||
|
## Safety
|
||||||
|
|
||||||
|
Always take a pg_dump BEFORE running `-i` or `-u`. See `docs/superpowers/plans/2026-05-12-nexa-coa-setup.md` Phase 0.
|
||||||
2
nexa_coa_setup/__init__.py
Normal file
2
nexa_coa_setup/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from . import models
|
||||||
|
from .hooks import post_init_hook
|
||||||
38
nexa_coa_setup/__manifest__.py
Normal file
38
nexa_coa_setup/__manifest__.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2026 Nexa Systems Inc.
|
||||||
|
# License OPL-1
|
||||||
|
{
|
||||||
|
"name": "Nexa Systems — Chart of Accounts Setup",
|
||||||
|
"version": "19.0.1.0.0",
|
||||||
|
"category": "Accounting/Localizations/Chart of Accounts",
|
||||||
|
"summary": "Custom CoA, taxes, fiscal positions, analytic plans, and intercompany partner setup for Nexa Systems Inc.",
|
||||||
|
"author": "Nexa Systems Inc.",
|
||||||
|
"website": "https://nexasystems.ca",
|
||||||
|
"license": "OPL-1",
|
||||||
|
"depends": [
|
||||||
|
"account",
|
||||||
|
"account_accountant",
|
||||||
|
"l10n_ca",
|
||||||
|
"analytic",
|
||||||
|
"sale_management",
|
||||||
|
"purchase",
|
||||||
|
"sale_subscription",
|
||||||
|
],
|
||||||
|
"data": [
|
||||||
|
"security/ir.model.access.csv",
|
||||||
|
"data/01_account_account.xml",
|
||||||
|
"data/02_account_journal.xml",
|
||||||
|
"data/03_account_tax.xml",
|
||||||
|
"data/04_account_fiscal_position.xml",
|
||||||
|
"data/05_account_analytic_plan.xml",
|
||||||
|
"data/06_account_analytic_account.xml",
|
||||||
|
"data/07_product_category.xml",
|
||||||
|
"data/08_res_partner_category.xml",
|
||||||
|
"data/09_res_partner.xml",
|
||||||
|
"data/10_account_reconcile_model.xml",
|
||||||
|
],
|
||||||
|
"post_init_hook": "post_init_hook",
|
||||||
|
"installable": True,
|
||||||
|
"application": False,
|
||||||
|
"auto_install": False,
|
||||||
|
}
|
||||||
5
nexa_coa_setup/data/01_account_account.xml
Normal file
5
nexa_coa_setup/data/01_account_account.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/02_account_journal.xml
Normal file
5
nexa_coa_setup/data/02_account_journal.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/03_account_tax.xml
Normal file
5
nexa_coa_setup/data/03_account_tax.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/04_account_fiscal_position.xml
Normal file
5
nexa_coa_setup/data/04_account_fiscal_position.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/05_account_analytic_plan.xml
Normal file
5
nexa_coa_setup/data/05_account_analytic_plan.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/06_account_analytic_account.xml
Normal file
5
nexa_coa_setup/data/06_account_analytic_account.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/07_product_category.xml
Normal file
5
nexa_coa_setup/data/07_product_category.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/08_res_partner_category.xml
Normal file
5
nexa_coa_setup/data/08_res_partner_category.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/09_res_partner.xml
Normal file
5
nexa_coa_setup/data/09_res_partner.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
nexa_coa_setup/data/10_account_reconcile_model.xml
Normal file
5
nexa_coa_setup/data/10_account_reconcile_model.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="0">
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
50
nexa_coa_setup/hooks.py
Normal file
50
nexa_coa_setup/hooks.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def post_init_hook(env):
|
||||||
|
"""Imperative one-shot operations after module data is loaded.
|
||||||
|
|
||||||
|
Each helper is idempotent — safe to re-run on -u.
|
||||||
|
"""
|
||||||
|
_logger.info("nexa_coa_setup: post_init_hook starting")
|
||||||
|
_normalize_company_hst_number(env)
|
||||||
|
_archive_unused_l10n_ca_accounts(env)
|
||||||
|
_rename_legacy_accounts(env)
|
||||||
|
_lock_fiscal_year_2025(env)
|
||||||
|
_logger.info("nexa_coa_setup: post_init_hook complete")
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_company_hst_number(env):
|
||||||
|
"""Convert '741224877' to '741224877 RT0001' if not already in full form."""
|
||||||
|
company = env.ref("base.main_company", raise_if_not_found=False)
|
||||||
|
if not company:
|
||||||
|
return
|
||||||
|
vat = (company.partner_id.vat or "").strip()
|
||||||
|
if vat == "741224877":
|
||||||
|
company.partner_id.vat = "741224877 RT0001"
|
||||||
|
_logger.info("nexa_coa_setup: normalized HST# to '741224877 RT0001'")
|
||||||
|
|
||||||
|
|
||||||
|
def _archive_unused_l10n_ca_accounts(env):
|
||||||
|
"""Stub — filled in Phase 4. Archives ~370 unused accounts."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _rename_legacy_accounts(env):
|
||||||
|
"""Stub — filled in Phase 4. Renames the 14xx/15xx legacy accounts."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _lock_fiscal_year_2025(env):
|
||||||
|
"""Set fiscalyear_lock_date = 2025-12-31 on main company."""
|
||||||
|
from datetime import date
|
||||||
|
company = env.ref("base.main_company", raise_if_not_found=False)
|
||||||
|
if not company:
|
||||||
|
return
|
||||||
|
target = date(2025, 12, 31)
|
||||||
|
if not company.fiscalyear_lock_date or company.fiscalyear_lock_date < target:
|
||||||
|
company.fiscalyear_lock_date = target
|
||||||
|
_logger.info("nexa_coa_setup: fiscalyear_lock_date set to 2025-12-31")
|
||||||
1
nexa_coa_setup/models/__init__.py
Normal file
1
nexa_coa_setup/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# no custom models — placeholder for future extensions
|
||||||
1
nexa_coa_setup/security/ir.model.access.csv
Normal file
1
nexa_coa_setup/security/ir.model.access.csv
Normal file
@@ -0,0 +1 @@
|
|||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
Reference in New Issue
Block a user