Skip to Content
Menu
This question has been flagged
2 Replies
6625 Views

Hi All,

I have one Many2one field and i want to show not specific users of specific applied group's how to do this. If anyone know this please let me know.

See My Code

.py File

​class CrmLead(models.Model):
    _inherit = 'crm.lead'
    developer_id = fields.Many2one('res.users', 'Developer', default=lambda self:self.env.user)])

@api.multi
@api.onchange('developer_id')
def onchange_developer_id(self):
    user = self.env.ref('group_user_hide').user.ids
    return {'domain': {'developer_id': [('id', 'in', user.ids)]}}


​​ 

Avatar
Discard
Author Best Answer

I got  the Answer is :

.py File

Your_field = fields.Many2many('res.users', domain=lambda self: [("groups_id", "=", self.env.ref( "your_module_name.group_user_hide" ).id)])

security/abc_security.xml

​<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <record model="res.groups" id="group_user_hide" >
            <field name="name">Show Menu</field>
        </record>
    </data>
</odoo>


Avatar
Discard

Thank you !!

im so thankfull

Author
Welcome 

On Mon, Aug 30, 2021 at 11:10 PM roseline alim santoso <mroseve13@gmail.com> wrote:

im so thankfull

Sent by Odoo S.A. using Odoo.

Best Answer

Hi,

Check this,

https://www.odoo.com/forum/help-1/question/odoo10-dynamic-domain-118053

Thanks !!!  

Aswini @ iWesabe


Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
153
3
Apr 23
16087
1
Dec 22
12393
1
Apr 19
8802
0
Mar 15
3485