[IMP] hr_org_chart,web: extend kanban compiler for hierarchy view
This commit extends the kanban compiler for the hirarchy view. Some changes has been done in the kanban compiler to be able to reuse the existing code. task-3376776
This commit is contained in:
@@ -7,7 +7,7 @@ import { Record } from "@web/views/record";
|
||||
import { ViewButton } from "@web/views/view_button/view_button";
|
||||
import { useViewCompiler } from "@web/views/view_compiler";
|
||||
|
||||
import { OrgChartCompiler } from "./hierarchy_compiler";
|
||||
import { HierarchyCompiler } from "./hierarchy_compiler";
|
||||
import { getFormattedRecord } from "@web/views/kanban/kanban_record";
|
||||
|
||||
export class HierarchyCard extends Component {
|
||||
@@ -27,7 +27,7 @@ export class HierarchyCard extends Component {
|
||||
classNames: "",
|
||||
};
|
||||
static template = "hr_org_chart.HierarchyCard";
|
||||
static Compiler = OrgChartCompiler;
|
||||
static Compiler = HierarchyCompiler;
|
||||
|
||||
setup() {
|
||||
const { templates } = this.props;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { KanbanCompiler } from "@web/views/kanban/kanban_compiler";
|
||||
|
||||
export class HierarchyCompiler extends KanbanCompiler {
|
||||
/**
|
||||
* @override
|
||||
* @param {Element} el
|
||||
* @param {Object} params
|
||||
* @returns {Element}
|
||||
*/
|
||||
compileField(el, params) {
|
||||
const fieldName = el.getAttribute("name");
|
||||
return super.compileField(el, {
|
||||
...(params || {}),
|
||||
recordExpr: "__record__",
|
||||
dataPointId: "__comp__.props.node.id",
|
||||
formattedValueExpr: `record['${fieldName}'].value`,
|
||||
});
|
||||
}
|
||||
|
||||
compileButton(el, params) {
|
||||
return super.compileButton(el, {
|
||||
...(params || {}),
|
||||
recordExpr: "__record__",
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user