Align account_do with core localization structure
Add CreateChart defaults for the Dominican receivable and payable accounts, following the pattern used by official Tryton localization modules. Register the chart wizard extension, add core-style documentation files, and protect the structure with transactional and static tests.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
||||
|
||||
class CreateChart(metaclass=PoolMeta):
|
||||
__name__ = 'account.create_chart'
|
||||
|
||||
def default_properties(self, fields):
|
||||
pool = Pool()
|
||||
ModelData = pool.get('ir.model.data')
|
||||
defaults = super().default_properties(fields)
|
||||
template_id = ModelData.get_id('account_do.do_account_root')
|
||||
if self.account.account_template.id == template_id:
|
||||
defaults['account_receivable'] = self.get_account(
|
||||
'account_do.do_account_110201')
|
||||
defaults['account_payable'] = self.get_account(
|
||||
'account_do.do_account_210101')
|
||||
return defaults
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
project = 'Account DO'
|
||||
release = version = '8.0'
|
||||
author = 'Solutema'
|
||||
copyright = '2026, Solutema'
|
||||
default_role = 'ref'
|
||||
highlight_language = 'none'
|
||||
extensions = [
|
||||
'sphinx.ext.intersphinx',
|
||||
]
|
||||
intersphinx_mapping = {
|
||||
'trytond': ('https://docs.tryton.org/projects/server/en/8.0/', None),
|
||||
'account': (
|
||||
'https://docs.tryton.org/projects/modules-account/en/8.0/', None),
|
||||
'company': (
|
||||
'https://docs.tryton.org/projects/modules-company/en/8.0/', None),
|
||||
'currency': (
|
||||
'https://docs.tryton.org/projects/modules-currency/en/8.0/', None),
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
Design
|
||||
======
|
||||
|
||||
``account_do`` is a base accounting localization module. It follows the same
|
||||
shape as Tryton chart modules such as ``account_fr``, ``account_be``, and
|
||||
``account_syscohada``:
|
||||
|
||||
* chart, tax, tax code, and tax rule data are declarative XML records;
|
||||
* Python code extends existing account models only where Dominican metadata or
|
||||
chart setup defaults are needed;
|
||||
* the chart creation wizard proposes the Dominican receivable and payable
|
||||
control accounts when the Dominican chart is selected;
|
||||
* fiscal report box mapping remains outside this module and is owned by
|
||||
reporting modules such as ``dgii_reports``.
|
||||
|
||||
The module deliberately avoids replacing posting, tax computation, or invoice
|
||||
logic from Tryton's ``account`` module. Complementary Dominican modules should
|
||||
consume the accounts, taxes, tax codes, and metadata defined here.
|
||||
@@ -4,6 +4,14 @@ Account DO
|
||||
The ``account_do`` module provides Dominican Republic accounting data for
|
||||
Tryton.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
design
|
||||
reference
|
||||
publishing
|
||||
releases
|
||||
|
||||
It includes:
|
||||
|
||||
* An IFRS-oriented chart of accounts for Dominican companies;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
Reference
|
||||
=========
|
||||
|
||||
Chart Setup
|
||||
-----------
|
||||
|
||||
When the Dominican chart ``account_do.do_account_root`` is selected, the chart
|
||||
creation wizard proposes:
|
||||
|
||||
* ``account_do.do_account_110201`` as the default receivable account;
|
||||
* ``account_do.do_account_210101`` as the default payable account.
|
||||
|
||||
Fiscal Metadata
|
||||
---------------
|
||||
|
||||
The module extends ``account.tax.template`` and ``account.tax`` with:
|
||||
|
||||
* ``tax_kind``;
|
||||
* ``tax_fiscal_type``;
|
||||
* ``tax_application``;
|
||||
* ``dgii_legal_reference``;
|
||||
* ``dgii_legal_article``;
|
||||
* ``dgii_form_hint``;
|
||||
* ``dgii_fiscal_status``.
|
||||
|
||||
These fields classify Dominican taxes without duplicating DGII report box
|
||||
mapping. Reporting modules should use them together with account and tax codes.
|
||||
@@ -0,0 +1,9 @@
|
||||
Releases
|
||||
========
|
||||
|
||||
8.0.0
|
||||
-----
|
||||
|
||||
Initial Tryton 8.0 series release with Dominican chart of accounts, fiscal
|
||||
accounts, taxes, tax codes, tax rules, legal metadata, translations, and chart
|
||||
creation defaults.
|
||||
+15
-2
@@ -318,6 +318,11 @@ class AccountDoTestCase(ModuleTestCase):
|
||||
('party_required', '=', True),
|
||||
('closed', '!=', True),
|
||||
], limit=1)
|
||||
defaults = chart.default_properties([
|
||||
'company', 'account_receivable', 'account_payable'])
|
||||
self.assertEqual(defaults['company'], company.id)
|
||||
self.assertEqual(defaults['account_receivable'], receivable.id)
|
||||
self.assertEqual(defaults['account_payable'], payable.id)
|
||||
for code in [
|
||||
'111002', '120192', '120292', '120392', '120591',
|
||||
'120592', '120891', '120892', '120992', '7101', '7102',
|
||||
@@ -496,8 +501,10 @@ class AccountDoUnitTestCase(unittest.TestCase):
|
||||
'tax.TaxCode',
|
||||
'tax.TaxCodeLine',
|
||||
])
|
||||
self.assertEqual(lines('register', 'wizard'), ['account.CreateChart'])
|
||||
for filename in lines('tryton', 'xml'):
|
||||
self.assertTrue((MODULE_DIR / filename).is_file())
|
||||
self.assertTrue((MODULE_DIR / 'account.py').is_file())
|
||||
|
||||
pyproject = (MODULE_DIR / 'pyproject.toml').read_text(encoding='utf-8')
|
||||
self.assertIn("name = 'trytond_account_do'", pyproject)
|
||||
@@ -511,8 +518,14 @@ class AccountDoUnitTestCase(unittest.TestCase):
|
||||
'tests/**/*.rst',
|
||||
]:
|
||||
self.assertIn(package_file, pyproject)
|
||||
self.assertEqual(
|
||||
(MODULE_DIR / '__init__.py').read_text(encoding='utf-8'), '')
|
||||
init = (MODULE_DIR / '__init__.py').read_text(encoding='utf-8')
|
||||
self.assertIn('This file is part of Tryton.', init)
|
||||
account = (MODULE_DIR / 'account.py').read_text(encoding='utf-8')
|
||||
self.assertIn("class CreateChart(metaclass=PoolMeta):", account)
|
||||
self.assertIn(
|
||||
"'account_do.do_account_110201'", account)
|
||||
self.assertIn(
|
||||
"'account_do.do_account_210101'", account)
|
||||
|
||||
def test_xml_record_inventory_is_explicit(self):
|
||||
expected = {
|
||||
|
||||
@@ -17,3 +17,5 @@ model:
|
||||
tax.Tax
|
||||
tax.TaxCode
|
||||
tax.TaxCodeLine
|
||||
wizard:
|
||||
account.CreateChart
|
||||
|
||||
Reference in New Issue
Block a user