Exclude records without dtstart or dtend from calendar view

Closes #13302
This commit is contained in:
Cédric Krier committed 2024-06-06 10:01:55 +02:00
1 parent 36dee8a853
commit db9becfd6d
2 files changed
+19 -9

No files matched your search

+7 -2
View File
@@ -350,13 +350,18 @@
var last_datetime = Sao.DateTime(this.end);
var dtstart = this.attributes.dtstart;
var dtend = this.attributes.dtend || dtstart;
return ['OR',
return [
[dtstart, '!=', null],
[dtend, '!=', null],
['OR',
['AND', [dtstart, '>=', first_datetime],
[dtstart, '<', last_datetime]],
['AND', [dtend, '>=', first_datetime],
[dtend, '<', last_datetime]],
['AND', [dtstart, '<', first_datetime],
[dtend, '>', last_datetime]]];
[dtend, '>', last_datetime]],
],
];
},
get_displayed_period: function(){
var DatesPeriod = [];
@@ -67,13 +67,18 @@ class Calendar_(goocalendar.Calendar):
self.current_domain_period.get_dates(True)
dtstart = self.attrs['dtstart']
dtend = self.attrs.get('dtend') or dtstart
domain = ['OR',
['AND', (dtstart, '>=', first_datetime),
(dtstart, '<', last_datetime)],
['AND', (dtend, '>=', first_datetime),
(dtend, '<', last_datetime)],
['AND', (dtstart, '<', first_datetime),
(dtend, '>', last_datetime)]]
domain = [
(dtstart, '!=', None),
(dtend, '!=', None),
['OR',
['AND', (dtstart, '>=', first_datetime),
(dtstart, '<', last_datetime)],
['AND', (dtend, '>=', first_datetime),
(dtend, '<', last_datetime)],
['AND', (dtstart, '<', first_datetime),
(dtend, '>', last_datetime)],
],
]
return domain
def get_colors(self, record):