<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <!-- recordset  -->
    <record id="view_import_recordset_form" model="ir.ui.view">
        <field name="model">import.recordset</field>
        <field name="arch" type="xml">
            <form string="Import recordset">
                <h1>Import recordset</h1>
                <group col="4" name="main">
                    <group colspan="2" name="base" string="Base configuration">
                        <field name="name" readonly="1" />
                        <field
                            name="backend_id"
                            options="{'no_create': True}"
                            invisible="context.get('default_backend_id')"
                            required="1"
                        />
                        <field name="import_type_id" options="{'no_create': True}" />
                        <field name="override_existing" />
                    </group>
                    <group colspan="2" name="source" string="Source">
                        <group name="source_config" colspan="4">
                            <field name="source_model" />
                            <button
                                name="open_source_config"
                                type="object"
                                class="oe_highlight btn-sm"
                                string="Configure source"
                                attrs="{'invisible': [('source_model', '=', False)]}"
                            />
                        </group>
                        <group name="source_summary" colspan="4">
                            <field name="source_id" invisible="1" />
                            <field name="source_ref_id" invisible="1" />
                            <field name="source_config_summary" />
                        </group>
                    </group>
                </group>
                <group name="buttons">
                    <button
                        name="run_import"
                        type="object"
                        class="oe_highlight"
                        string="Import"
                    />
                </group>
                <notebook>
                    <page string="Report">
                        <field name="report_html" readonly="1" nolabel="1" />
                        <group name="file" string="Report file">
                            <field
                                name="report_file"
                                readonly="1"
                                nolabel="1"
                                filename="report_filename"
                            />
                            <field name="report_filename" readonly="1" invisible="1" />
                            <button
                                name="generate_report"
                                type="object"
                                class="oe_highlight"
                                string="Generate report"
                            />
                        </group>
                    </page>
                    <page string="Raw Status">
                        <field name="report_data" readonly="1" nolabel="1" />
                    </page>
                    <page string="Records">
                        <field name="record_ids" nolabel="1">
                            <tree>
                                <field name="date" />
                                <field name="jsondata_file" />
                                <field name="job_id" />
                                <field name="job_state" />
                            </tree>
                        </field>
                    </page>
                    <page string="Docs">
                        <field name="docs_html" readonly="1" nolabel="1" colspan="4" />
                        <separator string="Additional notes" colspan="4" />
                        <field name="notes" nolabel="1" colspan="4" />
                    </page>
                    <page string="Server actions">
                        <field
                            name="server_action_importable_model_ids"
                            invisible="1"
                        />
                        <separator string="Server actions" colspan="4" />
                        <group>
                            <field
                                name="server_action_trigger_on"
                                string="Trigger on"
                            />
                        </group>
                        <field
                            name="server_action_ids"
                            nolabel="1"
                            colspan="4"
                            attrs="{'invisible': [('server_action_trigger_on', '=', 'never')]}"
                            domain="[('model_id', 'in', server_action_importable_model_ids)]"
                        >
                            <tree>
                                <field name="name" />
                                <field name="model_id" />
                            </tree>
                        </field>
                    </page>
                </notebook>
            </form>
        </field>
    </record>
    <record id="view_import_recordset_tree" model="ir.ui.view">
        <field name="model">import.recordset</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name" />
                <field name="import_type_id" string="Type" />
                <field name="override_existing" />
                <field name="create_date" />
                <field name="job_state" />
            </tree>
        </field>
    </record>
    <record id="view_import_recordset_search" model="ir.ui.view">
        <field name="model">import.recordset</field>
        <field name="arch" type="xml">
            <search string="Search recordset">
                <field name="name" />
                <field name="backend_id" string="Backend" />
                <field name="import_type_id" string="Type" />
                <field name="create_date" />
                <field name="job_state" />
                <group expand="0" string="Group By">
                    <filter
                        name="by_backend"
                        string="Backend"
                        domain="[]"
                        context="{'group_by':'backend_id'}"
                    />
                    <filter
                        name="by_type"
                        string="Type"
                        domain="[]"
                        context="{'group_by':'import_type_id'}"
                    />
                    <filter
                        name="by_state"
                        string="Job State"
                        domain="[]"
                        context="{'group_by':'job_state'}"
                    />
                </group>
            </search>
        </field>
    </record>
    <record id="action_import_recordset" model="ir.actions.act_window">
        <field name="name">Import Recordsets</field>
        <field name="res_model">import.recordset</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{"search_default_by_backend":1}</field>
    </record>
</odoo>
