Allow closing protected legacy NCF ranges
Publicar paquete PyPI / publish (push) Successful in 1m42s
Publicar paquete PyPI / publish (push) Successful in 1m42s
This commit is contained in:
@@ -43,6 +43,11 @@ 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.
|
||||
|
||||
|
||||
+3
-1
@@ -8,7 +8,7 @@ from trytond.i18n import gettext
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, Workflow, fields, Unique
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
@@ -309,7 +309,9 @@ class NCFManagerSequences(Workflow, ModelSQL, ModelView):
|
||||
ncf_sequences = fields.Many2One('ir.sequence.strict', 'Fiscal Sequence',
|
||||
domain=[
|
||||
('company', '=', Eval('company', -1)),
|
||||
If(Eval('state') == 'draft',
|
||||
('prefix', '=', Eval('expected_prefix')),
|
||||
()),
|
||||
('active', '=', True),
|
||||
],
|
||||
states={
|
||||
|
||||
@@ -396,6 +396,28 @@ class NcfManagerTestCase(ModuleTestCase):
|
||||
with self.assertRaises(UserError):
|
||||
Manager.activate([manager])
|
||||
|
||||
@with_transaction()
|
||||
def test_finish_preserves_bound_legacy_migration_sequence(self):
|
||||
'Finishing must not invalidate an immutable historical sequence'
|
||||
pool = Pool()
|
||||
Manager = pool.get('ncf.manager')
|
||||
StrictSequence = pool.get('ir.sequence.strict')
|
||||
company = self._create_company()
|
||||
|
||||
line = self._create_ncf_sequence(company)
|
||||
strict_sequence = line.ncf_sequences
|
||||
StrictSequence.write([strict_sequence], {
|
||||
'prefix': 'MIG1',
|
||||
'padding': 9,
|
||||
})
|
||||
|
||||
Manager.finish([line.pos])
|
||||
|
||||
line = line.__class__(line.id)
|
||||
self.assertEqual(line.state, 'finished')
|
||||
self.assertEqual(line.ncf_sequences.id, strict_sequence.id)
|
||||
self.assertEqual(line.ncf_sequences.prefix, 'MIG1')
|
||||
|
||||
@with_transaction()
|
||||
def test_import_dgii_authorization_is_idempotent(self):
|
||||
pool = Pool()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[tryton]
|
||||
version=8.0.2
|
||||
version=8.0.3
|
||||
depends:
|
||||
account_do
|
||||
account_invoice_do
|
||||
|
||||
Reference in New Issue
Block a user