From 76d3dbb6479a3c724b903c640a26a6bf29559543 Mon Sep 17 00:00:00 2001 From: "jm.pardo" Date: Thu, 1 Jun 2023 10:53:38 +0200 Subject: [PATCH] Migrate to 6.4 --- template/n68.txt | 6 ++--- tests/__init__.py | 3 --- tests/sample.txt | 6 ++--- ...cenario_account_payment_confirming_n68.rst | 10 +++++-- tests/test_account_payment_confirming_n68.py | 27 ------------------- tests/test_module.py | 11 ++++++++ tests/test_scenario.py | 7 +++++ tryton.cfg | 2 +- 8 files changed, 33 insertions(+), 39 deletions(-) delete mode 100644 tests/test_account_payment_confirming_n68.py create mode 100644 tests/test_module.py create mode 100644 tests/test_scenario.py diff --git a/template/n68.txt b/template/n68.txt index b3ea881..f230377 100644 --- a/template/n68.txt +++ b/template/n68.txt @@ -8,7 +8,7 @@ ${'credit_note' if payment.line.origin.total_amount < 0 else 'invoice'}\ ${fill('03', 2)}\ ${fill('59', 2)}\ ${fill(group.company.party.tax_identifier and group.company.party.tax_identifier.code[2:] or group.company.party.code, 9, norm=True)}\ -${fill(group.journal.suffix, 3)} +${fill(group.journal.suffix, 3)}\ ${fillblank(12)}\ ${fill('001', 3)}\ ${datetime.datetime.now().strftime('%d%m%y') or fillblank(6)}\ @@ -21,7 +21,7 @@ ${fillblank(30)} ${fill('06', 2)}\ ${fill('59', 2)}\ ${fill(group.company.party.tax_identifier and group.company.party.tax_identifier.code[2:] or group.company.party.code, 9, norm=True)}\ -${fill(group.journal.suffix, 3)} +${fill(group.journal.suffix, 3)}\ ${fill(payment.party.tax_identifier and payment.party.tax_identifier.code[2:] or payment.party.code, 12)}\ {% if i == 0 %}\ ${fill('010', 3)}\ @@ -72,7 +72,7 @@ ${fillblank(2)} ${fill('08', 2)}\ ${fill('59', 2)}\ ${fill(group.company.party.tax_identifier and group.company.party.tax_identifier.code[2:] or group.company.party.code, 9, norm=True)}\ -${fill(group.journal.suffix, 3)} +${fill(group.journal.suffix, 3)}\ ${fillblank(12)}\ ${fillblank(3)}\ ${format_number(sum(p.amount for p in group.payments if p.amount), 10, 2)}\ diff --git a/tests/__init__.py b/tests/__init__.py index 91828d1..d70b900 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,2 @@ # The COPYRIGHT file at the top level of this repository contains # the full copyright notices and license terms. -from .test_account_payment_confirming_n68 import suite - -__all__ = ['suite'] diff --git a/tests/sample.txt b/tests/sample.txt index 8587101..aeab600 100644 --- a/tests/sample.txt +++ b/tests/sample.txt @@ -3,12 +3,12 @@ 06591 0004 011 06591 0004 012 06591 0004 013 -06591 0004 01400000023120720220000000180000 -06591 0004 01500000023 12072022000000018000H +06591 0004 014000000%(date_year)s0000000180000 +06591 0004 01500000023 %(date)s000000018000H 06591 0003 010Party 1 06591 0003 011 06591 0003 012 06591 0003 013 06591 0003 01400000012280620180000000100000 -06591 0003 01500000012 12072022000000010000H +06591 0003 01500000012 %(date)s000000010000H 08591 000 0000000280000000000014 diff --git a/tests/scenario_account_payment_confirming_n68.rst b/tests/scenario_account_payment_confirming_n68.rst index f368bf3..8ffcb29 100644 --- a/tests/scenario_account_payment_confirming_n68.rst +++ b/tests/scenario_account_payment_confirming_n68.rst @@ -139,6 +139,7 @@ Pay invoices:: >>> pay_line.execute('next_') >>> payments = Payment.find() >>> for payment in payments: + ... payment.click('submit') ... payment.click('approve') >>> len(payments) 2 @@ -154,5 +155,10 @@ Process the payment:: >>> message, = group.confirming_messages >>> file = os.path.join(os.path.dirname(__file__), 'sample.txt') >>> sample = io.open(file, 'rb').read().decode('ascii') - >>> (sample % {'today': today.strftime('%d%m%y')}) == message.message - True \ No newline at end of file + >>> sample = (sample % { + ... 'today': today.strftime('%d%m%y'), + ... 'date_year': today.strftime('%y%d%m%Y'), + ... 'date': today.strftime('%d%m%Y') + ... }) + >>> sample == message.message + True diff --git a/tests/test_account_payment_confirming_n68.py b/tests/test_account_payment_confirming_n68.py deleted file mode 100644 index c324188..0000000 --- a/tests/test_account_payment_confirming_n68.py +++ /dev/null @@ -1,27 +0,0 @@ -# The COPYRIGHT file at the top level of this repository contains -# the full copyright notices and license terms. -import unittest - -import doctest - -from trytond.tests.test_tryton import ModuleTestCase -from trytond.tests.test_tryton import suite as test_suite -from trytond.tests.test_tryton import doctest_teardown -from trytond.tests.test_tryton import doctest_checker - - -class AccountPaymentConfirmingN68TestCase(ModuleTestCase): - """Test Account Payment Confirming N68 module""" - module = 'account_payment_confirming_n68' - - -def suite(): - suite = test_suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - AccountPaymentConfirmingN68TestCase)) - suite.addTests(doctest.DocFileSuite( - 'scenario_account_payment_confirming_n68.rst', - tearDown=doctest_teardown, encoding='utf-8', - checker=doctest_checker, - optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) - return suite diff --git a/tests/test_module.py b/tests/test_module.py new file mode 100644 index 0000000..5b0bf81 --- /dev/null +++ b/tests/test_module.py @@ -0,0 +1,11 @@ +# The COPYRIGHT file at the top level of this repository contains +# the full copyright notices and license terms. +from trytond.tests.test_tryton import ModuleTestCase + + +class AccountPaymentConfirmingN68TestCase(ModuleTestCase): + """Test Account Payment Confirming N68 module""" + module = 'account_payment_confirming_n68' + + +del ModuleTestCase diff --git a/tests/test_scenario.py b/tests/test_scenario.py new file mode 100644 index 0000000..21493e7 --- /dev/null +++ b/tests/test_scenario.py @@ -0,0 +1,7 @@ +# The COPYRIGHT file at the top level of this repository contains the full +# copyright notices and license terms. +from trytond.tests.test_tryton import load_doc_tests + + +def load_tests(*args, **kwargs): + return load_doc_tests(__name__, __file__, *args, **kwargs) diff --git a/tryton.cfg b/tryton.cfg index b9adaf4..715fa16 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.0.0 +version=6.4.0 depends: ir res