[FIX] crm: opportunities button in partner form only count opportunities
Before, all crm.lead of the partner were counted, whatever it was a lead or an opportunity, but the button opens the opportunity tree, which has a domain type = opportunity. So leads were not displayed, and the count was therefore misleading. Besides, the button is called "Opportunities", and it was misleading to count leads for a button with such a name
This commit is contained in:
parent
d9e52f793b
commit
ea54d4af9f
|
@ -30,8 +30,9 @@ class res_partner(osv.osv):
|
|||
# the user may not have access rights for opportunities or meetings
|
||||
try:
|
||||
for partner in self.browse(cr, uid, ids, context):
|
||||
opp_ids = self.pool['crm.lead'].search(cr, uid, [('partner_id', '=', partner.id), ('type', '=', 'opportunity'), ('probability', '<', '100')], context=context)
|
||||
res[partner.id] = {
|
||||
'opportunity_count': len(partner.opportunity_ids),
|
||||
'opportunity_count': len(opp_ids),
|
||||
'meeting_count': len(partner.meeting_ids),
|
||||
}
|
||||
except:
|
||||
|
|
Loading…
Reference in New Issue