Compute boolean field with store=True is not search in Odoo11

Pawan Kumar Sharma

Hello All,

For below code my boolean field not domain(searched) in database. It's work when i make this method depends. But i have above 1000 records so how to domain in action for all record simultaneously?

Python Code:

def _compute_opportunity_count111(self):
value = {}
for rec in self:
operator = 'child_of' if rec.is_company else '=' # the opportunity count should counts the opportunities of this company and all its contacts
won_list = rec.env['crm.lead'].search(
[('partner_id', operator,, ('stage_id.probability', '=', 100)]).ids
if won_list:
rec.won_customer = True

won_customer = fields.Boolean(compute='_compute_opportunity_count111'store=True)

XML Code:
<record id="base.action_partner_form" model="ir.actions.act_window">
<field name="name">Customers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_customer":1}</field>
<field name="domain">[('won_customer', '=', True)]</field>
<field name="search_view_id" ref="base.view_res_partner_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
Odoo helps you easily track all activities related to
a customer: discussions, history of business opportunities,
documents, etc.

Thanks in advance