To achieve the oldest cache time first you have to install point of sale module and inherit the pos_config class in your own module and fetch cache ids in pos_config class and then use this function in your own module.
@api.depends('cache_ids')
def _get_oldest_cache_time(self):
pos_cache = self.env['pos.cache']
oldest_cache = pos_cache.search([('config_id', '=', self.id)], order='write_date', limit=1)
if oldest_cache:
self.oldest_cache_time = oldest_cache.write_date
0 Comment(s)