Commit Graph
166282 Commits
Author SHA1 Message Date
Andrea Grazioso (agr-odoo) ce8ffec2f9 [FIX] account_edi_ubl_cii: traceback on billed_qty 0
Try to Upload a Vendor Bill xml having an invoice line
with billed_qty 0

Issue: Traceback caused by ZeroDivisionError

opw-3497841

closes odoo/odoo#138843

X-original-commit: 0b3387390539e7379f1794c16f8ebf59fd4af9f8
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
2023-10-17 03:27:53 +00:00
Adrien Minne (adrm) e0b739168d [FIX] spreadsheet: wrong datasource in pivot side panel
When the side panel of a pivot is opened while the side panel of
another pivot is already open, the datasource of the first pivot is
used instead of the datasource of the second pivot. This can lead to
tracebacks, or to wrong data being displayed.

closes odoo/odoo#138338

Task: 3463289
X-original-commit: b6df2d807f7ffe0f0f89d894307e31d779f138e2
Related: odoo/enterprise#48775
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Adrien Minne (adrm) <adrm@odoo.com>
2023-10-17 01:48:08 +00:00
Guillaume (gdi) 99f37d47af [IMP] website: prevent text generation issues with foreign languages
This commit permits to check if the text theme is translated before
asking IAP for a text generation. We need the text to already be in the
target language to be able to generate the text in the target language.

task-3248852

closes odoo/odoo#136937

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-10-17 00:35:05 +00:00
Daniel Kosky (dako) 78192c45c0 [IMP] account_peppol: demo mode
This commit implements a demo mode in which a user can register to
peppol. The demo user performs no communication with the proxy server,
instead making and receiving only mocked calls and responses.

The @handle_demo decorator is added and utilised in order to avoid
adding the specific (and mostly irrelevant) branches of this of demo
functionality to the body of the code. When the edi_user has the
edi_mode 'demo' this decorator diverts the execution of the
function (excepting when running tests, whenupon it is ignored).

Specific logic is added to the res config settings in order to specify
which modes are availble to the current user based on the
"account_peppol.mode_constraint" config param, and the
"saas_trail.confirmation_token" config param. This allows us to default
users using runbot/demo-data/saas-trial databases to "demo" mode
registration.

task-id: 3497466
         3497725

closes odoo/odoo#136909

Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-10-17 00:35:05 +00:00
hupo-odoo 06f756e993 [IMP] l10n_lu: translation of account groups
Adds the translation in French en German of account groups of l10n_lu localization.

task-3497904

closes odoo/odoo#138809

X-original-commit: 3770c062cae0b869ab4e096d33c931911cab34fd
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Hugo Poncelet (hupo) <hupo@odoo.com>
2023-10-16 17:20:44 +00:00
Brieuc-brd f9c1b61009 [IMP] payment_custom, *: update backend icons
Impacted modules: payment_custom, website_sale_picking

task-3514428

closes odoo/odoo#138566

X-original-commit: 22dea2254ada84e501c47c806bad9182242db67d
Related: odoo/enterprise#48889
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-16 17:20:42 +00:00
Antoine Boonen 026205a637 [IMP] account_peppol: Add actions on dashboard for peppol operations
Problem
---------
User want to verify (when he want) if he has bills on Peppol and the
status of his customer invoices. Currently, the only option is wait for
a cron that runs twice a day.

Objective
---------
- Add a button in the Kanban card of the customer invoices that updates
the status of invoice send by Peppol. 
- Add a button in the Kanban card of the incoming journal that fetches
received bills on the Peppol network.

Solution
---------
This commits does several things in order to achieve the objective:
- Seperate the peppol cron function into business action and cron
function
- Add an interface on the journals so that they can call the peppol
business functions
- Add an inverse function that resets the journal `is_peppol_journal` to
False and sets that field to True on the relevant journal.
- Add a related field that checks whether the company has peppol active
- Add the buttons on the Kandan Dashboard view that call the relevant
cron function thanks to the interface. It edi users on the target
companies so that only the target companies are updated when a button is
pressed and not all companies.

task-3531222

closes odoo/odoo#137840

Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-10-16 17:20:41 +00:00
tinnguyentg 1aefc70595 [CLA] Created tinnguyentg CLA
closes odoo/odoo#138793

X-original-commit: 43dabcdb88e6598b0be7551d57c3eba2c76dd5eb
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-10-16 13:11:17 +00:00
Adnan Saiyed 9334cb922f [FIX] web_editor: enter should be caught by image editor
Current behaviour before commit:

