[IMP] crm: Add Campaign source and medium in group by + fix a bug when name_search return a tuple and not only the id.

This commit is contained in:
Jeremy Kersten 2014-07-29 14:46:45 +02:00
parent db20a45186
commit 053d32d817
2 changed files with 6 additions and 1 deletions

View File

@ -87,7 +87,9 @@ class crm_tracking_mixin(osv.AbstractModel):
if value:
Model = self.pool[column._obj]
rel_id = Model.name_search(cr, uid, value, context=context)
if not rel_id:
if rel_id:
rel_id = Model.name_search(cr, uid, value, context=context)[0][0]
else:
rel_id = Model.create(cr, uid, {'name': value}, context=context)
vals[field] = rel_id
# Here the code for other cases that many2one

View File

@ -349,6 +349,9 @@
<filter string="Sales Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
<filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Campaign" domain="[]" context="{'group_by':'campaign_id'}"/>
<filter string="Source" domain="[]" context="{'group_by':'source_id'}"/>
<filter string="Channel" domain="[]" context="{'group_by':'medium_id'}"/>
<filter string="Expected Closing" domain="[]" context="{'group_by':'date_deadline:week'}"/>
<filter string="Last Message" name="group_message_last_post" domain="[]" context="{'group_by':'message_last_post:week'}"/>
</group>