mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-20 04:12:18 -06:00
[IMP] document_page_access_group_user_role: Users compatibility
TT48786
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# Copyright 2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
"""Pages that had roles should now have the correct users."""
|
||||
pages = env["document.page"].sudo().search([("role_ids", "!=", False)])
|
||||
for page in pages:
|
||||
users = page.mapped("role_ids.users")
|
||||
page.role_ids = False
|
||||
page.user_ids = users
|
||||
Reference in New Issue
Block a user