diff options
| author | Denis Ledoux <dle@openerp.com> | 2013-06-20 17:24:29 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@openerp.com> | 2013-06-20 17:24:29 +0200 |
| commit | d6ce1e643f607cfc5e980302f6fbbab22dfef05c (patch) | |
| tree | f868a5eccab0735da400c3de84297051e1222e7e | |
| parent | 1a8fa4dcbeb7b0551e93f411b0bab7e732c7f55e (diff) | |
[FIX]crm_channel: email inform when the user has no portal access
bzr revid: dle@openerp.com-20130620152429-stiad890f688df5o
| -rw-r--r-- | addons/crm_channel/crm_channel_data.xml | 12 | ||||
| -rw-r--r-- | addons/crm_channel/wizard/crm_forward_to_partner.py | 12 |
2 files changed, 21 insertions, 3 deletions
diff --git a/addons/crm_channel/crm_channel_data.xml b/addons/crm_channel/crm_channel_data.xml index cac60d3a2ee..3f374fd26d4 100644 --- a/addons/crm_channel/crm_channel_data.xml +++ b/addons/crm_channel/crm_channel_data.xml @@ -35,14 +35,20 @@ % endfor </ol> +% if ctx.get('partner_in_portal'): <p>Please connect to your <a href="${object.get_portal_url()}">Partner Portal</a> to get details. On each lead are two buttons on the top left corner that you should press after having contacted the lead: "I'm interested" & "I'm not interested".</p> - -<p>The lead will be send to another partner if you do not contact the lead before 20 days.</p> +% else: +<p> + You do not have yet a Portal access to our database. Please contact + ${ctx['partner_id'].user_id and ctx['partner_id'].user_id.email and 'your account manager %s (%s)' % (ctx['partner_id'].user_id.name,ctx['partner_id'].user_id.email) or 'us'}. +</p> +% endif +<p>The lead will be sent to another partner if you do not contact the lead before 20 days.</p> <p>Thanks,</p> <pre> -${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature or 'The OpenERP Team'} +${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature or ''} </pre> % if not ctx['partner_id'].user_id: PS: It looks like you do not have an account manager assigned to you, please contact us. diff --git a/addons/crm_channel/wizard/crm_forward_to_partner.py b/addons/crm_channel/wizard/crm_forward_to_partner.py index bf26d64d72f..6dd30e0a95a 100644 --- a/addons/crm_channel/wizard/crm_forward_to_partner.py +++ b/addons/crm_channel/wizard/crm_forward_to_partner.py @@ -86,6 +86,12 @@ class crm_lead_forward_to_partner(osv.TransientModel): except ValueError: raise osv.except_osv(_('Email Template Error'), _('The Forward Email Template is not in the database')) + try: + portal_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal', 'group_portal')[1] + except ValueError: + raise osv.except_osv(_('Portal Group Error'), + _('The Portal group cannot be found')) + local_context = context.copy() if not (record.forward_type == 'single'): no_email = set() @@ -120,8 +126,14 @@ class crm_lead_forward_to_partner(osv.TransientModel): pass for partner_id, partner_leads in partners_leads.items(): + in_portal = False + for contact in (partner.child_ids or [partner]): + if contact.user_ids: + in_portal = portal_id in [g.id for g in contact.user_ids[0].groups_id] + local_context['partner_id'] = partner_leads['partner'] local_context['partner_leads'] = partner_leads['leads'] + local_context['partner_in_portal'] = in_portal email_template_obj.send_mail(cr, uid, template_id, ids[0], context=local_context) lead_ids = [lead['lead_id'].id for lead in partner_leads['leads']] values = {'partner_assigned_id': partner_id, 'user_id': partner_leads['partner'].user_id.id} |