When cropping an image, pressing ENTER creates new paragraph behind the
widget, due to this, changes are not getting applied on image and it disappears.

Desired behaviour after commit:

Now hitting ENTER works same as apply button, Changes are getting applied
when pressing ENTER.

task-3383447

closes odoo/odoo#138789

X-original-commit: add0d782fceebb84285a5f16952b852a29cf5a10
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-10-16 13:11:16 +00:00
mano-odoo 2495bfa725 [FIX] web: kanban card focus outline bottom
The kanban card do not display their outline on the bottom side of the
card. This is due to a negative margin (used to compensate for the
border bottom of the card).

This commit removes the border top if the kanban_record as a prior
kanban_record sibling, using its sibling border_bottom as its border
top and getting rid of the negative margin.

task-3488451

closes odoo/odoo#138772

X-original-commit: bf89d4ec951c77f5c7a01ccbad5edf0f7110f706
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-16 13:11:15 +00:00
hupo-odoo 87e3490f6e [IMP] l10n_co: add cash difference gain/loss accounts
Adds 2 accounts in the Chart of Accounts for l10n_co for the cash difference gains and losses and set them as default accounts.

task-3546441

closes odoo/odoo#138198

Related: odoo/enterprise#48683
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-10-16 13:11:10 +00:00
Serge Bayet (seba) c584fa8de0 [FIX] web: correct the tiktok font url
This updates the relative url of the 'woff' font that was
one parent too far. Bug introduced in [1]

[1]: https://github.com/odoo/odoo/commit/47c5a092196054359d82edbc79dea0caf213dd9f

task-3477965

closes odoo/odoo#137710

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-10-16 13:11:09 +00:00
Loukas Wets (lowe) 3764cef64a [FIX] point_of_sale,pos_restaurant: load data on new pos config
In this commit 2 issues are fixed. The first issue is when trying to load
demo data when the default pos configs are deleted. The second is when trying to
reload onboarding data when the products are already loaded but archived
(task-3539455).

steps to reproduce the first issue:
- load db without demo data
- delete pos created by default
- create a new pos config
- open and try to load demo data

steps to reproduce the second issue:
- load db without demo data
- open pos and load demo data
- archive products
- open pos and try to load demo data

changes:
- main pos config demo data has been separated from onboarding data.
- condition has been added in the search count of _pos_has_valid_product
method to check for archived products.

closes odoo/odoo#138035

Related: odoo/enterprise#48621
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-10-16 12:00:04 +00:00
tsm-odoo 633e031aa8 [FIX] im_livechat: error when loading a page with outdated guest
This PR fixes two issues:
- Incorrect write on `channel_member_ids` (trying to link guest instead
of channel member)
- Incorrect condition in  `livechatService.leaveSession` that relies on
the live chat to be initialized while it can acutally be called before
if the current session is outdated.

This could result in server errors in the following scenario:
- Open a live chat
- Log in
- Open a live chat from the website app
- Log out
- Reload the page

closes odoo/odoo#137834

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-10-16 12:00:02 +00:00
tsm-odoo 74cc99f72c [FIX] im_livechat: error when loading a page with outdated guest
This PR fixes two issues:
- Incorrect write on `channel_member_ids` (trying to link guest instead
of channel member)
- Incorrect condition in  `livechatService.leaveSession` that relies on
the live chat to be initialized while it can acutally be called before
if the current session is outdated.

This could result in server errors in the following scenario:
- Open a live chat
- Log in
- Open a live chat from the website app
- Log out
- Reload the page

Part-of: odoo/odoo#137834
2023-10-16 12:00:02 +00:00
Mélanie 33f7fdf5d5 [FIX] hr : remove -ing of working in settings
closes odoo/odoo#138738

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-10-16 10:40:00 +00:00
Nicolas Bayet ce36c49680 [FIX] web_editor: reconnect peers after when reconnecting internet
Prior to this commit, when the user experienced an internet
disconnection, after few seconds the PeerToPeer connection state would
change to "closed" and the PeerToPeer connection would be removed
permanently. Consequently, when the user reestablished their internet
connection, the peers would remain disconnected to each other.

With this commit, peers are now re-connecting to each other.

task-3488166

closes odoo/odoo#138510

