You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
603 B

  1. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  2. from odoo import fields, models
  3. class ResUsersProfile(models.Model):
  4. _name = "res.users.profile"
  5. _description = "Role profile"
  6. name = fields.Char("Name")
  7. user_ids = fields.Many2many(
  8. "res.users", string="Allowed users", compute="_compute_user_ids"
  9. )
  10. role_ids = fields.One2many("res.users.role", "profile_id", string="Roles")
  11. def _compute_user_ids(self):
  12. for rec in self:
  13. rec.user_ids = self.env["res.users"].search(
  14. [("profile_ids", "in", rec.ids)]
  15. )