Skip to Content
Menu
This question has been flagged
1 Reply
5513 Views

Hi , Please help i new in odoo.


Please help me fix this syntax of domain.

('create_uid','in',[('po_users_rel','=',uid])


class po_permissions(models.Model):
	
    _name = 'purchase.order'
    _inherit = 'purchase.order'

    po_users_rel = fields.Many2many('res.users','user_rel_headsale','id','name',string='Manager(s)',relate='sale_set_headsale')


class sale_relation(models.Model):
	
    _name = 'res.users'
    _inherit = 'res.users'

    def _get_headsale_domain(self):
        return [('groups_id','=','Purchases / HeadSale'),('groups_id','=','Point of Sale / HeadSale')]

    sale_set_headsale = fields.Many2many('res.users','user_rel_headsale','id','name',string='Manager(s)', domain=_get_headsale_domain)


Avatar
Discard
Best Answer

Try this,


def _get_headsale_domain(self):

                 

                your_groups = []

                your_groups.append(self.env['res.users'].search([('name', '=', 'Purchases / HeadSale')]))

                your_groups.append(self.env['res.users'].search([('name', '=', 'Point of Sale / HeadSale')]))

                return [('groups_id','in', your_groups)]


EDITED:

You mean something like

('create_uid','in',[user.id for user in po_users_rel.id])


Kind regards.

Avatar
Discard
Author

thank for help.

but in now def _get_headsale_domain is okay.

i mean this [('create_uid','in',[('po_users_rel','=',uid)])] domain

Author

You mean something like

('create_uid','in',[user.id for user in po_users_rel.id])

yes, but i need to use this code in action domain (xml file)

Related Posts Replies Views Activity
0
Jul 24
192
1
May 24
1306
2
Dec 22
12868
1
Nov 22
3297
2
Jul 22
2097