Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: External access token expiration

by
Holger Brunn
- 11/01/2024 21:48:45
> Did anyone here face a similar requirement? How did you handle it?

> Ideally, we would need a single token to be generated per e-mail being sent

> so that we can define the expiration of said token, but it seems like

> there's no other solution than to overwrite and redefine everything, what I

> would prefer to avoid to ease maintenance of such a module. Thanks for

> sharing your insights.

are you aware of the poisoning the cache technique?

you can do things like

def _notify_get_groups(self, msg_vals=None):
     self._cache['access_token'] = 'whatever you need for your workflow'
     return super()._notify_get_groups(msg_vals=msg_vals)

and given super won't initiate a new database read, it will stick with 
whatever you put in the cache, as that's where the ORM reads values from first.

I read through your whole thing because I'm a weird kind of nerd, for other 
people to read it I suggest to start with a TLDR on the beginning so that 
people can filter if they're interested or not.


-- 
Your partner for the hard Odoo problems
https://hunki-enterprises.com

Reference