Reviewers: ,
Please review this at http://codereview.tryton.org/190001/ Affected files: M tests/test_account.py Index: tests/test_account.py =================================================================== --- a/tests/test_account.py +++ b/tests/test_account.py @@ -9,6 +9,7 @@ sys.path.insert(0, os.path.dirname(DIR)) import unittest +import datetime import trytond.tests.test_tryton from trytond.tests.test_tryton import test_view, test_depends from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT @@ -28,6 +29,8 @@ 'account.account.create_chart_account', type='wizard') self.company = POOL.get('company.company') self.user = POOL.get('res.user') + self.fiscalyear = POOL.get('account.fiscalyear') + self.sequence = POOL.get('ir.sequence') def test0005views(self): ''' @@ -52,6 +55,7 @@ 'main_company': company_id, 'company': company_id, }) + CONTEXT.update(self.user.get_preferences(context_only=True)) self.account_create_chart_account._action_create_account({ 'form': { @@ -76,6 +80,30 @@ }) transaction.cursor.commit() + def test0020fiscalyear(self): + ''' + Test fiscalyear. + ''' + with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + today = datetime.date.today() + company_id, = self.company.search([('name', '=', 'B2CK')]) + sequence_id = self.sequence.create({ + 'name': '%s' % today.year, + 'code': 'account.move', + 'company': company_id, + }) + fiscalyear_id = self.fiscalyear.create({ + 'name': '%s' % today.year, + 'start_date': today.replace(month=1, day=1), + 'end_date': today.replace(month=12, day=31), + 'company': company_id, + 'post_move_sequence': sequence_id, + }) + self.fiscalyear.create_period([fiscalyear_id]) + fiscalyear = self.fiscalyear.browse(fiscalyear_id) + self.assertEqual(len(fiscalyear.periods), 12) + transaction.cursor.commit() + def suite(): suite = trytond.tests.test_tryton.suite() from trytond.modules.company.tests import test_company -- [email protected] mailing list
