From 7953d06ff3b55d1826ae65642c1254a5ec4fe22f Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Sat, 7 Oct 2017 14:45:31 +0200 Subject: [PATCH] [MIG] sequence_check_digit: Migration to 11.0 --- sequence_check_digit/__manifest__.py | 2 +- sequence_check_digit/models/ir_sequence.py | 4 ++-- sequence_check_digit/tests/test_check_digit.py | 14 +++++++++++--- setup/sequence_check_digit/odoo/__init__.py | 1 + setup/sequence_check_digit/odoo/addons/__init__.py | 1 + .../odoo/addons/sequence_check_digit | 1 + setup/sequence_check_digit/setup.py | 6 ++++++ 7 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 setup/sequence_check_digit/odoo/__init__.py create mode 100644 setup/sequence_check_digit/odoo/addons/__init__.py create mode 120000 setup/sequence_check_digit/odoo/addons/sequence_check_digit create mode 100644 setup/sequence_check_digit/setup.py diff --git a/sequence_check_digit/__manifest__.py b/sequence_check_digit/__manifest__.py index 3f3fb12..08573f8 100644 --- a/sequence_check_digit/__manifest__.py +++ b/sequence_check_digit/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Check Digit on Sequences", - "version": "10.0.1.0.0", + "version": "11.0.1.0.0", "category": "Reporting", "website": "https://github.com/OCA/server-tools", "author": "Creu Blanca, " diff --git a/sequence_check_digit/models/ir_sequence.py b/sequence_check_digit/models/ir_sequence.py index 73578a8..e48efab 100644 --- a/sequence_check_digit/models/ir_sequence.py +++ b/sequence_check_digit/models/ir_sequence.py @@ -5,14 +5,14 @@ from odoo import fields, models, api, _ from odoo.exceptions import ValidationError import logging - +_logger = logging.getLogger(__name__) try: from stdnum.iso7064 import mod_97_10 from stdnum.iso7064 import mod_37_2, mod_37_36 from stdnum.iso7064 import mod_11_2, mod_11_10 from stdnum import luhn, damm, verhoeff except(ImportError, IOError) as err: - logging.info(err) + _logger.debug(err) class IrSequence(models.Model): diff --git a/sequence_check_digit/tests/test_check_digit.py b/sequence_check_digit/tests/test_check_digit.py index f4fa83d..9725600 100644 --- a/sequence_check_digit/tests/test_check_digit.py +++ b/sequence_check_digit/tests/test_check_digit.py @@ -4,16 +4,16 @@ from odoo.tests import common -import logging from odoo.exceptions import ValidationError - +import logging +_logger = logging.getLogger(__name__) try: from stdnum.iso7064 import mod_97_10 from stdnum.iso7064 import mod_37_2, mod_37_36 from stdnum.iso7064 import mod_11_2, mod_11_10 from stdnum import luhn, damm, verhoeff except(ImportError, IOError) as err: - logging.info(err) + _logger.debug(err) class TestSequenceCheckDigit(common.TransactionCase): @@ -25,6 +25,14 @@ class TestSequenceCheckDigit(common.TransactionCase): 'padding': '5' }) + def test_none(self): + sequence = self.get_sequence('none') + self.assertEqual('00001', sequence.next_by_id()) + + def test_null(self): + sequence = self.get_sequence(None) + self.assertEqual('00001', sequence.next_by_id()) + def test_luhn(self): sequence = self.get_sequence('luhn') self.assertTrue(luhn.validate(sequence.next_by_id())) diff --git a/setup/sequence_check_digit/odoo/__init__.py b/setup/sequence_check_digit/odoo/__init__.py new file mode 100644 index 0000000..de40ea7 --- /dev/null +++ b/setup/sequence_check_digit/odoo/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/sequence_check_digit/odoo/addons/__init__.py b/setup/sequence_check_digit/odoo/addons/__init__.py new file mode 100644 index 0000000..de40ea7 --- /dev/null +++ b/setup/sequence_check_digit/odoo/addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/sequence_check_digit/odoo/addons/sequence_check_digit b/setup/sequence_check_digit/odoo/addons/sequence_check_digit new file mode 120000 index 0000000..f170b3e --- /dev/null +++ b/setup/sequence_check_digit/odoo/addons/sequence_check_digit @@ -0,0 +1 @@ +../../../../sequence_check_digit \ No newline at end of file diff --git a/setup/sequence_check_digit/setup.py b/setup/sequence_check_digit/setup.py new file mode 100644 index 0000000..999b290 --- /dev/null +++ b/setup/sequence_check_digit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) \ No newline at end of file