<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2020-2021 Akretion France (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>


<menuitem id="dynamic_list_root_menu" name="Dynamic Lists" parent="base.menu_custom" sequence="100"/>

<record id="dynamic_list_form" model="ir.ui.view">
    <field name="model">dynamic.list</field>
    <field name="arch" type="xml">
        <form>
            <sheet>
                <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
                <group name="main">
                    <field name="name"/>
                    <field name="domain" invisible="not context.get('dynamic_list_main_view')"/>
                    <field name="active" invisible="1"/>
                </group>
            </sheet>
        </form>
    </field>
</record>

<record id="dynamic_list_tree" model="ir.ui.view">
    <field name="model">dynamic.list</field>
    <field name="arch" type="xml">
        <tree>
            <field name="sequence" widget="handle"/>
            <field name="name"/>
            <field name="domain" invisible="not context.get('dynamic_list_main_view')"/>
        </tree>
    </field>
</record>

<record id="dynamic_list_search" model="ir.ui.view">
    <field name="model">dynamic.list</field>
    <field name="arch" type="xml">
        <search>
            <field name="name"/>
            <separator/>
            <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
            <group string="Group By" name="groupby">
                <filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
            </group>
        </search>
    </field>
</record>

<record id="dynamic_list_action" model="ir.actions.act_window">
    <field name="name">Simple List</field>
    <field name="res_model">dynamic.list</field>
    <field name="view_mode">tree,form</field>
    <field name="context">{'dynamic_list_main_view': True, 'search_default_domain_groupby': True}</field>
</record>

<menuitem id="dynamic_list_menu" action="dynamic_list_action" parent="dynamic_list_root_menu" sequence="10"/>

<record id="dynamic_list_translate_form" model="ir.ui.view">
    <field name="model">dynamic.list.translate</field>
    <field name="arch" type="xml">
        <form>
            <sheet>
                <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
                <group name="main">
                    <field name="name"/>
                    <field name="domain" invisible="not context.get('dynamic_list_translate_main_view')"/>
                    <field name="active" invisible="1"/>
                </group>
            </sheet>
        </form>
    </field>
</record>

<record id="dynamic_list_translate_tree" model="ir.ui.view">
    <field name="model">dynamic.list.translate</field>
    <field name="arch" type="xml">
        <tree>
            <field name="sequence" widget="handle"/>
            <field name="name"/>
            <field name="domain" invisible="not context.get('dynamic_list_translate_main_view')"/>
        </tree>
    </field>
</record>

<record id="dynamic_list_translate_search" model="ir.ui.view">
    <field name="model">dynamic.list.translate</field>
    <field name="arch" type="xml">
        <search>
            <field name="name"/>
            <separator/>
            <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
            <group string="Group By" name="groupby">
                <filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
            </group>
        </search>
    </field>
</record>

<record id="dynamic_list_translate_action" model="ir.actions.act_window">
    <field name="name">Translatable Simple List</field>
    <field name="res_model">dynamic.list.translate</field>
    <field name="view_mode">tree,form</field>
    <field name="context">{'dynamic_list_translate_main_view': True, 'search_default_domain_groupby': True}</field>
</record>

<menuitem id="dynamic_list_translate_menu" action="dynamic_list_translate_action" parent="dynamic_list_root_menu" sequence="20"/>

<record id="dynamic_list_code_form" model="ir.ui.view">
    <field name="model">dynamic.list.code</field>
    <field name="arch" type="xml">
        <form>
            <sheet>
                <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
                <group name="main">
                    <field name="code"/>
                    <field name="name"/>
                    <field name="domain" invisible="not context.get('dynamic_list_code_main_view')"/>
                    <field name="active" invisible="1"/>
                </group>
            </sheet>
        </form>
    </field>
</record>

<record id="dynamic_list_code_tree" model="ir.ui.view">
    <field name="model">dynamic.list.code</field>
    <field name="arch" type="xml">
        <tree>
            <field name="sequence" widget="handle"/>
            <field name="code"/>
            <field name="name"/>
            <field name="domain" invisible="not context.get('dynamic_list_code_main_view')"/>
        </tree>
    </field>
</record>

<record id="dynamic_list_code_search" model="ir.ui.view">
    <field name="model">dynamic.list.code</field>
    <field name="arch" type="xml">
        <search>
            <field name="name" string="Name or Code" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/>
            <separator/>
            <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
            <field name="code"/>
            <group string="Group By" name="groupby">
                <filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
            </group>
        </search>
    </field>
</record>

<record id="dynamic_list_code_action" model="ir.actions.act_window">
    <field name="name">Code List</field>
    <field name="res_model">dynamic.list.code</field>
    <field name="view_mode">tree,form</field>
    <field name="context">{'dynamic_list_code_main_view': True, 'search_default_domain_groupby': True}</field>
</record>

<menuitem id="dynamic_list_code_menu" action="dynamic_list_code_action" parent="dynamic_list_root_menu" sequence="30"/>

<record id="dynamic_list_code_translate_form" model="ir.ui.view">
    <field name="model">dynamic.list.code.translate</field>
    <field name="arch" type="xml">
        <form>
            <sheet>
                <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
                <group name="main">
                    <field name="code"/>
                    <field name="name"/>
                    <field name="domain" invisible="not context.get('dynamic_list_code_translate_main_view')"/>
                    <field name="active" invisible="1"/>
                </group>
            </sheet>
        </form>
    </field>
</record>

<record id="dynamic_list_code_translate_tree" model="ir.ui.view">
    <field name="model">dynamic.list.code.translate</field>
    <field name="arch" type="xml">
        <tree>
            <field name="sequence" widget="handle"/>
            <field name="code"/>
            <field name="name"/>
            <field name="domain" invisible="not context.get('dynamic_list_code_translate_main_view')"/>
        </tree>
    </field>
</record>

<record id="dynamic_list_code_translate_search" model="ir.ui.view">
    <field name="model">dynamic.list.code.translate</field>
    <field name="arch" type="xml">
        <search>
            <field name="name" string="Name or Code" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/>
            <field name="code"/>
            <separator/>
            <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
            <group string="Group By" name="groupby">
                <filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
            </group>
        </search>
    </field>
</record>

<record id="dynamic_list_code_translate_action" model="ir.actions.act_window">
    <field name="name">Translatable Code List</field>
    <field name="res_model">dynamic.list.code.translate</field>
    <field name="view_mode">tree,form</field>
    <field name="context">{'dynamic_list_code_translate_main_view': True, 'search_default_domain_groupby': True}</field>
</record>

<menuitem id="dynamic_list_code_translate_menu" action="dynamic_list_code_translate_action" parent="dynamic_list_root_menu" sequence="40"/>


</odoo>
