Files
odoo_source/addons/mail/static/tests/models/test_models.js
T
Louis Wicket (wil) b9fd435b99 [MOV] mail, *: move tests
* = hr_holidays, im_livechat, sms, snailmail, website_livechat,
    website_slides

Move tests files into `static/tests`.

Task-2759560

closes odoo/odoo#86581

Related: odoo/enterprise#25375
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-18 16:07:29 +01:00

76 lines
1.7 KiB
JavaScript

/** @odoo-module **/
import { registerModel } from '@mail/model/model_core';
import { attr, many, one } from '@mail/model/model_field';
import { insertAndReplace } from '@mail/model/model_field_command';
registerModel({
name: 'TestAddress',
identifyingFields: ['id'],
fields: {
id: attr({
readonly: true,
required: true,
}),
addressInfo: attr(),
contact: one('TestContact', {
inverse: 'address',
}),
},
});
registerModel({
name: 'TestContact',
identifyingFields: ['id'],
fields: {
id: attr({
readonly: true,
required: true,
}),
address: one('TestAddress', {
inverse: 'contact',
}),
favorite: one('TestHobby', {
default: insertAndReplace({ description: 'football' }),
}),
hobbies: many('TestHobby', {
default: insertAndReplace([
{ description: 'hiking' },
{ description: 'fishing' },
]),
}),
tasks: many('TestTask', {
inverse: 'responsible'
}),
},
});
registerModel({
name: 'TestHobby',
identifyingFields: ['description'],
fields: {
description: attr({
readonly: true,
required: true,
}),
},
});
registerModel({
name: 'TestTask',
identifyingFields: ['id'],
fields: {
id: attr({
readonly: true,
required: true,
}),
title: attr(),
difficulty: attr({
default: 1,
}),
responsible: one('TestContact', {
inverse: 'tasks'
}),
},
});