<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- menu Administration/Portals -->
        <menuitem name="Portals" id="portal_menu" parent="base.menu_administration"
            groups="group_portal_manager"/>

        <!-- menu Administration/Portals/Portals -->
        <record id="portal_list_action" model="ir.actions.act_window">
            <field name="name">Portals</field>
            <field name="res_model">res.portal</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <!-- a context is necessary to get the right portal form view -->
            <field name="context">{'form_view_ref': 'portal.portal_form_view'}</field>
            <field name="help">
A portal helps defining specific views and rules for a group of users (the
portal group).  A portal menu, widgets and specific groups may be assigned to
the portal's users.
            </field>
        </record>
        <menuitem name="Portals" id="portal_list_menu"
            parent="portal_menu" sequence="1" action="portal_list_action"/>

        <!-- portal tree view -->
        <record id="portal_list_view" model="ir.ui.view">
            <field name="name">Portal List</field>
            <field name="model">res.portal</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Portals">
                    <field name="name" string="Portal Name"/>
                </tree>
            </field>
        </record>

        <!-- portal form view -->
        <record id="portal_form_view" model="ir.ui.view">
            <field name="name">Portal Form</field>
            <field name="model">res.portal</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="base.view_groups_form"/>
            <field name="arch" type="xml">
                <page string="Users" position="before">
                    <page string="Portal">
                        <group colspan="4" col="2">
                            <separator string="Website" colspan="2"/>
                            <field name="url" widget="url"/>
                        </group>
                        <group colspan="2" col="2">
                            <separator string="Widgets assigned to Users" colspan="2"/>
                            <field name="widget_ids" nolabel="1" colspan="2">
                                <tree string="Widgets" editable="bottom">
                                    <field name="sequence"/>
                                    <field name="widget_id"/>
                                </tree>
                            </field>
                        </group>
                        <group colspan="2" col="2">
                            <separator string="Portal Menu" colspan="2"/>
                            <field name="override_menu"/>
                            <field name="parent_menu_id"
                                context="{'ir.ui.menu.full_list': True}"/>
                            <label colspan="1"/>
                            <button name="do_create_menu" type="object"
                                string="Create Parent Menu"/>
                        </group>
                    </page>
                </page>
            </field>
        </record>
    </data>
</openerp>
