[IMP] hr: rename employee model

Rename javascript model 'hr.employee' to 'Employee' in order to
distinguish javascript model from python model.

Part of task-2701674.

closes odoo/odoo#80561

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Louis Wicket (wil)
2021-12-15 11:11:51 +00:00
parent b63901b41d
commit 5ce76d3af8
4 changed files with 11 additions and 11 deletions
@@ -5,7 +5,7 @@ import { attr, one2one } from '@mail/model/model_field';
import { insert, unlink } from '@mail/model/model_field_command';
registerModel({
name: 'hr.employee',
name: 'Employee',
identifyingFields: ['id'],
modelMethods: {
/**
@@ -56,8 +56,8 @@ registerModel({
fields,
},
});
this.messaging.models['hr.employee'].insert(employeesData.map(employeeData =>
this.messaging.models['hr.employee'].convertData(employeeData)
this.messaging.models['Employee'].insert(employeesData.map(employeeData =>
this.messaging.models['Employee'].convertData(employeeData)
));
},
/**
@@ -78,8 +78,8 @@ registerModel({
fields,
},
});
this.messaging.models['hr.employee'].insert(employeesData.map(employeeData =>
this.messaging.models['hr.employee'].convertData(employeeData)
this.messaging.models['Employee'].insert(employeesData.map(employeeData =>
this.messaging.models['Employee'].convertData(employeeData)
));
},
},
@@ -89,7 +89,7 @@ registerModel({
* them if applicable.
*/
async checkIsUser() {
return this.messaging.models['hr.employee'].performRpcRead({
return this.messaging.models['Employee'].performRpcRead({
ids: [this.id],
fields: ['user_id', 'user_partner_id'],
context: { active_test: false },
@@ -11,7 +11,7 @@ patchRecordMethods('Messaging', {
*/
async getChat({ employeeId }) {
if (employeeId) {
const employee = this.messaging.models['hr.employee'].insert({ id: employeeId });
const employee = this.messaging.models['Employee'].insert({ id: employeeId });
return employee.getChat();
}
return this._super(...arguments);
@@ -21,7 +21,7 @@ patchRecordMethods('Messaging', {
*/
async openProfile({ id, model }) {
if (model === 'hr.employee' || model === 'hr.employee.public') {
const employee = this.messaging.models['hr.employee'].insert({ id });
const employee = this.messaging.models['Employee'].insert({ id });
return employee.openProfile();
}
return this._super(...arguments);
@@ -11,7 +11,7 @@ addRecordMethods('mail.partner', {
* applicable.
*/
async checkIsEmployee() {
await this.async(() => this.messaging.models['hr.employee'].performRpcSearchRead({
await this.async(() => this.messaging.models['Employee'].performRpcSearchRead({
context: { active_test: false },
domain: [['user_partner_id', '=', this.id]],
fields: ['user_id', 'user_partner_id'],
@@ -45,7 +45,7 @@ addFields('mail.partner', {
* Employee related to this partner. It is computed through
* the inverse relation and should be considered read-only.
*/
employee: one2one('hr.employee', {
employee: one2one('Employee', {
inverse: 'partner',
}),
/**
+1 -1
View File
@@ -9,7 +9,7 @@ addFields('mail.user', {
/**
* Employee related to this user.
*/
employee: one2one('hr.employee', {
employee: one2one('Employee', {
inverse: 'user',
}),
});