From a3c7a06dc3981207adcb4d1ae19d0b2f2e38d72d Mon Sep 17 00:00:00 2001 From: Brice bib Bartoletti Date: Wed, 10 Aug 2022 11:37:35 +0000 Subject: [PATCH] [REF] mail: remove account.move.line hack While refactoring the move_line_list_views.js in owl, we provided the account.move id and model + "generate" a thread in the front-end for account.move.line instead of only providing account.move.line model and id. This allows us to get rid of this hacky special case Task-id: 2857743 Part-of: odoo/odoo#96672 --- addons/account/views/account_move_views.xml | 1 + addons/mail/static/src/models/thread.js | 4 ---- .../static/src/models/web_client_view_attachment_view.js | 5 ----- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 2340892218c..6b3b9768a01 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -189,6 +189,7 @@ + diff --git a/addons/mail/static/src/models/thread.js b/addons/mail/static/src/models/thread.js index 99fa52d3b0c..bb7a76c3748 100644 --- a/addons/mail/static/src/models/thread.js +++ b/addons/mail/static/src/models/thread.js @@ -949,10 +949,6 @@ registerModel({ */ async setMainAttachment(attachment) { this.update({ mainAttachment: attachment }); - if (this.model === 'account.move.line') { - // account.move.line is not actually a thread in python - return; - } await this.messaging.rpc({ model: 'ir.attachment', method: 'register_as_main_attachment', diff --git a/addons/mail/static/src/models/web_client_view_attachment_view.js b/addons/mail/static/src/models/web_client_view_attachment_view.js index 0c6db5f6aa9..41deb1f9b2a 100644 --- a/addons/mail/static/src/models/web_client_view_attachment_view.js +++ b/addons/mail/static/src/models/web_client_view_attachment_view.js @@ -37,11 +37,6 @@ registerModel({ * @private */ _onChangeThreadAttachmentsInWebClientView() { - if (this.thread.model === 'account.move.line') { - // account.move.line is not actually a thread in python - this.setMainAttachmentFromIndex(0); - return; - } if ( this.thread.areAttachmentsLoaded && !this.thread.isLoadingAttachments &&