[MOV] hr_org_chart,web_hierarchy: move hierarchy view in its own module
This commit moves the generic code of hierarchy view into new module called `web_hierarchy` to be able to use it outside the hr scope. task-3376776
This commit is contained in:
@@ -13,8 +13,8 @@ Org Chart Widget for HR
|
||||
This module extend the employee form with a organizational chart.
|
||||
(N+1, N+2, direct subordinates)
|
||||
""",
|
||||
'depends': ['hr'],
|
||||
'auto_install': True,
|
||||
'depends': ['hr', 'web_hierarchy'],
|
||||
'auto_install': ['hr'],
|
||||
'data': [
|
||||
'views/hr_department_views.xml',
|
||||
'views/hr_views.xml',
|
||||
@@ -26,13 +26,9 @@ This module extend the employee form with a organizational chart.
|
||||
'hr_org_chart/static/src/scss/variables.scss',
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'hr_org_chart/static/src/scss/hierarchy.variables.scss',
|
||||
'hr_org_chart/static/src/fields/*',
|
||||
'hr_org_chart/static/src/views/**/*',
|
||||
],
|
||||
'web.assets_web_dark': [
|
||||
('before', 'hr_org_chart/static/src/scss/hierarchy.variables.scss', 'hr_org_chart/static/src/scss/**/*.variables.dark.scss'),
|
||||
],
|
||||
'web.qunit_suite_tests': [
|
||||
'hr_org_chart/static/tests/**/*',
|
||||
],
|
||||
|
||||
@@ -3,6 +3,3 @@
|
||||
|
||||
from . import hr_org_chart_mixin
|
||||
from . import hr_employee
|
||||
from . import ir_actions
|
||||
from . import ir_ui_view
|
||||
from . import models
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Avatar } from "@mail/views/web/fields/avatar/avatar";
|
||||
|
||||
import { HierarchyRenderer } from "../hierarchy/hierarchy_renderer";
|
||||
import { HierarchyRenderer } from "@web_hierarchy/hierarchy_renderer";
|
||||
|
||||
export class HrEmployeeHierarchyRenderer extends HierarchyRenderer {
|
||||
static template = "hr_org_chart.HrEmployeeHierarchyRenderer";
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<templates>
|
||||
|
||||
<t t-name="hr_org_chart.HrEmployeeHierarchyRenderer" t-inherit="hr_org_chart.HierarchyRenderer">
|
||||
<t t-name="hr_org_chart.HrEmployeeHierarchyRenderer" t-inherit="web_hierarchy.HierarchyRenderer">
|
||||
<xpath expr="//div[hasclass('o_hierarchy_parent_node_container')]/span" position="replace">
|
||||
<Avatar
|
||||
resModel="row.parentNode.model.resModel"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { hierarchyView } from "../hierarchy/hierarchy_view";
|
||||
import { hierarchyView } from "@web_hierarchy/hierarchy_view";
|
||||
import { HrEmployeeHierarchyRenderer } from "./hr_employee_hierarchy_renderer";
|
||||
|
||||
export const hrEmployeeHierarchyView = {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
@@ -0,0 +1,29 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Web Hierarchy',
|
||||
'category': 'Hidden',
|
||||
'version': '1.0',
|
||||
'description':
|
||||
"""
|
||||
Odoo Web Hierarchy view
|
||||
=======================
|
||||
|
||||
This module adds a new view called to be able to define a view to display
|
||||
an organization such as an Organization Chart for employees for instance.
|
||||
""",
|
||||
'depends': ['web'],
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
'web_hierarchy/static/src/hierarchy.variables.scss',
|
||||
'web_hierarchy/static/src/**/*',
|
||||
],
|
||||
'web.assets_web_dark': [
|
||||
('before', 'web_hierarchy/static/src/hierarchy.variables.scss', 'web_hierarchy/static/src/**/*.variables.dark.scss'),
|
||||
],
|
||||
'web.qunit_suite_tests': [
|
||||
'web_hierarchy/static/tests/**/*',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import ir_actions
|
||||
from . import ir_ui_view
|
||||
from . import models
|
||||
+1
-1
@@ -26,7 +26,7 @@ export class HierarchyCard extends Component {
|
||||
static defaultProps = {
|
||||
classNames: "",
|
||||
};
|
||||
static template = "hr_org_chart.HierarchyCard";
|
||||
static template = "web_hierarchy.HierarchyCard";
|
||||
static Compiler = HierarchyCompiler;
|
||||
|
||||
setup() {
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<templates>
|
||||
|
||||
<t t-name="hr_org_chart.HierarchyCard">
|
||||
<t t-name="web_hierarchy.HierarchyCard">
|
||||
<div class="o_hierarchy_node_container mb-4 d-flex flex-column" t-att-class="classNames" t-att-data-node-id="props.node.id">
|
||||
<div class="o_hierarchy_node_button_container w-100 d-flex justify-content-end">
|
||||
<button t-if="props.node.parentResId !== false and !props.node.parentNode"
|
||||
+1
-1
@@ -25,7 +25,7 @@ export class HierarchyController extends Component {
|
||||
buttonTemplate: String,
|
||||
archInfo: Object,
|
||||
};
|
||||
static template = "hr_org_chart.HierarchyView";
|
||||
static template = "web_hierarchy.HierarchyView";
|
||||
|
||||
setup() {
|
||||
this.rootRef = useRef("root");
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<templates>
|
||||
<t t-name="hr_org_chart.HierarchyButtons" owl="1">
|
||||
<t t-name="web_hierarchy.HierarchyButtons" owl="1">
|
||||
<div class="d-flex o_grid_buttons">
|
||||
<div class="me-2" t-if="props.archInfo.activeActions.create and (!props.archInfo.createInline or displayNoContent)">
|
||||
<button class="btn btn-primary o_hierarchy_button_add"
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="hr_org_chart.HierarchyView" owl="1">
|
||||
<t t-name="web_hierarchy.HierarchyView" owl="1">
|
||||
<div t-attf-class="o_hierarchy_view {{ isMobile ? 'o_action_delegate_scroll' : '' }} {{ props.className }}" t-ref="root">
|
||||
<Layout className="(model.useSampleModel ? 'o_view_sample_data' : '') + ' d-flex'" display="props.display">
|
||||
<t t-set-slot="control-panel-additional-actions">
|
||||
+2
-2
@@ -7,7 +7,7 @@ import { useService } from "@web/core/utils/hooks";
|
||||
import { scrollTo } from "@web/core/utils/scrolling";
|
||||
|
||||
import { HierarchyCard } from "./hierarchy_card";
|
||||
import { useHierarchyNodeDraggable } from "../../hooks/hierarchy_node_draggable";
|
||||
import { useHierarchyNodeDraggable } from "./hierarchy_node_draggable";
|
||||
|
||||
export class HierarchyRenderer extends Component {
|
||||
static components = {
|
||||
@@ -19,7 +19,7 @@ export class HierarchyRenderer extends Component {
|
||||
archInfo: Object,
|
||||
templates: Object,
|
||||
};
|
||||
static template = "hr_org_chart.HierarchyRenderer";
|
||||
static template = "web_hierarchy.HierarchyRenderer";
|
||||
|
||||
setup() {
|
||||
this.rendererRef = useRef("renderer");
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<templates>
|
||||
|
||||
<t t-name="hr_org_chart.HierarchyRenderer" owl="1">
|
||||
<t t-name="web_hierarchy.HierarchyRenderer" owl="1">
|
||||
<div class="o_hierarchy_renderer w-100 d-flex justify-content-center" t-ref="renderer">
|
||||
<div class="o_hierarchy_container d-flex flex-column w-100 w-lg-75 h-100 pt-5 px-2">
|
||||
<t t-foreach="rows" t-as="row" t-key="row_index">
|
||||
+1
-1
@@ -17,7 +17,7 @@ export const hierarchyView = {
|
||||
Controller: HierarchyController,
|
||||
Model: HierarchyModel,
|
||||
Renderer: HierarchyRenderer,
|
||||
buttonTemplate: "hr_org_chart.HierarchyButtons",
|
||||
buttonTemplate: "web_hierarchy.HierarchyButtons",
|
||||
searchMenuTypes: [],
|
||||
|
||||
props: (genericProps, view) => {
|
||||
Reference in New Issue
Block a user