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

    <record id="cx_tower_os_view_form" model="ir.ui.view">
        <field name="name">cx.tower.os.view.form</field>
        <field name="model">cx.tower.os</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group>
                        <group>
                            <field name="name" />
                             <field
                                name="reference"
                                placeholder="Can contain English letters, digits and '_'. Leave blank to autogenerate"
                            />
                            <field name="color" widget="color_picker" />
                        </group>
                        <group>
                            <field name="parent_id" />
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="cx_tower_os_view_tree" model="ir.ui.view">
        <field name="name">cx.tower.os.view.tree</field>
        <field name="model">cx.tower.os</field>
        <field name="arch" type="xml">
            <tree editable="top">
                <field name="name" />
                <field name="reference" optional="show" />
                <field name="parent_id" />
                <field name="color" widget="color_picker" />
            </tree>
        </field>
    </record>

    <record id="cx_tower_os_search_view" model="ir.ui.view">
        <field name="name">cx.tower.os.view.search</field>
        <field name="model">cx.tower.os</field>
        <field name="arch" type="xml">
            <search string="Search OS">
                <field
                    name="name"
                    string="Name/Reference"
                    filter_domain="['|', ('name', 'ilike', self), ('reference', 'ilike', self)]"
                />
                <field name="reference" />
                <field name="parent_id" />
            </search>
        </field>
    </record>

    <record id="action_cx_tower_os" model="ir.actions.act_window">
        <field name="name">OS</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">cx.tower.os</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="cx_tower_os_search_view" />
    </record>

</odoo>
