diff --git a/__init__.py b/__init__.py index e69de29..4effdfa 100644 --- a/__init__.py +++ b/__init__.py @@ -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. diff --git a/account.py b/account.py new file mode 100644 index 0000000..24a105c --- /dev/null +++ b/account.py @@ -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 diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..fd674cf --- /dev/null +++ b/doc/conf.py @@ -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), + } diff --git a/doc/design.rst b/doc/design.rst new file mode 100644 index 0000000..91307c0 --- /dev/null +++ b/doc/design.rst @@ -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. diff --git a/doc/index.rst b/doc/index.rst index 3e8a953..01b9c27 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -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; diff --git a/doc/reference.rst b/doc/reference.rst new file mode 100644 index 0000000..921155b --- /dev/null +++ b/doc/reference.rst @@ -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. diff --git a/doc/releases.rst b/doc/releases.rst new file mode 100644 index 0000000..fbea7b8 --- /dev/null +++ b/doc/releases.rst @@ -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. diff --git a/tests/test_module.py b/tests/test_module.py index aa4b229..55a5445 100644 --- a/tests/test_module.py +++ b/tests/test_module.py @@ -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 = { diff --git a/tryton.cfg b/tryton.cfg index bc4b192..8d2a6b0 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -17,3 +17,5 @@ model: tax.Tax tax.TaxCode tax.TaxCodeLine +wizard: + account.CreateChart