The attributes field.depends and field.depends_context are problematic
for sharing fields across registries, because they depend on the model's
registry class, which may vary from one registry to another. In order
to make computed fields shareable, we have to move those values away
from fields.
For the same reason, field.recursive should not be inferred, because its
value may depend on the registry, although it is generally not the case.
Moreover, the flag recursive=True is set on a field when field triggers
are determined (on the registry). A compute method may be called before
the flag is set (if no update has been done yet), and that can lead to
incorrect computations.
This happened in test TestUsers2.test_reified_groups in module 'base'.
The user groups view was apparently determined without the flag being
set, and the view depends on the recursive field 'trans_implied_ids',
which was not correctly computed.
We thus force developers to be explicit about recursive computed fields.
The code now logs a warning when the flag is not set up properly.
Before this commit:
When loading a employee form, a write is done due to hr_org_chart
After this commit:
No write should be performed
closesodoo/odoo#42214
Taskid: 2150314
X-original-commit: 6e150ee19bb1f42c14d13218114ae9afbb84ebf4
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
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).
closesodoo/odoo#27900
This commit introduces a new widget specific to employees. It is used
to display an org chart centered on the current displayed employee.
Two levels of managers as well as subordinates are displayed.
It is contained in its own module and its installation is available from
hr settings.
Thanks to Stefano Rigano <sri@odoo.com> (@stefanorigano) for design and UX
implementation.