Prepare NCF manager for production on Tryton 8.0
Publicar paquete PyPI / publish (push) Successful in 1m17s
Publicar paquete PyPI / publish (push) Successful in 1m17s
This commit is contained in:
+28
-3
@@ -50,7 +50,7 @@ class NcfManagerTestCase(ModuleTestCase):
|
||||
session_id, _start, _end = CreateChart.create()
|
||||
chart = CreateChart(session_id)
|
||||
chart.account.account_template = AccountTemplate(ModelData.get_id(
|
||||
'account_do', 'do_account_root'))
|
||||
'account_do', 'do_account_root_en'))
|
||||
chart.account.company = company
|
||||
chart.transition_create_account()
|
||||
|
||||
@@ -228,8 +228,8 @@ class NcfManagerUnitTestCase(unittest.TestCase):
|
||||
|
||||
self.assertNotIn('line.itbis_line', template)
|
||||
self.assertEqual(template.count('line.itbis_invoiced_line'), 2)
|
||||
self.assertEqual(template.count('if test="invoice.tip_invoiced'), 2)
|
||||
self.assertEqual(template.count('format_currency(invoice.tip_invoiced'), 2)
|
||||
self.assertEqual(template.count('if test="invoice.tip'), 2)
|
||||
self.assertEqual(template.count('format_currency(invoice.tip'), 2)
|
||||
|
||||
def test_sequence_defaults_match_ncf_type(self):
|
||||
sequence = SimpleNamespace(
|
||||
@@ -247,6 +247,31 @@ class NcfManagerUnitTestCase(unittest.TestCase):
|
||||
self.assertEqual(Sequence.on_change_with_approved_qty(sequence), 10)
|
||||
self.assertEqual(Sequence.on_change_with_remaining_qty(sequence), 7)
|
||||
|
||||
def test_ncf_structure_and_normalization(self):
|
||||
invoice = SimpleNamespace(
|
||||
ncf_number=' b0100000001 ', ncf_type='1')
|
||||
Invoice._ncf_validate_number(invoice)
|
||||
self.assertEqual(invoice.ncf_number, 'B0100000001')
|
||||
|
||||
invoice.ncf_number = 'E310000000001'
|
||||
invoice.ncf_type = '31'
|
||||
Invoice._ncf_validate_number(invoice)
|
||||
|
||||
def test_ncf_rejects_invalid_structure_or_type(self):
|
||||
invoice = SimpleNamespace(ncf_number='B010001', ncf_type='1')
|
||||
with self.assertRaises(UserError):
|
||||
Invoice._ncf_validate_number(invoice)
|
||||
|
||||
def test_legacy_supplier_ncf_is_preserved_for_migration(self):
|
||||
invoice = SimpleNamespace(
|
||||
type='in', ncf_number='A010010010100000001', ncf_type='1')
|
||||
Invoice._ncf_validate_number(invoice)
|
||||
self.assertEqual(invoice.ncf_number, 'A010010010100000001')
|
||||
|
||||
invoice.ncf_number = 'B0200000001'
|
||||
with self.assertRaises(UserError):
|
||||
Invoice._ncf_validate_number(invoice)
|
||||
|
||||
def test_fiscal_cancellation_requires_ncf_number(self):
|
||||
fiscal_invoice = SimpleNamespace(type='out', ncf_number='B0100000001')
|
||||
non_fiscal_invoice = SimpleNamespace(type='out', ncf_number=None)
|
||||
|
||||
Reference in New Issue
Block a user