X-original-commit: b9d96629df5adf37f362eb63107fa5a9a6cd3e0d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-10-16 10:39:57 +00:00
luvi cc0ca70428 [IMP] mail, web: call the installation prompt from the notification area
The NotificationItem component has been modified to support a new slot
allowing to display some content at the right of the notification item.
It is used in this commit to display an additional 'Install button',
inviting the user to click on the notification. Note that the entire
notification is still clickable, it is only a visual indicator.

Once the notification is clicked, the installation process is triggered:

- In case the system supports the native installation prompt, we now
display it, and the user is free to install the PWA from there.

- On Apple devices, a custom popup is displayed to the user, explaining
the steps to install the website as an application, since iOS and macOS
don't support a native prompt, and won't be using one anytime soon, since
it's a design decision from their side.

Some tests have been added to mock and test the display of the notification.
patchBrowserWithCleanup has been adapted to also remove any BeforeInstallPromptEvent
for every tests by default. This allows to test without the risk of issues with
messaging tests reading the number of notifications, or clicking the first
notification item when the service checks whether the prompt can be shown
or not (depending the availability of a native prompt, the OS, or the
localStorage, etc.).
To test the service correctly, you need to patch the test accordingly.

task-3275275

closes odoo/odoo#135866

Related: odoo/enterprise#48968
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-16 10:39:56 +00:00
Julien Mougenot 1c56280382 [IMP] web,*: status bar auto-resize
Before this commit, the status bar field could be displayed in 2 ways:
- in small screens: as a dropdown
- in larger screens: as an inline list of buttons

This commit centralizes both of these approaches into a dynamic display
that fits the available space:
- the current stage is always displayed;
- previous stages are displayed behind or contained in a dropdown if not
enough space;
- next stages are displayed behind or contained in a dropdown if not
enough space.

Task 3336856

closes odoo/odoo#124267

Related: odoo/enterprise#48706
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-16 10:39:53 +00:00
dasz b11b09405b [IMP] hr,hr_skills: give more visibility to skills
UX changes to improve the visibility of skills related features
in hr applications:
- install skills by default with HR
- custom button for skills history
- new skills demo data
- inline create for skill type form
- better skill add ux for employee
- no skills --> redirect to skill types form

task 3334909

closes odoo/odoo#122509

Related: odoo/upgrade#4848
Related: odoo/enterprise#43235
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-10-16 10:39:50 +00:00
snd 5249f851b5 [FIX] purchase_stock: no return picking when no backorder
Case:
- create a PO for 3 units of product A
- validate and open the receipt picking
- put 2 in quantity done, validate
- do NOT create a bacjorder
- return on the PO, put 2 in ordrered quantity field
- save

Issue: a delivery picking is created for the 1 unit that was removed from the PO

Before, product_uom_qty was changed on stock move at validation to match quantity_done.
Now it stays the same so another value has to be used in _get_qty_procurement for 'done' stock moves.
This fix ensures that the correct quantity is used depending on the state of the stock move.

closes odoo/odoo#138732

Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-10-16 09:21:21 +00:00
snd a70b187e3a [FIX] sale_stock: no return picking when no backorder
Case:
- create an SO for 3 units of product A
- validate and open the delivery picking
- put 2 in quantity done, validate
- do NOT create a backorder
- return on the SO, put 2 in ordered quantity field
- save

Issue: a return picking is created for the 1 unit that was removed from the SO

Before, product_uom_qty was changed on stock move at validation to match quantity_done.
Now it stays the same so another value has to be used in _get_qty_procurement for 'done' stock moves.
This fix ensures that the correct quantity is used depending on the state of the stock move.
With that, the float_compare in _action_launch_stock_rule will correctly redirect to continue if necessary.

Part-of: odoo/odoo#138732
2023-10-16 09:21:21 +00:00
Brieuc-brd b4e96e7230 [FIX] board, web: fix dashboard icon SVG
Prior to this commit the knowledge icon from the same dropdown was
turned into an inline-svg but the dashboard one was not.

This commit aims to use an inline-svg for that icon and ensure it
renders correctly.

task-3072562

closes odoo/odoo#138279

X-original-commit: 4df55bbc7bfe0bbe62605cd88887d45460814964
Related: odoo/enterprise#48734
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-16 09:21:17 +00:00
Brieuc-brd 538fdab99b [IMP] *: fine-tune app icons
The aim of this commit is to improve the impact and rendering of app
icons in bright and dark mode. It also reduces the size of svg files.

To achieve that, this commit updates the colors to flat colors. This
change will make the icons stand out and improve their readability.

task-3072562

