[FIX] web, x2ManyField: allowed to not have an arch set

In which case we just don't render any Renderer.
Useful when we want to render invisible fields.

X-original-commit: e77afa6266a66e9d126d9a0293bb3e0eb8fb0ff3
Part-of: odoo/odoo#102153
This commit is contained in:
Lucas Perais
2022-10-04 20:57:58 +02:00
parent 9c375b48fa
commit 36385e736d
3 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ Field.parseFieldNode = function (node, models, modelName, viewType, jsClass) {
viewMode = "list";
} else if (!views.list && views.kanban) {
viewMode = "kanban";
} else {
} else if (views.list && views.kanban) {
viewMode = "list,kanban";
}
} else {
@@ -35,7 +35,12 @@ export class X2ManyField extends Component {
this.isMany2Many
);
const archInfo = this.activeField.views[this.viewMode];
let archInfo;
if (this.viewMode) {
archInfo = this.activeField.views[this.viewMode];
} else {
archInfo = {};
}
const subViewActiveActions = archInfo.activeActions;
this.activeActions = useActiveActions({
crudOptions: Object.assign({}, this.activeField.options, {
@@ -18,7 +18,7 @@
</div>
</div>
<ListRenderer t-if="viewMode === 'list'" t-props="rendererProps" />
<KanbanRenderer t-else="" t-props="rendererProps" />
<KanbanRenderer t-elif="viewMode" t-props="rendererProps" />
</div>
</t>