<?xml version="1.0" ?>
<openerp>
    <data>
        <record model="crm.case.stage" id="stage_portal_lead_assigned">
            <field name="name">Assigned</field>
            <field eval="1" name="case_default"/>
            <field eval="10" name="probability"/>
            <field eval="12" name="sequence"/>
            <field name="type">lead</field>
        </record>
        <record model="crm.case.stage" id="stage_portal_lead_recycle">
            <field name="name">To Recycle</field>
            <field eval="1" name="case_default"/>
            <field eval="5" name="probability"/>
            <field eval="11" name="sequence"/>
            <field name="type">lead</field>
        </record>
        <record id="email_template_lead_forward_mail" model="email.template">
            <field name="name">Lead Mass Mail</field>
            <field name="model_id" model="ir.model" search="[('name', '=', 'crm.lead.forward.to.partner')]"></field>
            <field name="auto_delete" eval="True"/>
            <field name="email_to">${ctx['partner_id'].email|safe}</field>
            <field name="email_from">${(user.email or '')|safe}</field>
            <field name="subject">Fwd: Lead: ${ctx['partner_id'].name}</field>
            <field name="body_html"><![CDATA[
            
<p>Hello,</p>


<p>We have been contacted by those prospects that are in your region. Thus, the following leads have been assigned to ${ctx['partner_id'].name}:</p>

<ol>
% for lead in ctx['partner_leads']:
     <li><a href="${lead.lead_link}">${lead.lead_id.name or 'Subject Undefined'}</a>, ${lead.lead_id.partner_name or lead.lead_id.contact_name or 'Contact Name Undefined'}, ${lead.lead_id.country_id and lead.lead_id.country_id.name or 'Country Undefined' }, ${lead.lead_id.email_from or 'Email Undefined'}, ${lead.lead_id.phone or ''} </li></br>
% 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>
% 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 | safe 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.
% endif
            ]]></field>
        </record>
    </data>
</openerp>
