<?xml version="1.0"?>
<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
    <data>

        <record model="res.group" id="group_product_admin">
            <field name="name">Product Administration</field>
        </record>
        <record model="res.user-res.group" id="user_admin_group_product_admin">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_product_admin"/>
        </record>
        <record model="res.user-res.group" id="user_trigger_group_product_admin">
            <field name="user" ref="res.user_trigger"/>
            <field name="group" ref="group_product_admin"/>
        </record>

        <record model="ir.ui.icon" id="product_icon">
            <field name="name">tryton-product</field>
            <field name="path">icons/tryton-product.svg</field>
        </record>
        <menuitem name="Product" id="menu_main_product" sequence="1"
            icon="tryton-product"/>

        <record model="ir.ui.view" id="template_view_tree">
            <field name="model">product.template</field>
            <field name="type">tree</field>
            <field name="name">template_tree</field>
        </record>

        <record model="ir.ui.view" id="template_view_form">
            <field name="model">product.template</field>
            <field name="type">form</field>
            <field name="name">template_form</field>
        </record>

        <record model="ir.action.act_window" id="act_template_form">
            <field name="name">Products</field>
            <field name="res_model">product.template</field>
        </record>
        <record model="ir.action.act_window.view" id="act_template_list_view">
            <field name="sequence" eval="10"/>
            <field name="view" ref="template_view_tree"/>
            <field name="act_window" ref="act_template_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_template_form_view">
            <field name="sequence" eval="20"/>
            <field name="view" ref="template_view_form"/>
            <field name="act_window" ref="act_template_form"/>
        </record>

        <menuitem parent="menu_main_product" sequence="1" id="menu_template"
            action="act_template_form"/>

        <record model="ir.action.act_window" id="act_template_by_category">
            <field name="name">Product by Category</field>
            <field name="res_model">product.template</field>
            <field name="context">{'categories': [Eval('active_id')]}</field>
            <field name="domain">[('category','child_of', [Eval('active_id')], 'parent')]</field>
        </record>
        <record model="ir.action.act_window.view" id="act_template_by_category_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="template_view_tree"/>
            <field name="act_window" ref="act_template_by_category"/>
        </record>
        <record model="ir.action.act_window.view" id="act_template_by_category_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="template_view_form"/>
            <field name="act_window" ref="act_template_by_category"/>
        </record>
        <record model="ir.action.keyword" id="act_template_by_category_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model">product.category,-1</field>
            <field name="action" ref="act_template_by_category"/>
        </record>

        <record model="ir.ui.view" id="product_view_tree">
            <field name="model">product.product</field>
            <field name="type">tree</field>
            <field name="inherit" eval="None"/>
            <field name="name">product_tree</field>
        </record>

        <record model="ir.ui.view" id="product_view_form">
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field name="inherit" eval="None"/>
            <field name="name">product_form</field>
        </record>

        <record model="ir.action.act_window" id="act_product_form">
            <field name="name">Variants</field>
            <field name="res_model">product.product</field>
        </record>
        <record model="ir.action.act_window.view" id="act_product_list_view">
            <field name="sequence" eval="10"/>
            <field name="view" ref="product_view_tree"/>
            <field name="act_window" ref="act_product_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_product_form_view">
            <field name="sequence" eval="20"/>
            <field name="view" ref="product_view_form"/>
            <field name="act_window" ref="act_product_form"/>
        </record>

        <menuitem parent="menu_template" sequence="1" id="menu_product"
            action="act_product_form"/>

        <record model="ir.model.access" id="access_product">
            <field name="model" search="[('model', '=', 'product.product')]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_product_admin">
            <field name="model" search="[('model', '=', 'product.product')]"/>
            <field name="group" ref="group_product_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.model.access" id="access_product_template">
            <field name="model" search="[('model', '=', 'product.template')]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_product_template_admin">
            <field name="model" search="[('model', '=', 'product.template')]"/>
            <field name="group" ref="group_product_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.property" id="property_product_cost_price_method">
            <field name="field"
                search="[('model.model', '=', 'product.template'), ('name', '=', 'cost_price_method')]"/>
            <field name="value">,fixed</field>
        </record>

    </data>
</tryton>
