[FIX]crm_channel: email inform when the user has no portal access
bzr revid: dle@openerp.com-20130620152429-stiad890f688df5o
This commit is contained in:
parent
1a8fa4dcbe
commit
d6ce1e643f
|
@ -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.
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue