New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] hr, hr_org_chart: allow recursive hierarchy, employees can appear multiple times in the org chart #27900

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@Musvol

Musvol commented Oct 17, 2018

Purpose

Allow recursive hierarchy (an employee can be its own manager; e.g. the CEO is manager of everyone
but is also member of a department managed by the CTO who is himself managed by the CEO).
This means an employee might appear in multiple place in the organisational chart.

The button to see more of the hierarchy in the organisation chart opens all employees under the N+2 of the
current employee being displayed but does not open the view of the N+2. It onl

Specification

Add 'subordinates_ids' computed field on 'hr.employee' to get all subordinates (direct and indirect).

Task 1251

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo robodoo added the seen 🙂 label Oct 17, 2018

@C3POdoo C3POdoo added the RD label Oct 18, 2018

@tivisse

Quick and incomplete review. I'm gonna try it on next.odoo.com and will come back with new comments.

@@ -2,17 +2,48 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from copy import copy

This comment has been minimized.

@tivisse

tivisse Oct 18, 2018

Contributor

What is the usage ?

@@ -2,17 +2,48 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from copy import copy
from functools import reduce

This comment has been minimized.

@tivisse

tivisse Oct 18, 2018

Contributor

Seems like an useless import too. Do you use a linter ? pylinter on sublime-text is a good one btw.

}
// var domain = [['parent_id', '=', employee_id]];

This comment has been minimized.

@tivisse

tivisse Oct 18, 2018

Contributor

Commented code

@tivisse

Some more comments.

if not employee: # to check
return {}
if type == 'direct':

This comment has been minimized.

@tivisse

tivisse Oct 25, 2018

Contributor

Not a good practice to have a variable named type. Could you rename into something more explicit and less reserved ? :p

elif type == 'indirect':
return (employee.subordinate_ids - employee.child_ids).ids
else:
return employee.subordinate_ids.ids

This comment has been minimized.

@tivisse

tivisse Oct 25, 2018

Contributor

Linting issue. You could use a linter like pylint if you're using sublime-text for example.

@Musvol Musvol force-pushed the odoo-dev:master-hr-org-chart-lul branch 3 times, most recently from d5b929f to d13e0fb Oct 25, 2018

@robodoo robodoo added the CI 🤖 label Oct 30, 2018

[IMP] hr_org_chart: Allow recursion in hierarchy
Employees can appear multiple times in the org chart

Purpose
=======

Allow recursive hierarchy (an employee can be its own manager; e.g. the CEO is manager of everyone
but is also member of a department managed by the CTO who is himself managed by the CEO).
This means an employee might appear in multiple place in the organisational chart.

The button to see more of the hierarchy in the organisation chart opens all employees under the N+2 of the
current employee being displayed but does not open the view of the N+2.

Specification
=============

Add 'subordinates_ids' computed field on 'hr.employee' to get all subordinates (direct and indirect).

@tivisse tivisse force-pushed the odoo-dev:master-hr-org-chart-lul branch from d13e0fb to 9103982 Dec 6, 2018

@robodoo robodoo removed the CI 🤖 label Dec 6, 2018

@tivisse

This comment has been minimized.

Contributor

tivisse commented Dec 6, 2018

robodoo pushed a commit that referenced this pull request Dec 6, 2018

[IMP] hr_org_chart: Allow recursion in hierarchy
Employees can appear multiple times in the org chart

Purpose
=======

Allow recursive hierarchy (an employee can be its own manager; e.g. the CEO is manager of everyone
but is also member of a department managed by the CTO who is himself managed by the CEO).
This means an employee might appear in multiple place in the organisational chart.

The button to see more of the hierarchy in the organisation chart opens all employees under the N+2 of the
current employee being displayed but does not open the view of the N+2.

Specification
=============

Add 'subordinates_ids' computed field on 'hr.employee' to get all subordinates (direct and indirect).

closes #27900
@robodoo

This comment has been minimized.

Contributor

robodoo commented Dec 6, 2018

Merged, thanks!

@robodoo robodoo closed this Dec 6, 2018

@tivisse tivisse deleted the odoo-dev:master-hr-org-chart-lul branch Dec 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment