[FIX]Radicale Odoo Storage : should return last modified, event if there is no event in database

This commit is contained in:
Fabien BOURGEOIS 2018-05-13 09:18:51 +02:00
parent 3659f811ea
commit 258ccac379
1 changed files with 4 additions and 2 deletions

View File

@ -339,5 +339,7 @@ class Collection(BaseCollection):
def last_modified(self):
""" Return last modified """
last = self.odoo.env[self.odoo_model].search([], limit=1, order='write_date desc')
last_fields = self.odoo.execute(self.odoo_model, 'read', last, ['write_date'])[0]
return str(last_fields['write_date'])
if last:
last_fields = self.odoo.execute(self.odoo_model, 'read', last, ['write_date'])[0]
return str(last_fields['write_date'])
return '1970-01-01 00:00:00'