<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="0">
        <!-- 更新序号规则 Auto Internal Reference. -->
        <!-- 所有的 All Products. -->
        <record id="seq_product_auto" model="ir.sequence">
            <field name="name">Sequence for All Products</field>
            <field name="code">product.product</field>
            <field name="prefix">P%(y)s%(month)s</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
            <field name="initial">True</field>
        </record>
        <!-- 制造的成品 manufactured Products. -->
        <record id="seq_mrp_product" model="ir.sequence">
            <field name="name">Sequence for Manufactured Product</field>
            <field name="code">product.product</field>
            <field name="prefix">D%(y)s%(month)s</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
            <field name="initial">True</field>
        </record>
        <!-- 制造的原料 Components.-->
        <record id="seq_sourced_material" model="ir.sequence">
            <field name="name">Sequence for Components Product</field>
            <field name="code">product.product</field>
            <field name="prefix">C%(y)s%(month)s</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
            <field name="initial">True</field>
        </record>
        <!-- 采购的成品  Sourced Products.-->
        <record id="seq_sourced_product" model="ir.sequence">
            <field name="name">Sequence for Sourced Product</field>
            <field name="code">product.product</field>
            <field name="prefix">S%(y)s%(month)s</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
            <field name="initial">True</field>
        </record>
        <!-- 服务与费用 Service-->
        <record id="seq_service" model="ir.sequence">
            <field name="name">Service</field>
            <field name="code">product.product</field>
            <field name="prefix">V%(y)s%(month)s</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
            <field name="initial">True</field>
        </record>
    </data>
    <data noupdate="0">
        <!-- internal_type 数据-->
        <record id="internal_type_mrp_product" model="product.internal.type">
            <field name="name">Manufactured Product</field>
            <field name="ref">d</field>
            <field name="type">product</field>
            <field name="sale_ok">1</field>
            <field name="purchase_ok">0</field>
            <field name="route_ids" eval="[(6,0, [ref('mrp.route_warehouse0_manufacture'),ref('stock.route_warehouse0_mto')])]"/>
            <field name="description">Set prefix as "D" in link sequence</field>
            <field name="link_sequence" ref="seq_mrp_product"/>
        </record>
        <record id="internal_type_sourced_material" model="product.internal.type">
            <field name="name">Components Product</field>
            <field name="ref">c</field>
            <field name="type">product</field>
            <field name="sale_ok">0</field>
            <field name="purchase_ok">1</field>
            <field name="route_ids" eval="[(6,0, [ref('purchase.route_warehouse0_buy'),ref('stock.route_warehouse0_mto')])]"/>
            <field name="description">Set prefix as "C" in link sequence</field>
            <field name="link_sequence" ref="seq_sourced_material"/>
        </record>
        <record id="internal_type_sourced_product" model="product.internal.type">
            <field name="name">Sourced Product</field>
            <field name="ref">s</field>
            <field name="type">product</field>
            <field name="sale_ok">1</field>
            <field name="purchase_ok">1</field>
            <field name="route_ids" eval="[(6,0, [ref('purchase.route_warehouse0_buy'),ref('stock.route_warehouse0_mto')])]"/>
            <field name="description">Set prefix as "S" in link sequence</field>
            <field name="link_sequence" ref="seq_sourced_product"/>
        </record>
        <record id="internal_type_service" model="product.internal.type">
            <field name="name">Service</field>
            <field name="ref">v</field>
            <field name="type">service</field>
            <field name="sale_ok">1</field>
            <field name="purchase_ok">1</field>
            <field name="route_ids" eval="[(5)]"/>
            <field name="description">Set prefix as "V" in link sequence</field>
            <field name="link_sequence" ref="seq_service"/>
        </record>

        <!--设置产品默认值为制造产品-->
        <record id="product_internal_type_default" model="ir.values">
            <field name="name">internal_type</field>
            <field name="model">product.template</field>
            <field name="key">default</field>
            <field name="key2"></field>
            <field name="company_id" ref="base.main_company"/>
            <field name="value" eval="'I' + str(ref('app_product_type_sequence.internal_type_mrp_product'))+'\n.'"/>
        </record>
    </data>
</odoo>
