OCA / knowledge

Odoo Document & Knowledge Management
http://www.odoo-community.org/project/22
GNU Affero General Public License v3.0
153 stars 328 forks source link

16.0[IMP]document_page: menu_parent_id context domain of menu creation #448

Closed Tisho99 closed 8 months ago

Tisho99 commented 8 months ago

On the document_page module, there is one use case when we can't correctly create a menu item for a page.

This case occurs when we want to create the document menu under a new "Documentation" menu. Example:

Sales

Steps to reproduce:

  1. Create the "Documentation" parent menu, as it is a folder we dont fill the 'action' field.
  2. Go to a knowledge document form, and select action -> create mene. You can see that the "Documentation" menu does not appear on the parent menu's list.

Captura de pantalla de 2024-01-09 13-59-25

The reason of the problem is that, by default, we only can see the menus that have an action, or a child with actions. To see all, odoo gives a context parameter that can be placed on the field: context="{'ir.ui.menu.full_list': True}". However, with this context on the menu_parent_id of the document_page create menu wizard the document users are able to see menus they must not be able to see due to permission groups; and they can create aditional menus under the unauthorized ones. To solve this, a new context parameter has been created: "ir.ui.menu.authorized_list", that allows to see all menus, except the unauthorized by permission groups

PD: A unit test is in progress

Tisho99 commented 8 months ago

@ValentinVinagre

ValentinVinagre commented 8 months ago

@HaraldPanten @etobella 😄

Tisho99 commented 8 months ago

@etobella

I will put this PR in draft for some time because i am developing a unit test

Thank you for your review!

etobella commented 8 months ago

/ocabot merge patch

OCA-git-bot commented 8 months ago

On my way to merge this fine PR! Prepared branch 16.0-ocabot-merge-pr-448-by-etobella-bump-patch, awaiting test results.

OCA-git-bot commented 8 months ago

Congratulations, your PR was merged at 954d7b2700b9a6625dd1301a29383ee8b843cae0. Thanks a lot for contributing to OCA. ❤️