<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="cx_tower_variable_value_view_tree" model="ir.ui.view">
        <field name="name">cx.tower.variable.value.view.tree</field>
        <field name="model">cx.tower.variable.value</field>
        <field name="arch" type="xml">
            <tree editable="top" decoration-bf="is_global==True">
                <field name="variable_type" invisible="1" />
                <field name="reference" optional="hide" />
                <field name="variable_id" />
                <field name="is_global" widget="boolean_toggle" />
                <field
                    name="server_id"
                    attrs="{'readonly': ['|',('server_template_id', '!=', False), ('plan_line_action_id', '!=', False)]}"
                />
            <field
                    name="server_template_id"
                    attrs="{'readonly': ['|',('server_id', '!=', False), ('plan_line_action_id', '!=', False)]}"
                />
            <field
                    name="plan_line_action_id"
                    attrs="{'readonly': ['|',('server_id', '!=', False), ('server_template_id', '!=', False)]}"
                />
                <field
                    name="value_char"
                    widget="ace_tower"
                    attrs="{'readonly': [('variable_type', '=', 'o')]}"
                />
                <field
                    name="option_id"
                    optional="show"
                    attrs="{'readonly': [('variable_type', '=', 's')]}"
                />
                <field name="required" optional="show" />
                <field name="access_level" optional="show" />
                <field name="variable_ids" optional="hide" widget="many2many_tags" />
            </tree>
        </field>
    </record>
    <record id="cx_tower_variable_value_search_view" model="ir.ui.view">
        <field name="name">cx.tower.variable.value.view.search</field>
        <field name="model">cx.tower.variable.value</field>
        <field name="arch" type="xml">
            <search string="Search Values">
                <field name="reference" />
                <field name="variable_id" string="Variable" />
                <field name="value_char" string="Value" />
                <filter
                    string="Local"
                    name="local"
                    domain="[('is_global', '=', False)]"
                />
                <filter
                    string="Global"
                    name="global"
                    domain="[('is_global', '=', True)]"
                />
                <searchpanel>
                    <field name="access_level" string="Access Level" icon="fa-shield" />
                </searchpanel>
            </search>
        </field>
    </record>
    <record id="action_cx_tower_variable_value" model="ir.actions.act_window">
        <field name="name">Variable Values</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">cx.tower.variable.value</field>
        <field name="view_mode">tree</field>
    </record>
</odoo>
