Ir al contenido
Menú
Se marcó esta pregunta
4 Respuestas
15004 Vistas

Hello

How do I get res_partner to only show me customers and not everything under res_partner?

From a tutorial it said to add this: domain = "[("customers", "=", True)]" to <field name = "res_partner_id" />

eg: field name = "res_partner_id" domain = "[("customers", "=", True)]" />, this doesn't work. It there another syntax I should be using?


Avatar
Descartar
Mejor respuesta

In a many2one field, you could restrict the records shown by using domain in Odoo.

<field name="partner_id" domain="[('customer','=',True)]" > 

A similar case has been handled in Sales order, you could check the code in sale module.

https://github.com/odoo/odoo/blob/8.0/addons/sale/sale_view.xml#L10   

Avatar
Descartar
Mejor respuesta

Hi,

The filed name to check with is "customer" not "customers"


Avatar
Descartar
Autor Mejor respuesta

Hello 

Thank you for your help.. I was using " instead of ' in the domain syntax


Avatar
Descartar
Mejor respuesta

First enable debug mode. Go to -> Sale -> Customers -> Sale & Purchase tab -> Customer. Find the technical name of customer field. Your field name in domain is wrong. You will not get any error due to the wrong name in the domain.

Technically the domain will be applied with a wrong name in it for the particular field "res_partner_id". You can view the applied domain in debug mode.


domain = "[("customer", "=", True)]" 
Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 20
3583
4
dic 18
14021
2
ene 24
11630
0
nov 22
2365
1
mar 25
1197