<?xml version="1.0"?>
<openerp>
<data>

    <record model="ir.ui.view" id="base.view_model_fields_tree">
        <field name="name">ir.model.fields.tree</field>
        <field name="model">ir.model.fields</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Fields">
                <field name="model_id"/>
                <field name="name"/>
                <field name="field_description"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="base_report_creator_tree">
        <field name="name">base_report_creator.report.tree</field>
        <field name="model">base_report_creator.report</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Report Creator">
                <field name="name"/>
                <field name="type"/>
            </tree>
        </field>
    </record>

<!-- Report Creator form -->

    <record model="ir.ui.view" id="base_report_creator_form">
        <field name="name">base_report_creator.report.form</field>
        <field name="model">base_report_creator.report</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Report Creator">
                <field name="name" select="1" colspan="4"/>
                <field name="type"/>
                <field name="active"/>
                <notebook colspan="4">
                <page string="General Configuration">
                    <field name="model_ids" colspan="4"
                        context="{'model_ids':model_ids}" nolabel="1" />
                    <separator string=""  colspan="4"/>
                    <group colspan="4" col="4">
                        <group colspan="2">
                            <field name="menu_id"/>
                        </group>
                        <group colspan="2">
                            <button string="Create Menu"
                                name="%(action_report_menu_create)d" type="action"
                                icon="gtk-justify-fill" attrs="{'invisible':[('menu_id','!=',False)]}"/>
                            <button string="Open Report"
                                name="open_report" type="object"
                                icon="gtk-open" />
                        </group>
                    </group>
                </page><page string="View parameters">
                    <separator string="Used View" colspan="4"/>
                    <field name="view_type1"/>
                    <field name="view_type2"/>
                    <field name="view_type3"/>
                    <separator string="Graph View" colspan="4"/>
                    <field name="view_graph_type"/>
                    <field name="view_graph_orientation"/>
                </page><page string="Fields to Display">
                    <field name="field_ids" nolabel="1" colspan="4">
                        <form string="Fields">
                            <field name="sequence"/>
                            <field name="field_id"
                                domain="parent.model_ids and [('model_id','in',parent.model_ids[0][2]),('ttype','&lt;&gt;','many2many'),('ttype','&lt;&gt;','one2many')] or []">
                                <tree string="Field List">
                                    <field name="model_id" />
                                    <field name="name" />
                                    <field name="field_description" />
                                </tree>
                            </field>
                            <field name="group_method"/>
                            <field name="graph_mode"/>
                            <field name="calendar_mode"/>
                        </form>
                        <tree editable="bottom" string="Fields to Display">
                            <field name="sequence"/>
                            <field name="field_id"
                                domain="parent.model_ids and [('model_id','in',parent.model_ids[0][2]),('ttype','&lt;&gt;','many2many'),('ttype','&lt;&gt;','one2many')] or []"
                                attrs="{'required':[('group_method','!=','count')]}" />
                            <field name="group_method"/>
                            <field name="graph_mode"/>
                            <field name="calendar_mode"/>
                        </tree>
                    </field>
                </page><page string="Filters on Fields">
                    <button string="Add filter"
                        name="%(wizard_set_filter_fields)d" type="action"
                        icon="gtk-add" />
                    <field name="filter_ids" nolabel="1" colspan="4">
                        <tree string="Filters">
                            <field name="name"/>
                            <field name="condition"/>
                        </tree>
                        <form string="Filters">
                            <field name="name" colspan="4"/>
                            <field name="expression" colspan="4"/>
                            <field name="condition"/>
                        </form>
                    </field>
                    <separator string="Legend" colspan="4"/>
                    <label
                        string="Use %%(uid)s to filter by the connected user"
                        align="0.0" />
</page><page string="Security">
                    <separator string="Authorized Groups (empty for all)" colspan="4"/>
                    <field name="group_ids" colspan="4" nolabel="1"/>
                </page><page string="SQL Query">
                    <field name="sql_query" colspan="4" nolabel="1"/>
                </page>
                </notebook>
            </form>
        </field>
    </record>

    <record id="view_report_filter" model="ir.ui.view">
        <field name="name">Report Name</field>
        <field name="model">base_report_creator.report</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
        <search string="Report">
            <field name="name"></field>            
        </search>
        </field>
    </record>

 <!-- Action for Report creator form -->

    <record model="ir.actions.act_window" id="base_report_creator_action">
        <field name="name">Custom Reports</field>
        <field name="res_model">base_report_creator.report</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="view_report_filter"/>
    </record>

    <menuitem
        name="Custom Reports" id="base.menu_custom_reports"
        action="base_report_creator_action" parent="base.reporting_menu" sequence="1"/>

    

    </data>
</openerp>
