From c047c852082f7acd6fbe692e88294295bc0527c4 Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Fri, 18 Jun 2021 09:53:21 +0000 Subject: [PATCH] [FIX] base,web: fix display of images of contact's children upon change Scenario: - Go to Contacts - Open a contact - In "Contacts & Addresses" tab, add a child and configure its image - Once child form is saved, image of the child is not displayed in the kanban view used for children It will only appear once the main contact form is saved. The same issue occurs when editing a child image. The new image will only be shown once the main contact form is saved. The issue at the creation is due to the fact the function retrieving the URL of the image tries to generate the URL from record id, which is not set. It should use raw data of image in this case. For the edition, it is due to the fact that the child form is changing image_1920 field while the kanban view used for children is displaying image_128 field. image_128 is a related field to image_1920, but it does not appear in the child form. It is therefore not recomputed (by onchange) when image_1920 is modified. Adding it in the child form view solves the issue. opw-2516188 closes odoo/odoo#72375 X-original-commit: 7eac23573c77415c84cb9c234c8063d4c68be425 Signed-off-by: Anh Thao PHAM --- addons/web/static/src/js/views/kanban/kanban_record.js | 2 +- odoo/addons/base/views/res_partner_views.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/kanban/kanban_record.js b/addons/web/static/src/js/views/kanban/kanban_record.js index a217fc51b30..da81df9d89b 100644 --- a/addons/web/static/src/js/views/kanban/kanban_record.js +++ b/addons/web/static/src/js/views/kanban/kanban_record.js @@ -202,7 +202,7 @@ var KanbanRecord = Widget.extend(WidgetAdapterMixin, { * @returns {string} the url of the image */ _getImageURL: function (model, field, id, placeholder) { - id = (_.isArray(id) ? id[0] : id) || null; + id = (_.isArray(id) ? id[0] : id) || false; var isCurrentRecord = this.modelName === model && this.recordData.id === id; var url; if (isCurrentRecord && this.record[field] && this.record[field].raw_value && !utils.is_bin_size(this.record[field].raw_value)) { diff --git a/odoo/addons/base/views/res_partner_views.xml b/odoo/addons/base/views/res_partner_views.xml index 2c46256b6c4..ba052612d5a 100644 --- a/odoo/addons/base/views/res_partner_views.xml +++ b/odoo/addons/base/views/res_partner_views.xml @@ -333,6 +333,7 @@ +