<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data noupdate="1">

        <!-- Default template user for new users signing in -->
        <record id="default_template_user" model="res.users">
            <field name="name">Template User</field>
            <field name="login">portaltemplate</field>
            <!-- No password: this template user doesn't need to log in -->
            <field name="password"></field>
            <field name="active" eval="False"/>
            <!-- Avoid auto-including this user in any default group, just like a typical portal member -->
            <field name="groups_id" eval="[(6, 0,  [ref('base.group_portal')])]"/>
            <!-- allow signuped users to have a alias -->
            <field name="alias_name">_usertemplate</field>
        </record>

        <record id="default_template_user_config" model="ir.config_parameter">
            <field name="key">auth_signup.template_user_id</field>
            <field name="value" ref="default_template_user"/>
        </record>

        <!-- Email template for reset password -->
        <record id="reset_password_email" model="email.template">
            <field name="name">Reset Password</field>
            <field name="model_id" ref="base.model_res_users"/>
            <field name="email_from"><![CDATA[${object.company_id.name} <${(object.company_id.email or user.email)|safe}>]]></field>
            <field name="email_to">${object.email|safe}</field>
            <field name="subject">Password reset</field>
            <field name="body_html"><![CDATA[
<p>A password reset was requested for the Odoo account linked to this email.</p>

<p>You may change your password by following <a href="${object.signup_url}">this link</a>.</p>

<p>Note: If you do not expect this, you can safely ignore this email.</p>]]></field>
        </record>

        <!-- Email template for new users -->
        <record id="set_password_email" model="email.template">
            <field name="name">Odoo Enterprise Connection</field>
            <field name="model_id" ref="base.model_res_users"/>
            <field name="email_from"><![CDATA[${object.company_id.name} <${(object.company_id.email or user.email)|safe}>]]></field>
            <field name="email_to">${object.email|safe}</field>
            <field name="subject"><![CDATA[${object.company_id.name} invitation to connect on Odoo]]></field>
            <field name="body_html">
                <![CDATA[
                    <p>
                        ${object.name},
                    </p>
                    <p>
                        You have been invited to connect to "${object.company_id.name}" in order to get access to your documents in Odoo.
                    </p>
                    <p>
                        To accept the invitation, click on the following link:
                    </p>
                    <ul>
                        <li><a href="${object.signup_url}">Accept invitation to "${object.company_id.name}"</a></li>
                    </ul>
                    <p>
                        Thanks,
                    </p>
                    <pre>
--
${object.company_id.name or ''}
${object.company_id.email or ''}
${object.company_id.phone or ''}
                    </pre>
                ]]>
            </field>
        </record>

    </data>
</openerp>
