Skip to Content
Logo of RG Logo of RG
  • Home
  • Shop
  • Events
  • Courses
  • Company
    • News
    • Success Stories
  • Odoo Docs 19
  • Appointment
  • Jobs
  • Contact us
  • 0
  • 0
  • +1 555-555-5556
  • Sign in
Logo of RG Logo of RG
  • 0
  • 0
    • Home
    • Shop
    • Events
    • Courses
    • Company
      • News
      • Success Stories
    • Odoo Docs 19
    • Appointment
    • Jobs
    • Contact us
  • +1 555-555-5556
  • Sign in
Odoo Docs 19
Home Components Guides Classes Search
418 components
Overlay
  • Accordion Item
  • Barcode Dialog
  • Bottom Sheet
  • Calendar Common Popover
  • Calendar Year Popover
  • Confirmation Dialog
  • Date Time Picker Popover
  • dialog
  • Domain Selector Dialog
  • Dropdown
  • Dropdown Group
  • Dropdown Item
  • Dropdown Popover
  • Error504 Dialog
  • Error Dialog
  • Export Data Dialog
  • Expression Editor Dialog
  • Form Error Dialog
  • Form View Dialog
  • Kanban Column Examples Dialog
  • Kanban Cover Image Dialog
  • Kanban Dropdown Menu Wrapper
  • List Confirmation Dialog
  • Model Field Selector Popover
  • Multi Create Popover
  • Multi Currency Popover
  • popover
  • Redirect Warning Dialog
  • Res User Group Ids Popover
  • Scss Error Display
  • Select Create
  • Select Create Dialog
  • Session Expired Dialog
  • Signature Dialog
  • Warning Dialog
  1. Components
  2. Res User Group Ids Popover
OWL overlay

Res User Group Ids Popover

Odoo 19 OWL component — Res User Group Ids Popover (webclient)

Live preview Interactive
Source excerpt web/static/src/webclient/res_user_group_ids_field/res_user_group_ids_popover.js
import { Component, useState } from "@odoo/owl";
import { groupBy } from "@web/core/utils/arrays";
import { useService } from "@web/core/utils/hooks";
import { omit } from "@web/core/utils/objects";

export class ResUserGroupIdsPopover extends Component {
    static template = "web.ResUserGroupIdsPopover";
    static props = {
        close: Function,
        groupId: [Number, Boolean],
        groups: Object,
        privileges: Object,
    };

    setup() {
        this.actionService = useService("action");

        this.state = useState({
            showExtraGroups: false,
        });

        this.groups = this.props.groups;
        this.privileges = this.props.privileges;
        this.group = this.groups[this.props.groupId];
        this.privilege = this.privileges[this.group.privilege_id];

        // filter out impliedBy groups from same privilege
        this.impliedGroups = this.group.impliedByIds
            .map((gid) => this.groups[gid])
            .filter((g) => !this.privilege || g.privilege_id !== this.privilege.id);

        // split joint/joint extra/exclusive implies (at most one group by privilege, the one with
        // higher level, and omit groups of same privilege as the current group)
        const implyGroups = this.group.implyIds.map((gid) => this.groups[gid]);
        const implyGroupsByPrivilege = groupBy(implyGroups, (g) => g.privilege_id);
        const keysToOmit = this.privilege ? ["false", String(this.privilege.id)] : ["false"];
        const groupsFromOtherPrivileges = omit(implyGroupsByPrivilege, ...keysToOmit);
        const higherLevelGroups = Object.values(groupsFromOtherPrivileges).map((groups) => groups[groups.length-1]);
        const groupsWithoutPrivilege = implyGroupsByPrivilege[false] || [];
        const implyGroupsToDisplay = groupsWithoutPrivilege.concat(higherLevelGroups);
        const { exclusive, joint, extra } = groupBy(implyGroupsToDisplay, (g) => {
            if (g.impliedByIds.length > 1) {
                return g.privilege_id ? "joint" : "extra";
            }
            return "exclusive";
        });
        this.exclusiveImplyGroups = exclusive || [];
        this.jointImplyGroups = joint || [];
        this.jointExtraImplyGroups = extra || [];
    }

    getGroupDisplayName(group) {
        const prefix = group.privilege_id ? `${this.privileges[group.privilege_id].name}/` : "";
        return `${prefix}${group.name}`;
    }

    onGroupClicked(group) {
        this.actionService.doAction({
            res_id: group.id,
            res_model: "res.groups",
            type: "ir.actions.act_window",
            views: [[false, "form"]],
        });
    }
}
Registry / API
Registry name
ResUserGroupIdsPopover
Category
—
Module
web
Slug
res-user-group-ids-popover
Nav group
overlay
Follow us

250 Executive Park Blvd, Suite 3400
San Francisco CA 94134

  • +1 555-555-5556
  • info@yourcompany.example.com
Copyright © Company name
Powered by Odoo - The #1 Open Source eCommerce