Browse Source
[MIG] sequence_check_digit: Migration to 11.0
pull/1/head
Enric Tobella
7 years ago
No known key found for this signature in database
GPG Key ID: 1A2546A1B7BA2451
7 changed files with
23 additions and
6 deletions
-
sequence_check_digit/__manifest__.py
-
sequence_check_digit/models/ir_sequence.py
-
sequence_check_digit/tests/test_check_digit.py
-
setup/sequence_check_digit/odoo/__init__.py
-
setup/sequence_check_digit/odoo/addons/__init__.py
-
setup/sequence_check_digit/odoo/addons/sequence_check_digit
-
setup/sequence_check_digit/setup.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, " |
|
|
|
|
|
@ -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): |
|
|
|
|
|
@ -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())) |
|
|
|
|
|
@ -0,0 +1 @@ |
|
|
|
__import__('pkg_resources').declare_namespace(__name__) |
|
|
@ -0,0 +1 @@ |
|
|
|
__import__('pkg_resources').declare_namespace(__name__) |
|
|
@ -0,0 +1 @@ |
|
|
|
../../../../sequence_check_digit |
|
|
@ -0,0 +1,6 @@ |
|
|
|
import setuptools |
|
|
|
|
|
|
|
setuptools.setup( |
|
|
|
setup_requires=['setuptools-odoo'], |
|
|
|
odoo_addon=True, |
|
|
|
) |