closes odoo/odoo#105677 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
63 lines
1.2 KiB
JavaScript
63 lines
1.2 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { attr, many, one, Model } from "@mail/model";
|
|
|
|
Model({
|
|
name: "TestAddress",
|
|
fields: {
|
|
id: attr({
|
|
identifying: true,
|
|
}),
|
|
addressInfo: attr(),
|
|
contact: one("TestContact", {
|
|
inverse: "address",
|
|
}),
|
|
},
|
|
});
|
|
|
|
Model({
|
|
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",
|
|
}),
|
|
},
|
|
});
|
|
|
|
Model({
|
|
name: "TestHobby",
|
|
fields: {
|
|
description: attr({
|
|
identifying: true,
|
|
}),
|
|
},
|
|
});
|
|
|
|
Model({
|
|
name: "TestTask",
|
|
fields: {
|
|
id: attr({
|
|
identifying: true,
|
|
}),
|
|
title: attr(),
|
|
difficulty: attr({
|
|
default: 1,
|
|
}),
|
|
responsible: one("TestContact", {
|
|
inverse: "tasks",
|
|
}),
|
|
},
|
|
});
|