Browse Source

[FIX][9.0] date_range. Periods within the day should be allowed (#921)

pull/950/head
Aarón Henríquez 7 years ago
committed by Pedro M. Baeza
parent
commit
10bb84928a
  1. 2
      date_range/__openerp__.py
  2. 4
      date_range/models/date_range.py
  3. 2
      date_range/tests/test_date_range.py

2
date_range/__openerp__.py

@ -4,7 +4,7 @@
{
"name": "Date Range",
"summary": "Manage all kind of date range",
"version": "9.0.1.0.0",
"version": "9.0.1.0.1",
"category": "Uncategorized",
"website": "https://odoo-community.org/",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",

4
date_range/models/date_range.py

@ -38,9 +38,9 @@ class DateRange(models.Model):
for this in self:
start = fields.Date.from_string(this.date_start)
end = fields.Date.from_string(this.date_end)
if start >= end:
if start > end:
raise ValidationError(
_("%s is not a valid range (%s >= %s)") % (
_("%s is not a valid range (%s > %s)") % (
this.name, this.date_start, this.date_end))
if this.type_id.allow_overlap:
continue

2
date_range/tests/test_date_range.py

@ -56,7 +56,7 @@ class DateRangeTest(TransactionCase):
})
self.assertEqual(
cm.exception.name,
'FS2016 is not a valid range (2016-12-31 >= 2015-01-01)')
'FS2016 is not a valid range (2016-12-31 > 2015-01-01)')
def test_overlap(self):
date_range = self.env['date.range']

Loading…
Cancel
Save