diff options
| author | Raphael Collet <rco@odoo.com> | 2020-12-02 08:57:08 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-12-02 11:44:20 +0000 |
| commit | baf32bbc177fe653ffc4ee4cd9c014c85910c8d2 (patch) | |
| tree | d1c8af3591025240e79e978c73f2888274947072 /odoo/fields.py | |
| parent | 26927417e2957acba6fb79446c2520107daa7eea (diff) | |
[FIX] core: document cache miss behavior in Field.__get__
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index e601dfc50d6..603e2a90a3e 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -948,6 +948,24 @@ class Field(MetaField('DummyField', (object,), {})): value = env.cache.get(record, self) except KeyError: + # behavior in case of cache miss: + # + # on a real record: + # stored -> fetch from database (computation done above) + # not stored and computed -> compute + # not stored and not computed -> default + # + # on a new record w/ origin: + # stored -> fetch from origin (computation done above) + # not stored and computed -> compute + # not stored and not computed -> default + # + # on a new record w/o origin: + # stored and computed -> compute + # stored and not computed -> new delegate or default + # not stored and computed -> compute + # not stored and not computed -> default + # if self.store and record.id: # real record: fetch from database recs = record._in_cache_without(self) |
