<?xml version="1.0"?>
<odoo>

    <!-- Category Views -->
    <record id="view_category_form" model="ir.ui.view">
        <field name="name">document.page.category.form</field>
        <field name="model">document.page</field>
        <field name="arch" type="xml">
            <form string="Category">
                <sheet>
                    <field name="type" invisible="1"/>
                    <h1><field name="name" placeholder="Name"/></h1>
                    <group>
                        <group>
                            <field name="parent_id" string="Category" context="{'default_type':'category'}"/>
                        </group>
                        <group>
                            <field name="write_uid" groups="base.group_no_one"/>
                            <field name="write_date" groups="base.group_no_one"/>
                            <field name="menu_id" groups="base.group_no_one"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Template" name="template">
                            <field name="template" placeholder="e.g. Once upon a time..." />
                        </page>
                        <page string="Documents" name="documents">
                            <field name="content" widget="html" class="oe_view_only" options='{"safe": True}' />
                        </page>
                    </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
        </field>
    </record>

    <record id="view_category_tree" model="ir.ui.view">
        <field name="name">document.page.category.tree</field>
        <field name="model">document.page</field>
        <field name="arch" type="xml">
            <tree string="Categories">
                <field name="name"/>
                <field name="parent_id"/>
                <field name="create_uid" invisible="1"/>
                <field name="write_uid"/>
                <field name="write_date"/>
            </tree>
        </field>
    </record>


    <!-- Category Action -->
    <record id="action_category" model="ir.actions.act_window">
        <field name="name">Category</field>
        <field name="res_model">document.page</field>
        <field name="domain">[('type','=','category')]</field>
        <field name="context">{'default_type': 'category'}</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="view_category_tree"/>
        <field name="search_view_id" ref="view_wiki_filter"/>
    </record>

    <record id="action_category_view_tree" model="ir.actions.act_window.view">
        <field name="sequence" eval="0" />
        <field name="view_mode">tree</field>
        <field name="view_id" ref="view_category_tree"/>
        <field name="act_window_id" ref="action_category"/>
    </record>

    <record id="action_category_view_form" model="ir.actions.act_window.view">
        <field name="sequence" eval="5" />
        <field name="view_mode">form</field>
        <field name="view_id" ref="view_category_form"/>
        <field name="act_window_id" ref="action_category"/>
    </record>

    <menuitem id="menu_category"
              parent="menu_wiki"
              name="Categories"
              action="action_category"
              sequence="20"/>


</odoo>
