Metadata-Version: 2.4
Name: unpaismejor_ncf_manager
Version: 7.0.19
Summary: This module implements the administration and management of tax receipt numbers.
Home-page: https://www.solutema.com/
Author: Solutema SRL
Author-email: info@solutema.com
License: GPL-3
Keywords: tryton invoice
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Legal Industry
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: Bulgarian
Classifier: Natural Language :: Catalan
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Natural Language :: Czech
Classifier: Natural Language :: Dutch
Classifier: Natural Language :: English
Classifier: Natural Language :: Finnish
Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hungarian
Classifier: Natural Language :: Indonesian
Classifier: Natural Language :: Italian
Classifier: Natural Language :: Persian
Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Romanian
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Natural Language :: Turkish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Office/Business
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: unpaismejor_account_do<7.1,>=7.0
Requires-Dist: unpaismejor_account_invoice_do<7.1,>=7.0
Requires-Dist: unpaismejor_account_credit_note<7.1,>=7.0
Requires-Dist: unpaismejor_account_debit_note<7.1,>=7.0
Requires-Dist: trytond<7.1,>=7.0
Provides-Extra: test
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

NCF Manager Module
##################

The ncf_manager module manages Dominican Republic fiscal receipt numbers
for Tryton invoices.

It provides NCF/e-CF types, fiscal sequence management, invoice fiscal fields,
NCF assignment on posting, and fiscal preparation for debit and credit notes.

Installing
**********

Install the package and activate the module in the database::

    pip install unpaismejor_ncf_manager
    trytond-admin -d <database> -u ncf_manager

Publishing
**********

The included Gitea Actions workflow builds and publishes the package to the
Gitea PyPI registry from version-series branches such as ``7.0``.

Configure this repository secret:

* ``REGISTRY_PASSWORD``

The module assigns fiscal numbers transactionally from ``ir.sequence.strict``.
It does not sign or transmit e-CF documents; transmission remains the explicit
responsibility of an electronic invoicing connector.

Version compatibility
*********************

The 7.0 and 8.0 series share the same fiscal models, workflows, importer,
validations and tests.  Only the module registration, packaging metadata and
report XML required by each Tryton series remain version-specific.

Authorization workflow
**********************

NCF authorizations follow the protected workflow ``Draft → Active →
Finished``.  Create the authorization and its fiscal lines in draft, then use
the **Activate** button.  A line can select an existing strict sequence or ask
the module to create one on activation from its authorized range.  Activation
checks company, fiscal type, prefix, padding, validity, availability and range
overlap.  Incoming supplier documents and outgoing customer documents use
independent numbering authorities, so overlap is enforced only within the
same document direction.  The last issued number automatically finishes the
line.  Finishing an authorization closes every remaining active line without
reusing numbers.

Legacy migration lines keep their original technical sequence immutable after
activation.  Prefix selection is enforced while a line is in draft and fiscal
activation performs the same server-side validation; closing a protected
historical line therefore does not invalidate already-linked invoices.

Electronic fiscal numbers are only reserved by this module.  Activating an
E-series authorization never signs or transmits an e-CF to DGII.

Importing DGII authorizations
*****************************

Use **NCF Manager → Import DGII Authorization** to load an authorization
downloaded from the DGII Virtual Office.  XML, CSV and the HTML table exported
with an ``.xls`` extension are supported and detected from their content.
The importer creates an independent workflow record for every ``NUM_AUTOR``.
The same ``NUM_SOL`` may therefore appear in several records without modifying
an authorization that is already active; file names are not used as fiscal
identifiers.  It validates
approval status, company name, NCF type, prefix, range and approved quantity,
and stores the original file, SHA-256, user and import date for audit.

Imports are idempotent.  Reimporting an equivalent CSV, XML or XLS record does
not create another line, while different fiscal data for an existing
authorization is rejected.  The safe default leaves the result in draft so
the first number can be reviewed.  Immediate activation is explicit and still
does not transmit electronic documents.
