<?xml version="1.0" encoding="utf-8" ?>
<odoo>

    <record id="sql_parameter_view_form" model="ir.ui.view">
        <field name="name">Sql_parameter_form_view</field>
        <field name="model">ir.model.fields</field>
        <field name="priority">150</field>
        <field name="arch" type="xml">
            <form string="SQL export">
                <group>
                    <field name="name" />
                    <field name="field_description" />
                    <field name="ttype" />
                    <field
                        name="relation"
                        attrs="{'invisible': [('ttype', 'not in', ('many2one', 'many2many', 'one2many'))], 'required': [('ttype', 'in', ('many2one', 'many2many', 'one2many'))]}"
                    />
                    <field name="model_id" readonly="1" />
                    <field name="model" invisible="1" />
                    <field name="required" />
                </group>
            </form>
        </field>
    </record>

    <record id="sql_parameter_view_tree" model="ir.ui.view">
        <field name="name">Sql_parameter_tree_view</field>
        <field name="model">ir.model.fields</field>
        <field name="priority">150</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name" />
                <field name="field_description" />
                <field name="ttype" />
                <field name="required" />
            </tree>
        </field>
    </record>

    <record id="sql_parameter_action" model="ir.actions.act_window">
        <field name="name">SQL Parameter</field>
        <field name="res_model">ir.model.fields</field>
        <field name="view_mode">tree,form</field>
        <field
            name="context"
            eval="{'default_model_id': ref('sql_export.model_sql_file_wizard'), 'default_size': 64, 'search_default_state': 'manual', 'default_model': 'sql.file.wizard'}"
        />
        <field
            name="domain"
        >[('model','=','sql.file.wizard'), ('state', '=', 'manual')]</field>
    </record>

    <record id="sql_parameter_action_view_tree" model="ir.actions.act_window.view">
        <field name="sequence" eval="1" />
        <field name="view_mode">tree</field>
        <field name="view_id" ref="sql_parameter_view_tree" />
        <field name="act_window_id" ref="sql_parameter_action" />
    </record>

    <record id="sql_parameter_action_view_form" model="ir.actions.act_window.view">
        <field name="sequence" eval="2" />
        <field name="view_mode">form</field>
        <field name="view_id" ref="sql_parameter_view_form" />
        <field name="act_window_id" ref="sql_parameter_action" />
    </record>

    <menuitem
        id="sql_parameter_menu_view"
        name="SQL Export Variables"
        parent="spreadsheet_dashboard.spreadsheet_dashboard_menu_configuration"
        action="sql_parameter_action"
        sequence="50"
        groups="sql_request_abstract.group_sql_request_manager"
    />

</odoo>
