April 2016
Beginner to intermediate
400 pages
9h 16m
English
Searching for records is also a common operation in business logic methods. This recipe shows how to find all the Partner companies and their contacts by company name.
This recipe will be using the same simplified res.partner definition as the Creating new records recipe previously. You may refer to this simplified definition to know the fields.
We will write the code in a method called find_partners_and_contact(self, name).
In order to find the partners, you need to perform the following steps:
res.partner: @api.model
def find_partners_and_contacts(self, name):
partner = self.env['res.partner'] domain = ['|', '&', ('is_company', '=', ...