diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-29 18:38:55 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-29 18:38:55 +0100 |
| commit | f5c3dafb045f4eb5e832c45596dd59396667ea09 (patch) | |
| tree | 8265091d53c54dfa47e5a67f00e98cfda404ade2 /odoo/api.py | |
| parent | 5644ab53ab6f370a2fb48242e22702655afd6655 (diff) | |
| parent | c0eef4271110ebcab07811328a7b3f4309fb4d06 (diff) | |
[MERGE] forward port branch saas-11.3 up to c0eef427111
Diffstat (limited to 'odoo/api.py')
| -rw-r--r-- | odoo/api.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/odoo/api.py b/odoo/api.py index 22b82d17147..75d04ad21c3 100644 --- a/odoo/api.py +++ b/odoo/api.py @@ -1057,6 +1057,12 @@ class Cache(object): value = self._data[field][record.id].get(key, SpecialValue(None)) return default if isinstance(value, SpecialValue) else value + def get_special(self, record, field, default=None): + """ Return the special value of ``field`` for ``record``. """ + key = field.cache_key(record) + value = self._data[field][record.id].get(key) + return value.get if isinstance(value, SpecialValue) else default + def set_special(self, record, field, getter): """ Set the value of ``field`` for ``record`` to return ``getter()``. """ key = field.cache_key(record) |
