From b2d2b78fbcde879994ed1a2af978f58cc599d6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Wed, 15 Dec 2021 13:52:45 +0000 Subject: [PATCH] [IMP] mail: rename user model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename javascript model mail.user to User in order to distinguish javascript models from python models. Task-2701674 closes odoo/odoo#81471 Signed-off-by: Sébastien Theys (seb) --- addons/hr/static/src/models/employee/employee.js | 2 +- addons/hr/static/src/models/user/user.js | 2 +- addons/mail/static/src/models/activity/activity.js | 4 ++-- addons/mail/static/src/models/messaging/messaging.js | 6 +++--- addons/mail/static/src/models/partner/partner.js | 2 +- addons/mail/static/src/models/thread/thread.js | 2 +- addons/mail/static/src/models/user/user.js | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/hr/static/src/models/employee/employee.js b/addons/hr/static/src/models/employee/employee.js index 90cae7b329c..461ba3362fc 100644 --- a/addons/hr/static/src/models/employee/employee.js +++ b/addons/hr/static/src/models/employee/employee.js @@ -168,7 +168,7 @@ registerModel({ /** * User related to this employee. */ - user: one2one('mail.user', { + user: one2one('User', { inverse: 'employee', }), }, diff --git a/addons/hr/static/src/models/user/user.js b/addons/hr/static/src/models/user/user.js index f7f29cfdef7..423adafbf31 100644 --- a/addons/hr/static/src/models/user/user.js +++ b/addons/hr/static/src/models/user/user.js @@ -5,7 +5,7 @@ import { one2one } from '@mail/model/model_field'; // ensure that the model definition is loaded before the patch import '@mail/models/user/user'; -addFields('mail.user', { +addFields('User', { /** * Employee related to this user. */ diff --git a/addons/mail/static/src/models/activity/activity.js b/addons/mail/static/src/models/activity/activity.js index c65b9fe9035..e502f685b79 100644 --- a/addons/mail/static/src/models/activity/activity.js +++ b/addons/mail/static/src/models/activity/activity.js @@ -232,7 +232,7 @@ registerModel({ }, }, fields: { - assignee: many2one('mail.user'), + assignee: many2one('User'), attachments: many2many('mail.attachment', { inverse: 'activities', }), @@ -240,7 +240,7 @@ registerModel({ default: false, }), category: attr(), - creator: many2one('mail.user'), + creator: many2one('User'), dateCreate: attr(), dateDeadline: attr(), /** diff --git a/addons/mail/static/src/models/messaging/messaging.js b/addons/mail/static/src/models/messaging/messaging.js index 11f0766db4d..e56a1991940 100644 --- a/addons/mail/static/src/models/messaging/messaging.js +++ b/addons/mail/static/src/models/messaging/messaging.js @@ -49,7 +49,7 @@ registerModel({ */ async getChat({ partnerId, userId }) { if (userId) { - const user = this.messaging.models['mail.user'].insert({ id: userId }); + const user = this.messaging.models['User'].insert({ id: userId }); return user.getChat(); } if (partnerId) { @@ -110,7 +110,7 @@ registerModel({ return partner.openProfile(); } if (model === 'res.users') { - const user = this.messaging.models['mail.user'].insert({ id }); + const user = this.messaging.models['User'].insert({ id }); return user.openProfile(); } if (model === 'mail.channel') { @@ -242,7 +242,7 @@ registerModel({ companyName: attr(), currentGuest: one2one('Guest'), currentPartner: one2one('Partner'), - currentUser: one2one('mail.user'), + currentUser: one2one('User'), device: one2one('Device', { default: insertAndReplace(), isCausal: true, diff --git a/addons/mail/static/src/models/partner/partner.js b/addons/mail/static/src/models/partner/partner.js index 5feddec5ea5..7f024a436bb 100644 --- a/addons/mail/static/src/models/partner/partner.js +++ b/addons/mail/static/src/models/partner/partner.js @@ -453,7 +453,7 @@ registerModel({ rtcSessions: one2many('RtcSession', { inverse: 'partner', }), - user: one2one('mail.user', { + user: one2one('User', { inverse: 'partner', }), volumeSetting: one2one('mail.volume_setting', { diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 2b8eb1a47cb..59f2f0a7262 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -1962,7 +1962,7 @@ registerModel({ counter: attr({ default: 0, }), - creator: many2one('mail.user'), + creator: many2one('User'), custom_channel_name: attr(), /** * Determines the default display mode of this channel. Should contain diff --git a/addons/mail/static/src/models/user/user.js b/addons/mail/static/src/models/user/user.js index 77f3304c7a5..a037586dc9d 100644 --- a/addons/mail/static/src/models/user/user.js +++ b/addons/mail/static/src/models/user/user.js @@ -5,7 +5,7 @@ import { attr, one2one } from '@mail/model/model_field'; import { insert, unlink } from '@mail/model/model_field_command'; registerModel({ - name: 'mail.user', + name: 'User', identifyingFields: ['id'], modelMethods: { /** @@ -49,8 +49,8 @@ registerModel({ fields, }, }, { shadow: true }); - return this.messaging.models['mail.user'].insert(usersData.map(userData => - this.messaging.models['mail.user'].convertData(userData) + return this.messaging.models['User'].insert(usersData.map(userData => + this.messaging.models['User'].convertData(userData) )); }, }, @@ -59,7 +59,7 @@ registerModel({ * Fetches the partner of this user. */ async fetchPartner() { - return this.messaging.models['mail.user'].performRpcRead({ + return this.messaging.models['User'].performRpcRead({ ids: [this.id], fields: ['partner_id'], context: { active_test: false },