<?xml version='1.0' encoding='utf-8'?>
<odoo>
    #------------------品牌------------------
    <record model="ir.ui.view" id="search_sf_machine_brand_view">
        <field name="name">search.sf.machine.brand</field>
        <field name="model">sf.machine.brand</field>
        <field name="arch" type="xml">
            <search string="品牌">
                <!--                <field name="name" string="名称"-->
                <!--                      filter_domain="[('name', 'ilike', self)]"/>-->
                <field name="name" string="模糊搜索"
                       filter_domain="['|',('name', 'ilike', self),('code', 'ilike', self)]"/>
                <group string="分组">
                    <filter name="tag_ids" string="标签" domain="[]" context="{'group_by': 'tag_ids'}"/>
                </group>
            </search>
        </field>
    </record>

    <record model="ir.ui.view" id="tree_sf_machine_brand_view">
        <field name="name">tree.sf.machine.brand</field>
        <field name="model">sf.machine.brand</field>
        <field name="arch" type="xml">
            <tree string="品牌">
                <field name="code"/>
                <field name="name"/>
                <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" optional="hide"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="form_sf_machine_brand">
        <field name="name">form.sf.machine.brand</field>
        <field name="model">sf.machine.brand</field>
        <field name="arch" type="xml">
            <form string="品牌">
                <!--                <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>-->
                <field name="image_brand" widget='image' class="oe_avatar" options="{'preview_image': 'image_128'}"/>
                <div class="oe_title">
                    <label for="code" string="编码"/>
                    <h2 class="d-flex">
                        <field name="code" readonly="True"/>
                    </h2>
                </div>
                <group>
                    <group>
                        <field name="name" required="True"/>
                        <field name="tag_ids"
                               widget="many2many_tags"
                               options="{'color_field': 'color', 'no_create_edit': True}"
                               required="True"/>
                    </group>
                </group>
            </form>
        </field>
    </record>

    <record id="action_sf_machine_brand" model="ir.actions.act_window">
        <field name="name">品牌</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sf.machine.brand</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                [品牌] 还没有哦！点左上角的[创建]按钮，沙发归你了!
            </p>
            <p>
            </p>
        </field>
    </record>

    #------------------机床型号------------------

    <record model="ir.ui.view" id="search_sf_machine_tool_type_view">
        <field name="name">search.sf.machine_tool.type</field>
        <field name="model">sf.machine_tool.type</field>
        <field name="arch" type="xml">
            <search string="机床型号">
                <field name="name" string="模糊搜索"
                       filter_domain="['|',('name', 'ilike', self),('remark', 'ilike', self)]"/>
            </search>
        </field>
    </record>

    <record model="ir.ui.view" id="tree_sf_machine_tool_type_view">
        <field name="name">tree.sf.machine_tool.type</field>
        <field name="model">sf.machine_tool.type</field>
        <field name="arch" type="xml">
            <tree string="机床型号">
                <field name="code"/>
                <field name="name"/>
                <field name="brand_id"/>
                <field name="remark"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="form_sf_machine_tool_type">
        <field name="name">form.sf.machine_tool.type</field>
        <field name="model">sf.machine_tool.type</field>
        <field name="arch" type="xml">
            <form string="机床型号">
                <group string="基本信息" name="base_info">
            <group>
                <field name="code" force_save="1" readonly="1"/>
                <field name="name" required="1"/>
            </group>
            <group>
                <field name="brand_id" required="1"
                       domain="[('tag_ids', '=', '机床')]"
                       options="{'no_create': True}"/>
            </group>
        </group>
                <group string="参数">
            <group>
                <field name="knife_type" required="1"/>
                <field name="number_of_knife_library" required="1" options="{'format': false}"/>
                <field name="number_of_axles" required="1" widget="radio" options="{'horizontal': true}"/>
                <label for="x_axis" string="加工行程(mm)"
                       attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
                <div class="o_address_format"
                     attrs="{'invisible': [('number_of_axles', '=', False)]}">
                    <label for="x_axis" string="x"/>
                    <field name="x_axis" class="o_address_city" required="1" options="{'format': false}"/>
                    <label for="y_axis" string="y"/>
                    <field name="y_axis" class="o_address_zip" required="1" options="{'format': false}"/>
                    <label for="z_axis" string="z"/>
                    <field name="z_axis" class="o_address_zip" required="1" options="{'format': false}"/>
                    <label for="b_axis" string="b"
                           attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"/>
                    <field name="b_axis" class="o_address_city" required="1"
                           attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
                           options="{'format': false}"/>
                    <label for="c_axis" string="c"
                           attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
                    <field name="c_axis" class="o_address_zip" required="1"
                           attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
                           options="{'format': false}"/>
                </div>
            </group>
            <group>
                <field name="rotate_speed" string="转速(min)" required="1" options="{'format': false}"/>
                <field name="precision" required="1" string="加工精度(mm)"/>
                <field name="control_system_id" required="1" options="{'no_create': True}"/>
            </group>
        </group>

                <group string="其它">
                    <field name="remark"/>
                </group>



            </form>
        </field>
    </record>

    <record id="action_sf_machine_tool_type" model="ir.actions.act_window">
        <field name="name">机床型号</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sf.machine_tool.type</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                [机床型号] 还没有哦！点左上角的[创建]按钮，沙发归你了!
            </p>
            <p>
            </p>
        </field>
    </record>

    #------------------刀具型号------------------

    <record model="ir.ui.view" id="search_sf_cutting_tool_type_view">
        <field name="name">search.sf.cutting_tool.type</field>
        <field name="model">sf.cutting_tool.type</field>
        <field name="arch" type="xml">
            <search string="刀具型号">
                <field name="name" string="模糊搜索"
                       filter_domain="['|',('name', 'ilike', self),('code', 'ilike', self)]"/>
            </search>
        </field>
    </record>

    <record model="ir.ui.view" id="tree_cutting_tool_type_view">
        <field name="name">tree.sf.cutting_tool.type</field>
        <field name="model">sf.cutting_tool.type</field>
        <field name="arch" type="xml">
            <tree string="刀具型号">
                <field name="code"/>
                <field name="name"/>
                <field name="remark"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="form_sf_cutting_tool_type">
        <field name="name">form.sf.cutting_tool.type</field>
        <field name="model">sf.cutting_tool.type</field>
        <field name="arch" type="xml">
            <form string="刀具型号">
                <group string="基本信息">
                    <group>
                        <field name="code" force_save="1" readonly="1"/>
                        <field name="category_id" string="类别" required="1"/>
                    </group>
                    <group>
                        <field name="name" required="1"/>
                        <field name="brand_id" required="1"
                               domain="[('tag_ids', '=', '机床')]"/>
                    </group>
                </group>
                <group string="刀具参数">
                    <group>
                        <field name="taper_shank_length" required="1" options="{'format': false}"/>
                        <field name="long_blade" required="1" options="{'format': false}"/>
                        <field name="tool_length" required="1" options="{'format': false}"/>
                    </group>
                    <group>
                        <field name="diameter" required="1" options="{'format': false}"/>
                        <field name="shank_diameter" required="1" options="{'format': false}"/>
                        <field name="cone_angle_pitch" required="1" options="{'format': false}"/>
                        <field name="blade_number" required="1" options="{'format': false}"/>
                    </group>
                </group>
                <group string="其它">
                    <field name="remark"/>
                </group>
            </form>
        </field>
    </record>

    <record id="action_sf_cutting_tool_type" model="ir.actions.act_window">
        <field name="name">刀具型号</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sf.cutting_tool.type</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                [刀具型号] 还没有哦！点左上角的[创建]按钮，沙发归你了!
            </p>
            <p>
            </p>
        </field>
    </record>

    #------------------刀具类别------------------

    <record model="ir.ui.view" id="search_sf_cutting_tool_category_view">
        <field name="name">search.sf.cutting_tool.category</field>
        <field name="model">sf.cutting_tool.category</field>
        <field name="arch" type="xml">
            <search string="刀具类别">
                <field name="name" string="模糊搜索"
                       filter_domain="['|',('name', 'ilike', self),('remark', 'ilike', self)]"/>
            </search>
        </field>
    </record>

    <record model="ir.ui.view" id="tree_sf_cutting_tool_category_view">
        <field name="name">tree.sf.cutting_tool.category</field>
        <field name="model">sf.cutting_tool.category</field>
        <field name="arch" type="xml">
            <tree string="刀具类别">
                <field name="code"/>
                <field name="name"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="sf_cutting_tool_category_form">
        <field name="name">form.sf.cutting_tool.category</field>
        <field name="model">sf.cutting_tool.category</field>
        <field name="arch" type="xml">
            <form string="刀具类别">
                <group string="基本信息">
                    <group>
                        <field name="code" readonly="1"/>
                    </group>
                    <group>
                        <field name="name" required="1"/>
                    </group>
                </group>
                <!--                <group string="参数">-->
                <!--                    <field name="type_ids" string="刀具型号">-->
                <!--                        <tree editable="bottom">-->
                <!--                            <field name="category_id" invisible="True"/>-->
                <!--                            <field name="code" string="编码" required="True"/>-->
                <!--                            <field name="name" string="名称" required="True"/>-->
                <!--                            <field name="diameter" string="直径" required="True"/>-->
                <!--                            <field name="long_blade" string="避空长/刃长" required="True"/>-->
                <!--                            <field name="cone_angle_pitch" string="锥角/节距" required="True"/>-->
                <!--                            <field name="shank_diameter" string="柄径" required="True"/>-->
                <!--                            <field name="taper_shank_length" string="锥柄" required="True"/>-->
                <!--                            <field name="tool_length" string="刀具总长" required="True"/>-->
                <!--                            <field name="blade_number" string="刃数" required="True"/>-->
                <!--                            <field name="remark" string="备注"/>-->
                <!--                            <field name="active" string="有效"/>-->
                <!--                        </tree>-->
                <!--                    </field>-->
                <!--                </group>-->
                <group string="其它">
                    <field name="remark"/>
                </group>
            </form>
        </field>
    </record>

    <record id="action_sf_cutting_tool_category" model="ir.actions.act_window">
        <field name="name">刀具类别</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sf.cutting_tool.category</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                [刀具类别] 还没有哦！点左上角的[创建]按钮，沙发归你了!
            </p>
            <p>
            </p>
        </field>
    </record>

    #------------------机床注册------------------

    <record model="ir.ui.view" id="search_sf_machine_tool_view">
        <field name="name">search.sf.machine_tool</field>
        <field name="model">sf.machine_tool</field>
        <field name="arch" type="xml">
            <search string="机床">
                <field name="name" string="名称" filter_domain="[('name', 'ilike', self)]"/>
                <field name="type_id" string="型号" filter_domain="[('type_id', 'ilike', self)]"/>
                <searchpanel>
                    <field name="brand_id" icon="fa-building" enable_counters="1"/>
                    <!--                        <field name="type_id" icon="fa-users" enable_counters="1"/>-->
                </searchpanel>
            </search>

        </field>
    </record>

    <record model="ir.ui.view" id="tree_sf_machine_tool_view">
        <field name="name">tree.sf.machine_tool</field>
        <field name="model">sf.machine_tool</field>
        <field name="arch" type="xml">
            <tree string="机床">
                <field name="code"/>
                <field name="name"/>
                <field name="brand_id"/>
                <field name="type_id"/>
                <field name="state_zc"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="sf_machine_tool_form">
        <field name="name">form.sf.machine_tool</field>
        <field name="model">sf.machine_tool</field>
        <field name="arch" type="xml">
            <form string="机床">
                <header>
                    <button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册" attrs="{'invisible': [('code','!=',False)]}"/>
                </header>
                <group string="基本信息">
                    <group>
                        <field name="MTcode" string="编码"/>


                        <field name="brand_id"
                               required="1"
                               domain="[('tag_ids', '=', '机床')]"
                               options="{'no_create': True}"/>
                    </group>
                    <group>
                        <field name="name" required="1"/>
                        <field name="type_id" required="1" options="{'no_create': True}"
                               domain="[('brand_id', '=', brand_id)]" attrs="{'invisible': [('brand_id','=',False)]}"/>
                    </group>

                    <group>
                        <field name="code" readonly="1" string="行业编码" force_save="1"/>
                    </group>
                </group>
                <notebook>
                    <page string="参数">
                        <group string="参数">
                            <group>
                                <field name="knife_type" required="1"/>
                                <field name="number_of_knife_library" required="1" options="{'format': false}"/>
                                <field name="number_of_axles" widget="radio" options="{'horizontal': true}"/>
                                <label for="x_axis" string="加工行程(mm)"
                                       attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
                                <div class="o_address_format"
                                     attrs="{'invisible': [('number_of_axles', '=', False)]}">
                                    <label for="x_axis" string="x"/>
                                    <field name="x_axis" class="o_address_city" required="1" options="{'format': false}"/>
                                    <label for="y_axis" string="y"/>
                                    <field name="y_axis" class="o_address_zip" required="1" options="{'format': false}"/>
                                    <label for="z_axis" string="z"/>
                                    <field name="z_axis" class="o_address_zip" required="1" options="{'format': false}"/>
                                    <label for="b_axis" string="b"
                                           attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"/>
                                    <field name="b_axis" class="o_address_city" required="1"
                                           attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
                                           options="{'format': false}"/>
                                    <label for="c_axis" string="c"
                                           attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
                                    <field name="c_axis" class="o_address_zip" required="1"
                                           attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
                                           options="{'format': false}"/>
                                </div>
                            </group>
                            <group>
                                <field name="rotate_speed" required="1" string="转速(min)" options="{'format': false}"/>
                                <field name="precision" required="1" string="加工精度(mm)"/>
                                <field name="control_system_id" required="1" options="{'no_create': True}"/>
                                 <field name="state" widget="selection"/>
                            </group>
                        </group>
                    </page>
                    <page string="其他">
                        <group string="其他">
                            <field name="remark"/>
                        </group>
                    </page>
                </notebook>
            </form>
        </field>
    </record>

    <record id="action_sf_machine_tool" model="ir.actions.act_window">
        <field name="name">机床</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sf.machine_tool</field>
        <field name="view_mode">tree,form</field>
        <!--        <field name="search_view_id" ref="view_okr_filter"/>-->
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                [机床] 还没有哦！点左上角的[创建]按钮，沙发归你了!
            </p>
            <p>
            </p>
        </field>
    </record>

    #------------------控制系统------------------

    <record model="ir.ui.view" id="search_sf_machine_control_system_view">
        <field name="name">search.sf.machine.control_system</field>
        <field name="model">sf.machine.control_system</field>
        <field name="arch" type="xml">
            <search string="控制系统">
                <field name="name" string="模糊搜索"
                       filter_domain="['|',('name', 'ilike', self),('code', 'ilike', self)]"/>
            </search>
        </field>
    </record>

    <record model="ir.ui.view" id="tree_sf_machine_control_system_view">
        <field name="name">tree.sf.machine.control_system</field>
        <field name="model">sf.machine.control_system</field>
        <field name="arch" type="xml">
            <tree string="控制系统">
                <field name="code"/>
                <field name="name"/>
                <field name="brand_id"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="form_sf_machine_control_system">
        <field name="name">form.sf.machine.control_system</field>
        <field name="model">sf.machine.control_system</field>
        <field name="arch" type="xml">
            <form string="控制系统">
                <group>
                    <group>
                        <field name="code" force_save="1" readonly="1"/>
                        <field name="brand_id" required="1"
                               domain="[('tag_ids', '=', '控制系统')]"
                               options="{'no_create': True}"/>
                    </group>
                    <group>
                        <field name="name" required="1"/>
                    </group>
                </group>
            </form>
        </field>
    </record>

    <record id="action_sf_machine_control_system" model="ir.actions.act_window">
        <field name="name">控制系统</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sf.machine.control_system</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                [控制系统] 还没有哦！点左上角的[创建]按钮，沙发归你了!
            </p>
            <p>
            </p>
        </field>
    </record>
</odoo>