Files
odoo_source/addons/mail/static/tests/models/test_models.js
T
Sébastien Theys 34d775e873 [IMP] mail, *: remove explicit usage of insert-and-replace
* = calendar, im_livechat, rating, snailmail, test_discuss_full, test_mail,
    website_livechat

Distinction between "replace" and "insert-and-replace" can be guessed based on
the type of the provided data.

task-2957295

closes odoo/odoo#98404

Related: odoo/enterprise#30580
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-08-19 11:53:05 +02:00

67 lines
1.3 KiB
JavaScript

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