X-original-commit: 667a19162b74fb6554a2389ba9c6e69de4ff5113
Part-of: odoo/odoo#138279
2023-10-16 09:21:17 +00:00
“moda” dd25b27ca6 [IMP] pos_restaurant: floor screen order number & current floor
Previously, when a table was selected on a floor plan other than the
first, clicking on back brought you to the first floor plan, not the
one of the previously selected table.

Now, when you click on the back button, you return to the floor plan
corresponding to the previous table.

Also, the order number is now displayed on the floor screen button.

closes odoo/odoo#138013

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2023-10-16 09:21:16 +00:00
“moda” 88ae41db5c [IMP] sale: adapt override of ProductAttributeCustomValue in sale
The problem is that a mandatory field from the sale module has been
added to the ProductAttributeCustomValue template, but in point of sale
we also use this model without necessarily filling this field.

Previously, the sale module was the only module to use the
ProductAttributeCustomValue model (product.attribute.custom.value).
In the override, a field set to mandatory has been added
"sale_order_line_id", a relationship between the sale.order.line model
and product.attribute.custom.value.

We now remove the mandatory parameter from this field so that we can
create new data without getting an error indicating that a mandatory
field is missing. This has no impact on the operation of the Sale module
as this field will be populated anyway, since the only way to create a
record of this type is via a sale_order_line or a pos_order_line.

Part-of: odoo/odoo#138013
2023-10-16 09:21:16 +00:00
“moda” fde60bf967 [IMP] pos_self_order,pos_online_payment_self_order: improve success page
Before, when ordering on the kiosk/mobile, no confirmation page was
displayed, only a notification.

Now, a confirmation page displays the tracking number, the amount paid
and, if present, the customer's table...

Part-of: odoo/odoo#138013
2023-10-16 09:21:16 +00:00
Yan Victor 9f7128dd32 [IMP] l10n_de: add delivery date on invoice
Delivery dates on invoices are a legal requirement on germany. It needs to be
displayed on the header of the form view and will be displayed on the printed
invoices.

closes odoo/odoo#127168

Task-id: 3383318
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
2023-10-16 09:21:11 +00:00
Mahamadasif Ansari 62957f700b [REM] pos_self_order: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Ref-https://github.com/odoo/odoo/pull/130467

task-3508331

closes odoo/odoo#138731

Related: odoo/enterprise#48964
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-16 07:58:49 +00:00
Adrien Widart (awt) e52d8f6648 [FIX] stock: update picking type sequences
Suppose a picking type in company C1 that uses a sequence in company
C2. If a user then tries to install mrp/pos, it will lead to a
Server Error because at some point, we write on the picking type:
https://github.com/odoo/odoo/blob/c02df957d9f04c911f330aaaadd80fe97a601509/addons/stock/models/stock_warehouse.py#L332
It will trigger the company checking and lead to the error
https://github.com/odoo/odoo/blob/a32c98beb5d57c3af481558c6db08767e9258959/odoo/models.py#L3548

When updating the picking types, we should also update the sequences
to ensure the data consistency.

OPW-3501199

closes odoo/odoo#138710

X-original-commit: 2ad97c6aeda86e4fed7573fb395b25adae935610
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
2023-10-16 07:58:47 +00:00
Pedram (PEBR) 029a3c85df [FIX] pos_loyalty: ensure reduce returns accumulator for 0 price lines
Ensured that the reduce function returns the accumulator even when
encountering 0 price lines. This prevents the function from breaking
on subsequent iterations due to receiving 'undefined' instead of the
expected array.

opw-3528223

closes odoo/odoo#138702

X-original-commit: ab2ed83f05d93732b0f6879ab3ca3df86213f6a2
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-10-16 07:58:46 +00:00
pedrambiria ec25a56c26 [FIX] google_calendar: get RRULE when recurrence contains more items
Before this commit: we assumed an event's recurrence only contains
RRULE, and we were getting the RRULE from the first element in the
list. But it could have EXRULE, RDATE, and EXDATE, so in this case,
the first element could be other items.

The solution is to iterate through all items and return the RRULE.

opw-2797968

closes odoo/odoo#138697

X-original-commit: f2a20457b352026c2dfb50f6a4d48d47211708f9
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-10-16 07:58:45 +00:00
Adrien Widart (awt) 838718cc76 [FIX] stock_picking_batch: remove done picking
With the option "Reception Report" enabled, a batch may contains
done and ready pickings, which is inconsistent

