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.

78 lines
2.7 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
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
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
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
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
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
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
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
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. # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)nses/agpl).
  3. import datetime
  4. from dateutil.rrule import MONTHLY
  5. from odoo.exceptions import ValidationError
  6. from odoo.tests.common import TransactionCase
  7. class DateRangeGeneratorTest(TransactionCase):
  8. post_install = True
  9. at_install = False
  10. def setUp(self):
  11. super(DateRangeGeneratorTest, self).setUp()
  12. self.generator = self.env['date.range.generator']
  13. self.type = self.env['date.range.type'].create(
  14. {'name': 'Fiscal year',
  15. 'company_id': False,
  16. 'allow_overlap': False})
  17. self.company = self.env['res.company'].create({
  18. 'name': 'Test company',
  19. })
  20. self.company_2 = self.env['res.company'].create({
  21. 'name': 'Test company 2',
  22. 'parent_id': self.company.id,
  23. })
  24. self.typeB = self.env['date.range.type'].create(
  25. {'name': 'Fiscal year B',
  26. 'company_id': self.company.id,
  27. 'allow_overlap': False})
  28. def test_generate(self):
  29. generator = self.generator.create({
  30. 'date_start': '1943-01-01',
  31. 'name_prefix': '1943-',
  32. 'type_id': self.type.id,
  33. 'duration_count': 3,
  34. 'unit_of_time': MONTHLY,
  35. 'count': 4})
  36. generator.action_apply()
  37. ranges = self.env['date.range'].search(
  38. [('type_id', '=', self.type.id)])
  39. self.assertEqual(len(ranges), 4)
  40. range4 = ranges[3]
  41. self.assertEqual(range4.date_start, datetime.date(1943, 10, 1))
  42. self.assertEqual(range4.date_end, datetime.date(1943, 12, 31))
  43. self.assertEqual(range4.type_id, self.type)
  44. def test_generator_multicompany_1(self):
  45. generator = self.generator.new({
  46. 'date_start': '1943-01-01',
  47. 'name_prefix': '1943-',
  48. 'type_id': self.typeB.id,
  49. 'duration_count': 3,
  50. 'unit_of_time': MONTHLY,
  51. 'count': 4,
  52. 'company_id': self.company.id,
  53. })
  54. generator._cache.update(generator._convert_to_cache(
  55. {'company_id': self.company_2.id}, update=True))
  56. generator._onchange_company_id()
  57. self.assertFalse(generator.type_id)
  58. def test_generator_multicompany_2(self):
  59. with self.assertRaises(ValidationError):
  60. self.generator.create({
  61. 'date_start': '1943-01-01',
  62. 'name_prefix': '1943-',
  63. 'type_id': self.typeB.id,
  64. 'duration_count': 3,
  65. 'unit_of_time': MONTHLY,
  66. 'count': 4,
  67. 'company_id': self.company_2.id,
  68. })