diff options
| author | David Beguin <dbe@odoo.com> | 2020-10-19 08:07:43 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-10-19 10:42:27 +0000 |
| commit | 7edf5ac5369549a44be6a3850ba468df305c387d (patch) | |
| tree | c7f37f850fd09338de3557f7a68e210edb3d9923 /doc/reference/javascript_reference.rst | |
| parent | 7058e338a980268df1c502b8b2860bdd8be9f727 (diff) | |
[FIX] base: do not search for attachment for related fields in _binary_record_content
Use case: website_event_track(_online)
======================================
On sponsor model, image_128 field is defined in website_event_track module as
computed stored Image field. It means that when this binary field is set, an
attachment is created in ir.attachment model -> attachment is set to True.
In website_event_track_online module this field is modified. It is set as
a related (resized) version of image_512 and not stored anymore.
However attachments still exist in ir.attachment table for sponsor records.
This is not an issue when trying to access the image_128 field using the ORM
as the compute (or related) is correctly called. However '/web/image' does
checks if the field has an attachment and loads it. In our case old attachments
still in database are therefore displayed instead of the new related image.
Fix
===
When checking for an existing attachment in _binary_record_content we also
check that the field is not a related. This fixes the current issue. It also
makes _binary_record_content work as the ORM, aka using the computed value
and not any stored information.
DB Cleaning
===========
In 14.0 a script will be added to clean existing attachments for sponsor
model. Indeed there is no need to keep unused attachments. Especially in
14 website_event_track_online has been merged in website_event_track, meaning
only existing db have to be cleaned. New DBs will never have this attachment
issue as the field is always computed.
Task ID: 2341108
closes odoo/odoo#60252
X-original-commit: ada1eab338c6cffb526b03377ec01962f9c26c4c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'doc/reference/javascript_reference.rst')
0 files changed, 0 insertions, 0 deletions
