Browse Source

[MIG] sequence_check_digit: Migration to 11.0

pull/1/head
Enric Tobella 7 years ago
parent
commit
7953d06ff3
No known key found for this signature in database GPG Key ID: 1A2546A1B7BA2451
  1. 2
      sequence_check_digit/__manifest__.py
  2. 4
      sequence_check_digit/models/ir_sequence.py
  3. 14
      sequence_check_digit/tests/test_check_digit.py
  4. 1
      setup/sequence_check_digit/odoo/__init__.py
  5. 1
      setup/sequence_check_digit/odoo/addons/__init__.py
  6. 1
      setup/sequence_check_digit/odoo/addons/sequence_check_digit
  7. 6
      setup/sequence_check_digit/setup.py

2
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, "

4
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):

14
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()))

1
setup/sequence_check_digit/odoo/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/sequence_check_digit/odoo/addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/sequence_check_digit/odoo/addons/sequence_check_digit

@ -0,0 +1 @@
../../../../sequence_check_digit

6
setup/sequence_check_digit/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save