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.

34 lines
1.2 KiB

9.0 add date range Sorrento Delivery * [ADD] Basic structure for the new date range module * [IMP] Add a basic description into the README * [IMP] Basic implementation * [IMP] First working implementation * [IMP] Improve datamodel * [ADD] Add basic tests for date.range * [PEP8] * [PYLINT] * [DEL] Remove unused code * [IMP] Remove unsused dependencies into the JS * [IMP] Better operator label for date range * [DEL] Remove unused file * [IMP] Better user experience by showing the select input only once empty * [FIX]Try to fix tests that fails only on travis by adding an explicit cast on the daterange methods parameters * [FIX]Try to fix tests that fails only on travis by adding an explicit cast on the daterange methods parameters * [FIX]Try to fix tests that fails only on travis by using postgresql 9.4 * [FIX]Try with postgresql 9.2 since the daterange method has appeared in 9.2 * [IMP] Add a limitation into the module description to warm about the minimal version of postgresql to use * [IMP]Add multi-company rules * [IMP]Remove unused files * [FIX] Add missing brackets into JS * [FIX] Overlap detection when company_id is False * [IMP] Add default order for date.range * [IMP] Add date range generator * [FIX] OE compatibility * [FIX] Travis * [IMP] Code cleanup and improves test coverage * [FIX] Add missing dependency on 'web' * [PYLINT] remove unused import * [FIX] Add missing copyright * [FIX] Limits are included into the range * [IMP][date_range] Security * [IMP] Improve module description * [IMP] Spelling
9 years ago
  1. # -*- coding: utf-8 -*-
  2. # © 2016 ACSONE SA/NV (<http://acsone.eu>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)nses/agpl).
  4. from openerp.tests.common import TransactionCase
  5. from dateutil.rrule import MONTHLY
  6. class DateRangeGeneratorTest(TransactionCase):
  7. def setUp(self):
  8. super(DateRangeGeneratorTest, self).setUp()
  9. self.type = self.env['date.range.type'].create(
  10. {'name': 'Fiscal year',
  11. 'company_id': False,
  12. 'allow_overlap': False})
  13. def test_generate(self):
  14. generator = self.env['date.range.generator']
  15. generator = generator.create({
  16. 'date_start': '1943-01-01',
  17. 'name_prefix': '1943-',
  18. 'type_id': self.type.id,
  19. 'duration_count': 3,
  20. 'unit_of_time': MONTHLY,
  21. 'count': 4})
  22. generator.action_apply()
  23. ranges = self.env['date.range'].search(
  24. [('type_id', '=', self.type.id)])
  25. self.assertEquals(len(ranges), 4)
  26. range4 = ranges[3]
  27. self.assertEqual(range4.date_start, '1943-10-01')
  28. self.assertEqual(range4.date_end, '1943-12-31')
  29. self.assertEqual(range4.type_id, self.type)