Odoo Help


I am Littile Confused because of supplier and customer.

on 2/24/16, 3:01 AM 938 views


I am little confused because of customer in Sales and supplier in Purchase Module. These two things using the same class, but when we are searching supplier it automatically get the name as supplier and customer. Actually what i am saying, the sales module is called the " res.partner" for Customer, and in purchase also using the same "res.partner" for Supplier. And both of them(sales&Purchase) creating the customer with tags as customer, and supplier. How it is possible? is this possible by domain? if if yes can you explain me how its works?

Thanking You,



Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 2/24/16, 3:48 AM

Yes, this is filtered by a domain, you could search for partners that are customers, or suppliers or employees or companies using this fields in the res.partner model

'customer': fields.boolean('Customer', help="Check this box if this contact is a customer."),
'supplier': fields.boolean('Supplier', help="Check this box if this contact is a supplier. If it's not checked, purchase people will not see it when encoding a purchase order."),
'employee': fields.boolean('Employee', help="Check this box if this contact is an Employee."),

'is_company': fields.boolean('Is a Company', help="Check if the contact is a company, otherwise it is a person"),

---Update--- How the specific fields get a True value using a menu or another

For example the suppliers partners are created using the menu suppliers in Accounting menu or in Purchase menu because of the use of a context value default_supplier with value 1 that makes that every Partner created using that menu get the field supplier with value 1 and finally True.

As a rule of thumbs always that you define a value in a context with a field name prefixed by "default_" you are giving that value for the field(if exist) of the model form that will be opened using that context. This could be used in the xml for actions, buttons, relation fields like many2one, many2many or one2many, or in the returned actions of buttons. It's like defining the default value for the field but in xml. Take this example from the supplier menu in base, this is the action definition:

<record id="action_partner_supplier_form" model="ir.actions.act_window">


<field name="context">{'search_default_supplier': 1,'default_customer': 0,'default_supplier': 1}</field>



For the sake of completeness the sames applies for the prefix value 'search_default_' use that it will select the filter field in the search view by default, like the supplier filter of the search view of the partners model defined like:
<filter string="Suppliers" name="supplier" domain="[('supplier','=',1)]" help="Supplier Partners"/>

That filter will be applied by default too. All of this will be done by the use of the 'default_' and 'search_default_' in the context always followed by a field name for the 'default_' and a filter name for the 'search_default_' 

@Axel Mendoza thank you for your reply, i understood these. But when we are creating customers or suppliers, we didn't put customer as true or supplier as true, but its automatically done when we are saving that data. How it is possible ?? this is what want to know .

on 2/25/16, 12:41 AM

Just see the answer update for more about this

Axel Mendoza
on 2/25/16, 1:08 AM

thank you @Axel Mendoza.

on 2/25/16, 2:09 AM

Happy to help you

Axel Mendoza
on 2/25/16, 3:10 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/24/16, 3:01 AM
Seen: 938 times
Last updated: 7/7/16, 6:23 AM