def get_context(cls, records, data): pool = Pool() Lang = pool.get('ir.lang') context = super(EmailResetPassword, cls).get_context(records, data) lang = Lang.get() context['host'] = host() context['http_host'] = http_host() context['database'] = Transaction().database.name context['expire'] = lang.strftime(records[0].password_reset_expire, format=lang.date + ' %H:%M:%S') return context
def get_context(cls, records, header, data): context = super().get_context(records, header, data) context['host'] = host() context['http_host'] = http_host() context['database'] = Transaction().database.name expire_delay = (records[0].password_reset_expire - datetime.datetime.now()) # Use a precision of minutes expire_delay = datetime.timedelta(days=expire_delay.days, minutes=round(expire_delay.seconds / 60)) context['expire_delay'] = expire_delay return context