<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2017-2020 Akretion (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>

<!-- In the official account module, on product category and product template,
some fields/groups are on account.group_account_invoice, some on
account.group_account_user and some on account.group_account_manager
Here, we set all those fields on account.group_account_invoice
-->

<record id="product_template_form_view" model="ir.ui.view">
    <field name="name">account_usability.product.template.form</field>
    <field name="model">product.template</field>
    <field name="priority">100</field> <!-- when you replace a field, it's always better to inherit at the end -->
    <field name="inherit_id" ref="account.product_template_form_view"/>
    <field name="arch" type="xml">
        <field name="property_account_income_id" position="attributes">
            <attribute name="groups">account.group_account_invoice</attribute>
        </field>
        <field name="property_account_expense_id" position="attributes">
            <attribute name="groups">account.group_account_invoice</attribute>
        </field>
        <field name="list_price" position="replace">
            <div name="list_price">
                <field name="list_price" widget='monetary' options="{'currency_field': 'currency_id', 'field_digits': True}" class="oe_inline"/>
                <label for="sale_price_type" string=" "/>
                <field name="sale_price_type"/>
            </div>
        </field>
    </field>
</record>

<record id="view_category_property_form" model="ir.ui.view">
    <field name="name">account_usability.product.category.form</field>
    <field name="model">product.category</field>
    <field name="inherit_id" ref="account.view_category_property_form"/>
    <field name="arch" type="xml">
        <group name="account_property" position="attributes">
            <attribute name="groups">account.group_account_invoice</attribute>
        </group>
    </field>
</record>

<record id="product_supplierinfo_form_view" model="ir.ui.view">
    <field name="name">account_usability.product.supplierinfo.form</field>
    <field name="model">product.supplierinfo</field>
    <field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
    <field name="arch" type="xml">
        <field name="currency_id" position="after">
            <field name="purchase_price_type"/>
        </field>
    </field>
</record>

<record id="product_supplierinfo_tree_view" model="ir.ui.view">
    <field name="name">account_usability.product.supplierinfo.tree</field>
    <field name="model">product.supplierinfo</field>
    <field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
    <field name="arch" type="xml">
        <field name="price" position="after">
            <field name="purchase_price_type" string="Tax"/>
        </field>
    </field>
</record>


</odoo>
