Browse Source

[MIG] sequence_check_digit: Migration to 11.0

pull/71/head
Enric Tobella 7 years ago
committed by Jaime Arroyo
parent
commit
44f30943be
  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

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

Loading…
Cancel
Save