bemade-addons/recursive_tree_view/static/src/list_renderer.js
Marc Durepos 6bab956a54 [ADD] recursive_tree_view: new module for hierarchical models
Allows the viewing of hierarchical models (i.e. parent-child
relationships) directly in a tree view. Simply add the recursive
attribute to the tree tag with `recursive="1"` or `recursive="true"` or
`recursive="True"`.

Parent-child field is autodetected from the model based on the
_parent_name field which is standard in the Odoo ORM.

Currently there is no option for expanding all children, but this may be
added in future versions.
2024-10-30 12:11:55 -04:00

19 lines
544 B
JavaScript

/** @odoo-module **/
import { ListRenderer } from '@web/views/list/list_renderer';
import { patch } from '@web/core/utils/patch';
import { useState } from '@odoo/owl';
patch(ListRenderer.prototype, {
setup() {
super.setup();
this.recursive = this.props.archInfo.recursive;
useState(this.props.list.records);
},
async _onExpandClick(ev) {
const $button = $(ev.currentTarget);
const parent = $button.data('expand');
this.env.bus.trigger("expand-collapse-parent", parent);
},
});