<?xml version="1.0"?>
<openerp>
    <data>
        <!-- mail.message tree: short view !-->
        <record model="ir.ui.view" id="view_message_tree">
            <field name="name">mail.message.tree</field>
            <field name="model">mail.message</field>
            <field name="priority">20</field>
            <field name="arch" type="xml">
                <tree string="Messages">
                    <field name="date"/>
                    <field name="subject"/>
                    <field name="author_id"/>
                    <field name="model"/>
                    <field name="res_id"/>
                </tree>
            </field>
        </record>

        <!-- mail.message form: short view !-->
        <record model="ir.ui.view" id="view_message_form">
            <field name="name">mail.message.form</field>
            <field name="model">mail.message</field>
            <field name="priority">20</field>
            <field name="arch" type="xml">
                <form string="Message" version="7.0">
                    <sheet>
                        <group>
                            <group>
                                <field name="subject"/>
                                <field name="author_id"/>
                                <field name="email_from"/>
                                <field name="date"/>
                                <field name="type"/>
                                <field name="subtype_id"/>
                            </group>
                            <group>
                                <field name="model"/>
                                <field name="res_id"/>
                                <field name="parent_id"/>
                                <field name="partner_ids" widget="many2many_tags"/>
                                <field name="notified_partner_ids" widget="many2many_tags"/>
                            </group>
                        </group>
                        <field name="body"/>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- mail.message search: wall view !-->
        <record model="ir.ui.view" id="view_message_search">
            <field name="name">mail.message.search</field>
            <field name="model">mail.message</field>
            <field name="priority">25</field>
            <field name="arch" type="xml">
                <search string="Messages Search">
                    <field name="subject" string="Content" filter_domain="['|', ('subject', 'ilike', self), ('body', 'ilike', self)]" />
                    <field name="type"/>
                    <field name="author_id"/>
                    <field name="partner_ids"/>
                    <filter string="To Read"
                            name="message_unread" help="Show messages to read"
                            domain="[('to_read', '=', True)]"/>
                    <filter string="Read"
                            name="message_read" help="Show already read messages"
                            domain="[('to_read', '=', False)]"/>
                    <separator/>
                    <filter string="Comments"
                            name="comments" help="Comments"
                            domain="[('type', '=', 'comment')]"/>
                    <filter string="Notifications"
                            name="notifications" help="Notifications"
                            domain="[('type', '=', 'notification')]"/>
                    <filter string="Emails"
                            name="emails" help="Emails"
                            domain="[('type', '=', 'email')]"/>
                    <separator/>
                    <filter string="Has attachments"
                            name="attachments"
                            domain="[('attachment_ids', '!=', False)]"/>
                </search>
            </field>
        </record>

        <record id="action_view_mail_message" model="ir.actions.act_window">
            <field name="name">Messages</field>
            <field name="res_model">mail.message</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="search_view_id" ref="view_message_search"/>
        </record>
        
        <!-- Add menu entry in Settings/Email -->
        <menuitem name="Messages" id="menu_mail_message" parent="base.menu_email" action="action_view_mail_message"/>

    </data>
</openerp>