Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
7023 Vizualizări

I'm new in odoo and I using odoo 9, I want to filter odoo tree view using domain that check user uid in many2many field. So only user id in that many2many field can see the tree view. Is that posible?

This giving me error like this:

raise ValueError("Invalid leaf %s" % str(self.leaf))

ValueError: Invalid leaf (80, 'in', 'authorize_user')

The field is :

authorize_user = fields.Many2many('res.users', string='Authorized User')
And this is the view I created :
<record model="ir.actions.act_window" id="action_menu_approval_purchase">
<field name="name">Purchase Order Approval</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_mode">tree,form</field>
<field name="domain">[(uid, 'in', 'authorize_user'), ('state', 'in', ['to approve'])]</field>
</record>
Imagine profil
Abandonează
Cel mai bun răspuns

Are you talking about restricting particular records of purchase order or hiding whole po tree view . Because domain is used for access restriction on records level.(this option seems more logical to me).
If it is the case ,you should right it as below

<field name="domain">[('authorize_user', 'in', [uid]), ('state', 'in', ['to approve'])]</field>

there is one such instance in gamification module.


Imagine profil
Abandonează
Autor

yes I just want to restrict some records of purchase order to some user that generated from some process before. and your solution is working very well. thank you!

Related Posts Răspunsuri Vizualizări Activitate
0
iul. 17
5834
0
mar. 16
6794
0
aug. 20
2210
2
nov. 24
2591
0
iun. 23
1854