From 97058203340e77ecbb236dbc64aed703cabc2dc3 Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Wed, 15 Dec 2021 11:58:47 +0000 Subject: [PATCH] [IMP] mail: properly pluralize x2many fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Go through all the x2many javascript models fields and make their name plural when needed. closes odoo/odoo#81467 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/attachment/attachment.js | 2 +- .../mail/static/src/models/attachment_list/attachment_list.js | 2 +- .../static/src/models/attachment_viewer/attachment_viewer.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mail/static/src/models/attachment/attachment.js b/addons/mail/static/src/models/attachment/attachment.js index b25a254fbc0..58763f29661 100644 --- a/addons/mail/static/src/models/attachment/attachment.js +++ b/addons/mail/static/src/models/attachment/attachment.js @@ -299,7 +299,7 @@ registerModel({ attachmentLists: many2many('AttachmentList', { inverse: 'attachments', }), - attachmentViewer: many2many('AttachmentViewer', { + attachmentViewers: many2many('AttachmentViewer', { inverse: 'attachments', }), checksum: attr(), diff --git a/addons/mail/static/src/models/attachment_list/attachment_list.js b/addons/mail/static/src/models/attachment_list/attachment_list.js index 10df15719d8..c8194f12881 100644 --- a/addons/mail/static/src/models/attachment_list/attachment_list.js +++ b/addons/mail/static/src/models/attachment_list/attachment_list.js @@ -83,7 +83,7 @@ registerModel({ /** * Determines the attachment viewers displaying this attachment list (if any). */ - attachmentViewer: one2many('AttachmentViewer', { + attachmentViewers: one2many('AttachmentViewer', { inverse: 'attachmentList', isCausal: true, }), diff --git a/addons/mail/static/src/models/attachment_viewer/attachment_viewer.js b/addons/mail/static/src/models/attachment_viewer/attachment_viewer.js index f4ea2429a19..35b691cf01e 100644 --- a/addons/mail/static/src/models/attachment_viewer/attachment_viewer.js +++ b/addons/mail/static/src/models/attachment_viewer/attachment_viewer.js @@ -40,12 +40,12 @@ registerModel({ }), attachment: many2one('mail.attachment'), attachmentList: many2one('AttachmentList', { - inverse: 'attachmentViewer', + inverse: 'attachmentViewers', readonly: true, required: true, }), attachments: many2many('mail.attachment', { - inverse: 'attachmentViewer', + inverse: 'attachmentViewers', related: 'attachmentList.viewableAttachments', }), /**