Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
4168 Visualizações

Hi odoo masters.


I'm trying to add a domain in the xml, in a many2one field.

But I get the error "name 'self' is not defined"

this is the xml:


name="products_id" domain="[('company_id','=',self.env.user.company_list)]"

Thanks in advance! :)

Avatar
Cancelar
Melhor resposta

You cannot use self or dot notation in the xml views. You could add a related or computed field to the model and access this value for your domain, or apply the domain in the model.

Avatar
Cancelar
Autor Melhor resposta

Thanks Jort, I made it with the Web domain field from OCA and problem solved.

Avatar
Cancelar

Can you share an example to resolve your problem ?

Publicações relacionadas Respostas Visualizações Atividade
2
out. 21
9119
6
ago. 20
9136
0
abr. 15
7929
1
ago. 23
16110
2
fev. 24
14465