You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1017 B

  1. # Copyright 2009-2017 Noviat.
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. import time
  4. from odoo.tests.common import TransactionCase
  5. class TestAccountingReport(TransactionCase):
  6. def setUp(self):
  7. super(TestAccountingReport, self).setUp()
  8. p_type = self.env['date.range.type'].create({
  9. 'name': 'Fiscal Period',
  10. 'allow_overlap': False})
  11. self.p1 = self.env['date.range'].create({
  12. 'name': 'P01',
  13. 'type_id': p_type.id,
  14. 'date_start': time.strftime('%Y-01-01'),
  15. 'date_end': time.strftime('%Y-01-31')})
  16. def test_accounting_report(self):
  17. bs = self.env.ref(
  18. 'account.account_financial_report_balancesheet0')
  19. wiz = self.env['accounting.report'].create({
  20. 'account_report_id': bs.id})
  21. # Check date_range onchange
  22. wiz.date_range_id = self.p1
  23. wiz._onchange_date_range_id()
  24. self.assertEquals(wiz.date_from, time.strftime('%Y-01-01'))