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

How to add a new customer filter string based on new company field

By
Paulo Matos‏
on 3/27/15, 11:27 AM 526 views

Dear all,

I have added a new boolean field on the Customers (res.partner) form, which user must choose from True or False. This field is used for customers where the field "Is a Company?" is selected.

Now, I need to add a filter on the customers tree view, that lists all Contacts from Customers (Contacts added and liked to that Company) where this new_field is True.

Standard Odoo already have several options to filter the customer tree view (by Customers, Suppliers / People, Company, etc.).

Now, I need to add a new filter that allows me to filter all contacts (people) from companies (Company), for which the new_field is TRUE.

This is the basic odoo search view (for tree view)

<?xml version="1.0"?>

<search string="Search Partner">

<field name="name" filter_domain="['|','|',('name','ilike',self),('parent_id','ilike',self),('ref','=',self)]"/>

<filter help="My Partners" icon="terp-personal+" domain="[('user_id','=',uid)]"/>

<separator/>

<filter string="Persons" name="type_person" domain="[('is_company','=',0)]"/>

<filter string="Companies" name="type_company" domain="[('is_company','=',1)]"/>

<separator/>

<filter string="Customers" name="customer" domain="[('customer','=',1)]" help="Customer Partners"/>

<filter string="Suppliers" name="supplier" domain="[('supplier','=',1)]" help="Supplier Partners"/>

<separator/>

<field name="category_id" string="Tag" filter_domain="[('category_id','ilike', self)]"/>

<field name="user_id"/>

<field name="parent_id" domain="[('is_company','=',1)]" filter_domain="[('parent_id','child_of',[self])]"/>

<group expand="0" string="Group By...">

<filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by' : 'user_id'}"/>

<filter string="Company" context="{'group_by': 'parent_id'}"/>

<filter string="Country" context="{'group_by': 'country_id'}"/>

</group>

</search>

Any help on adding this new filter based on people from any company which new_field is TRUE? I am not developing a new module. I am using the "Activate programmer mode" to make the changes.

Thank you very much.

Regards

Paulo

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: 3/27/15, 11:27 AM
Seen: 526 times
Last updated: 3/27/15, 6:07 PM