def _search_age(self, operator, value):
     today = fDate.context_today(self)
     value_date = fDate.subtract(today, days=value)
     # convert the operator:
     # book with age > value have a date < value_date
     operator_map = {
         '>': '<',
         '>=': '<=',
         '<': '>',
         '<=': '>=',
     }
     new_op = operator_map.get(operator, operator)
     return [('date_release', new_op, value_date)]
 def _inverse_age(self):
     today = fDate.context_today(self)
     for book in self.filtered('date_release'):
         d = fDate.subtract(today, days=book.age_days)
         book.date_release = d