Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

[Solved] Show only customers from res_partner

By
Siobhan
on 4/24/15, 5:38 AM 888 views

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?


3

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3883
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 4/24/15, 6:52 AM

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   

2

Bejaoui Souheil

--Bejaoui Souheil--
808
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 4/24/15, 5:57 AM

Hi,

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


0

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 4/27/15, 3:18 AM

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)]" 
0
Siobhan
On 4/24/15, 6:24 AM

Hello 

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


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/24/15, 5:38 AM
Seen: 888 times
Last updated: 5/6/15, 2:50 AM