<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2012 - Now  Savoir-faire Linux <https://www.savoirfairelinux.com/>
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>
    <data>
        <!-- Ranges -->
        <record id="view_kpi_threshold_range_tree" model="ir.ui.view">
            <field name="name">kpi.threshold.range.tree</field>
            <field name="model">kpi.threshold.range</field>
            <field name="arch" type="xml">
                <tree string="Ranges">
                    <field name="name"/>
                    <field name="min_value"/>
                    <field name="max_value"/>
                    <field name="color" widget="color"/>
                    <field name="invalid_message"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                </tree>
            </field>
        </record>

        <record id="view_kpi_threshold_range_form" model="ir.ui.view">
            <field name="name">kpi.threshold.range.form</field>
            <field name="model">kpi.threshold.range</field>
            <field name="arch" type="xml">
                <form string="Range">
                    <group col="6" colspan="6">
                        <field name="name"/>
                        <field name="color"/>
                        <field name="company_id" groups="base.group_multi_company"/>
                        <newline/>

                        <separator string="Minimum" colspan="4"/>
                        <newline/>
                        <field name="min_type" colspan="2"/>
                        <field name="min_fixed_value" colspan="2" attrs="{'invisible' : [('min_type', '!=', 'static')]}"/>
                        <field name="min_dbsource_id" colspan="2" attrs="{'invisible' : [('min_type', '!=', 'external')]}"/>
                        <newline/>
                        <field name="min_code" colspan="4" attrs="{'invisible' : [('min_type', 'NOT IN', ('local','external','python'))]}"/>
                        <newline/>
                        <separator string="Maximum" colspan="4"/>
                        <newline/>
                        <field name="max_type"/>
                        <field name="max_fixed_value" attrs="{'invisible' : [('max_type', '!=', 'static')]}"/>
                        <field name="max_dbsource_id" attrs="{'invisible' : [('max_type', '!=', 'external')]}"/>
                        <newline/>
                        <field name="max_code" colspan="4" attrs="{'invisible' : [('max_type', 'NOT IN', ('local','external','python'))]}"/>
                        <newline/>
                        <separator string="Thresholds" colspan="4"/>
                        <field name="threshold_ids" nolabel="1" colspan="4"/>
                        <field name="invalid_message" nolabel="1" attrs="{'invisible' : [('invalid_message', '=', '')]}" colspan="4"/>
                    </group>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="open_threshold_range_list">
            <field name="name">Ranges</field>
            <field name="res_model">kpi.threshold.range</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_kpi_threshold_range_tree"/>
        </record>



    </data>
</odoo>