To reproduce the issue:
1. In Settings, enable Reception Report
2. Operations Types, edit Receipts:
   - Show Reception Report: True
   - Automatic Batches: True
   - Group by: Contact
3. Create two products P1, P2
4. Confirm a delivery with P1
5. Confirm two receipts, one for each product, both with partner P
   - It should create a batch
6. Partially process the receipt with P1, with backorder
   - It should open the reception report because of the delivery
7. Open the batch

Error: The first receipt is done but is still part of the batch and
the backorder is not attached to it. Worst: if the user now tries to
confirm a third receipt with the same partner, he will got an error
because of an inconsistency with the batch

[1] is incorrect. The code assumes that if `res` is not `True`, there
was an issue with the picking, so it's better to immediately return
`res` without analyzing the batch. However, sometimes `res` can be a
`dict` even when the picking has been processed correctly. This is the
case here: the receipt is marked as done, but we return an action to
open the reception report.

As a result, in the above case, we directly return the report action,
and we don't analyze the batch consistency (i.e., we don't remove
the done receipt and add the backorder). Then, because of the batch
inconsistency, the user is blocked and can not validate another
receipt.

[1] 0c7122d416a3669d1d42f66bef5b397e8b36a91b

OPW-3346255

closes odoo/odoo#138690

X-original-commit: d92c5a594e57cb2574bcf87ab398919c07c9a738
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
2023-10-16 07:58:44 +00:00
tsm-odoo 427074c03a [IMP] im_livechat, website_livechat: improve live chat bundles
This commit improves the live chat bundles:
- `core`
	- `common`: hold files that are common to every feature
	- `web`
- `standalone`: hold files for the embed live chat and is splitted
in 4 sub-bundles:
	- `common`
	- `frontend`: should only be added in the Odoo frontend.
	- `external`: should only be added outside of Odoo
	environment (e.g. support page).
	- `cors`: should only be added when the live chat
	is requested from a different origin.

This will make live chat folder structure closer than the one used
in mail and avoid code duplication.

task-3537697

closes odoo/odoo#138536

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-10-16 07:58:43 +00:00
Chong Wang (cwg) fc587dc61b [FIX] auth_totp_mail
1. sudo permission for _totp_check
env.user is still public user which doesn't have access rights for self.login
in Odoo 15 it was not a problem since self.login was in cache
but in Odoo 16 it is not and as a result, returns an access error

2. format_timedelta
the lang was used for `granularity` as the second argument not for `locale`

closes odoo/odoo#138532

X-original-commit: d439fae7a27874ceeaab99cc4db5d28fcbe587c2
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
2023-10-16 07:58:42 +00:00
momegahed 3044b67372 [FIX] l10n_br: CPF is accepted as tax number
Steps to reproduce:
1. install l10n_br and set up a Brazilian company with Brazilian
customers
2. go to validate a sale as a Brazilian customer
3. fill in the CPF field w/ 11 digit number
4. error: "invalid CNPJ. Make sure that the CNPJ number is 14 digits"

Issue:
the code only accepts and validates CNPJ codes

Fix:
add support for CPF codes with its validation function according to:
http://www.receita.fazenda.gov.br/aplicacoes/atcta/cpf/funcoes.js

opw-3421476

closes odoo/odoo#137438

X-original-commit: 23a0ca6386590b6dfdbe24602a1a717bfdd84965
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2023-10-16 07:58:41 +00:00
Aman Patel d382b20135 [IMP] project: disable /image for portal user
Steps:
- Install project.
- Create a project and it's task.
- Share this project to portal user with editable rights.
- Open that project from portal user.
- In task description, using `/image`, add one image.

Issue:
- There comes an Access error:
 Sorry, you are not allowed to access this document.

Solution:
We are passing `'allowCommandImage': false, 'allowCommandVideo': false,
'allowCommandFile': false}` so that portal user can't have the /image and
related options.

task-3463461

closes odoo/odoo#136799

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-16 07:58:40 +00:00
Odoo's Mergebot 60f6fa8fef [MERGE] web_hierarchy,hr_org_chart: add hierarchy view for employees and departments
Purpose
=======

The goal is to be able to have a hierarchy view to see the organisation of a company, that is, to have organisation chart for `hr.employee` model.
To do that, a new view will be introduced in `web_hierarchy` module, called `Hierarchy` view and it will first be used in `hr_org_chart` module for `hr.employee`, `hr.employee.public` and `hr.department` models.

Implementation details
----------------------

