تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3510 أدوات العرض

Hi Community,

actually what i want suppose i created one field in user creation form and it's name is [hide_menus] and i store all menus in it. now i select the menus from hide_menus field and compare with [installed_modules_id] if menus are will match then this menu will be hide for user.so how to hide menu if you know please let me know.

See my Code

class HideMenus(models.Model):
    _inherit = 'res.users'
    _rec_name = 'hide_menus'

    hide_menus = fields.Many2many(comodel_name="ir.ui.menu")

    @api.multi
    def write(self, vals):
        installed_modules = self.env['ir.module.module'].search([('state', '=', 'installed'),('application', '=', True)])
        for instd in installed_modules:
            res = super(HideMenus, self).write(vals)
                print("===========   installed modules ============", instd.category_id.name)
                for rec in self:
                    if u'hide_menus' in vals and rec.hide_menus:
                        for est_rec in rec.hide_menus:
                            print("=============== Hide Menus ==============", est_rec.name)
                            if instd.category_id.name == est_rec.name:​

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
نوفمبر 19
60
7
مايو 16
10258
1
مارس 15
5186
2
أغسطس 23
28588
3
أبريل 25
12059