Problem:
I'm trying to disable the POS discount button for users without the proper group permissions, but my implementation either:
- The cashier object is undefined when checking permissions
- The button either shows for all users or is disabled for everyone
Current Implementation:
1. JavaScript Patch (PosAccessRight.js):
patch(ProductScreen.prototype, {
    getNumpadButtons() {
        const originalButtons = super.getNumpadButtons();
        try {
            const pos = this.env.services.pos;
            const cashier = pos.globalState?.get_cashier() || pos.globalState?.cashier;
            const hasDiscountGroup = cashier?.hasGroupDiscount || false;
            
            return originalButtons.map(button => ({
                ...button,
                ...((button.value === "discount" || button.value === "price") && {
                    disabled: !hasDiscountGroup
                })
            }));
        } catch (error) {
            console.error("Button modification failed:", error);
            return originalButtons;
        }
    }
});2. Python Extension (res_users.py):
class ResUsers(models.Model):
    _inherit = 'res.users'
    
    def _load_pos_data(self, data):
        res = super()._load_pos_data(data)
        user = self.env["res.users"].browse(res["data"][0]["id"])
        res["data"][0]["hasGroupDiscount"] = user.has_group('pos_access_right.group_discount')
        return resKey Questions:
- Why is pos.globalState.cashier undefined during button rendering?
- What's the correct way to access the logged-in cashier's permissions in Odoo 18 POS?
- Where should I properly check group permissions if not in getNumpadButtons?
Environment:
- Odoo 18.0 Community
- Custom POS module (depends on point_of_sale)
- PostgreSQL 13 / Ubuntu 20.04
- Chrome

