<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
        <record id="forum_help" model="forum.forum">
            <field name="name">Help</field>
        </record>

        <record id="menu_questions" model="website.menu">
            <field name="name">Forum</field>
            <field name="url" eval="'/forum/'+str(ref('website_forum.forum_help'))"/>
            <field name="parent_id" ref="website.main_menu"/>
            <field name="sequence" type="int">35</field>
        </record>
    </data>
    <data>
        <function model="ir.config_parameter" name="set_param" eval="('auth_signup.allow_uninvited', True)" />

        <!-- JUMP TO FORUM AT INSTALL -->
        <record id="action_open_forum" model="ir.actions.act_url">
            <field name="name">Forum</field>
            <field name="target">self</field>
            <!-- TODO in master : remove the tutorial or create one tutorial forum -->
            <field name="url" eval="'/forum/'+str(ref('website_forum.forum_help'))+'/#tutorial.forum=true'"/>
        </record>

        <!-- Answers subtypes -->
        <record id="mt_answer_new" model="mail.message.subtype">
            <field name="name">New Answer</field>
            <field name="res_model">forum.post</field>
            <field name="default" eval="True"/>
            <field name="hidden" eval="False"/>
            <field name="description">New Answer</field>
        </record>
        <record id="mt_answer_edit" model="mail.message.subtype">
            <field name="name">Answer Edited</field>
            <field name="res_model">forum.post</field>
            <field name="default" eval="False"/>
            <field name="description">Answer Edited</field>
        </record>
        <!-- Questions subtypes -->
        <record id="mt_question_new" model="mail.message.subtype">
            <field name="name">New Question</field>
            <field name="res_model">forum.post</field>
            <field name="default" eval="True"/>
            <field name="description">New Question</field>
        </record>
        <record id="mt_question_edit" model="mail.message.subtype">
            <field name="name">Question Edited</field>
            <field name="res_model">forum.post</field>
            <field name="default" eval="False"/>
            <field name="description">Question Edited</field>
        </record>
        <!-- Forum subtypes, to follow all answers or questions -->
        <record id="mt_forum_answer_new" model="mail.message.subtype">
            <field name="name">New Answer</field>
            <field name="res_model">forum.forum</field>
            <field name="default" eval="True"/>
            <field name="hidden" eval="False"/>
            <field name="parent_id" eval="ref('mt_answer_new')"/>
            <field name="relation_field">forum_id</field>
        </record>
        <record id="mt_forum_question_new" model="mail.message.subtype">
            <field name="name">New Question</field>
            <field name="res_model">forum.forum</field>
            <field name="default" eval="True"/>
            <field name="hidden" eval="False"/>
            <field name="parent_id" eval="ref('mt_question_new')"/>
            <field name="relation_field">forum_id</field>
        </record>

    </data>
    <data noupdate="1">

        <record id="base.open_menu" model="ir.actions.todo">
            <field name="action_id" ref="action_open_forum"/>
            <field name="state">open</field>
        </record>

        <!-- Reasons for closing Post -->
        <record id="reason_1" model="forum.post.reason">
            <field name="name">duplicate question</field>
        </record>
        <record id="reason_2" model="forum.post.reason">
            <field name="name">off-topic or not relevant</field>
        </record>
        <record id="reason_3" model="forum.post.reason">
            <field name="name">too subjective and argumentative</field>
        </record>
        <record id="reason_4" model="forum.post.reason">
            <field name="name">not a real question</field>
        </record>
        <record id="reason_6" model="forum.post.reason">
            <field name="name">not relevant or out dated</field>
        </record>
        <record id="reason_7" model="forum.post.reason">
            <field name="name">contains offensive or malicious remarks</field>
        </record>
        <record id="reason_8" model="forum.post.reason">
            <field name="name">spam or advertising</field>
        </record>
        <record id="reason_9" model="forum.post.reason">
            <field name="name">too localized</field>
        </record>

        <!-- Email template for email validation (for karma purpose) -->
        <record id="validation_email" model="email.template">
            <field name="name">Email Verification</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} Forums validation]]></field>
            <field name="body_html"><![CDATA[
<p>
    Hello ${object.name},
</p>
<p>
    You have been invited to validate your email in order to get access to "${object.company_id.name}" Q/A Forums.
</p>
<p>
    To validate your email, please click on the following link:
</p>
<ul>
    <li><a href="${ctx.get('token_url')}">Validate my account for "${object.company_id.name}" Q/A Forums</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>
