mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
fixup! Logic and permissions fixes, new demo module, changes JS-side that reloads in a cleaner way on profile change fixup! removed unused imports, beautified JS fixup! Test coverage increase [FIX] Use write instead of assignment operator on create function: assignment on multiple records raises error fixup! Removed leftover copyright Apply suggestions from code review Co-Authored-By: David Beal <david.beal@akretion.com>
20 lines
603 B
Python
20 lines
603 B
Python
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
from odoo import fields, models
|
|
|
|
|
|
class ResUsersProfile(models.Model):
|
|
_name = "res.users.profile"
|
|
_description = "Role profile"
|
|
|
|
name = fields.Char("Name")
|
|
user_ids = fields.Many2many(
|
|
"res.users", string="Allowed users", compute="_compute_user_ids"
|
|
)
|
|
role_ids = fields.One2many("res.users.role", "profile_id", string="Roles")
|
|
|
|
def _compute_user_ids(self):
|
|
for rec in self:
|
|
rec.user_ids = self.env["res.users"].search(
|
|
[("profile_ids", "in", rec.ids)]
|
|
)
|