- A new python method will be introduced in the models when `web_hierarchy` module is 
  installed. That method, called `hierarchy_read`, is created to fetch the data for the
  hierarchy view when the view will be loaded.
- The definition of hierarchy view is inspired to the definition of the kanban, 
  that is, a template called `hierarchy-box` has to be defined in the arch to draw the card
  displayed in the node of the hierarchy view.
    - Some attributes can be defined on the `hierarchy` tag:
        - `parent_field` (default='parent_id') contains the parent field name 
          to use to fetch the parent record and to be able to fetch the hierarchy.
        - `child_field` (optional attribute) contains the child field name
          to use to find the child records (it is in fact the one2many field).
          If that field is defined then some queries can be avoided since we
          directly fetch the children when a read/search_read is done.
        - `icon` (default='fa-share-alt o_hierarchy_icon') icon displayed inside the 
          `Unfold` button (to show the child nodes) in hierarchy node.
        - `draggable` (default=False) True to allow the user to drag and drop a 
          node (= record) into a row or another node to update its parent node.

task-3376776

closes odoo/odoo#131162

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-10-16 07:58:37 +00:00
Xavier Bol (xbo) a055b9c20e [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
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 55571bc1ac [IMP] hr_org_chart: add test for hierarchy view
This commit adds some tests for the hierarchy view to test most of
features implemented on that view.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 77afd2833f [IMP] hr_org_chart: add stat button in hr.employee form view
This commit adds a stat button in the form view `hr.employee` model
to be able to go to the org chart and visualize the hierarchy of
the current record displayed in the form view.
The action used inside that stat button cannot have a domain to filter
the result to just have the current record since the user will not
be able to search into the search view. The alternative is to use
a context used inside the hierarchy view to add the domain only when
we load the view (as it is a default domain).

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 6df589a73b [IMP] hr_org_chart: add hierarchy view for hr.employee.public model
This commit defines a hierarchy view for `hr.employee.public` model.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 879e4e3412 [IMP] hr_org_chart: add opacity when one of siblings is unfolded
Before this commit, when the user unfolds a node to display its child
nodes, if that node unfolded has some child nodes then it could be
difficult for the user to clearly see the hierarchy.

This commit adds an opacity to 50% for the sibling nodes when the user
unfold a node in the same row.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 3489a0d28f [IMP] hr_org_chart: auto scroll in hierarchy view
Before this commit, when the user unfold a node in hierarchy view,
he has to scroll to be able to see the child nodes added.

This commit adds an auto-scroll when a new row is added to directly
show the child nodes added on the view when the user unfolds a node
in the hirarchy view.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 3e5e6fd3e3 [IMP] hr_org_chart: add new menu Org Chart in Employee menu
This commit adds a new menu called `Org Chart` in Emnployee menu
to directly have the Org chart view as first view when the user
clicks on that button.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 2f463b564b [IMP] hr_org_chart: add drag&drop in hierarchy view
This commit allows the user to drag and drop a record (hierarchy
node) into another one to set the one hovered as the manager of the
one dragged. It also allows to drag a record into a row to define
the manager of the row as the manager of the record dragged.
This commit also adds an new attribute on `hierarchy` tag to use
when we define that view for a certain model to enable the drag and
drop feature.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 5ade959732 [IMP] hr_org_chart: allow to define custom icon in hierarchy card
Before this commit, the icon displayed inside the Unfold button with
the number of child nodes is the default one. In the employee hierarchy
view, since the child nodes are obviously employees, the icon could
be the one displayed users (`fa-users`).

This commit adds a new attribute called `icon` on `hierarchy` tag
to be able to define another icon displayed on that button. By
doing that, the icon displayed inside employee hierarchy view can
changed to have the one expected and more relevant.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 7223f1ae8b [IMP] hr_org_chart: define hierarchy view for hr.department
This commit defines a hierarchy view for `hr.department` model.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 95e0149659 [IMP] hr_org_chart: define hierarchy view for hr.employee model
This commit defines a hierarchy view for `hr.employee` model.

task-3376776
2023-10-16 08:17:31 +02:00
Xavier Bol (xbo) 03ce25127d [IMP] hr_org_chart: add child_count in unfold button of hierarchy card
Before this commit, the user can unfold a node in hierarchy view but
before clicking on it he cannot know how many child nodes there are.

This commit adds the number of child nodes in the Unfold button with
the default icon.

task-3376776
2023-10-16 08:17:31 +02:00