Skip to content

Commit

Permalink
[ADD]增加自动重置序列号模块测试
Browse files Browse the repository at this point in the history
  • Loading branch information
floraXiao committed Jun 27, 2018
1 parent 33f1ea3 commit 4145b76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ir_sequence_autoreset/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import test_ir_sequence
27 changes: 27 additions & 0 deletions ir_sequence_autoreset/tests/test_ir_sequence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from odoo.tests.common import TransactionCase


class TestIrSequence(TransactionCase):

def test_get_next_char(self):
'''序列号自动重置'''
seq = self.env['ir.sequence'].with_context({
'ir_sequence_date': '2018-04-01',
'ir_sequence_date_range': '2018-05-01',
}).create({
'number_next': 1,
'padding': 4,
'number_increment': 1,
'implementation': 'standard',
'name': 'test-sequence',
'auto_reset': True,
'reset_period': 'month',
'reset_init_number': 1,
})
seq.next_by_id()
n = seq.next_by_id()
self.assertEqual(n, "0002")
seq.reset_time = '00' # current_time = '04',二者不等即可自动重置
n = seq.next_by_id()
self.assertEqual(n, "0001")

0 comments on commit 4145b76

Please sign in to comment.