<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="account_view_move_form_inherited" model="ir.ui.view">
        <field name="name">account.view.move.form.inherited</field>
        <field name="model">account.move</field>
        <field name="inherit_id" ref="account.view_move_form"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='button_box']" position="inside">
                <t groups="stock.group_stock_manager">
                    <field name="landed_costs_ids" invisible="1"/>
                    <button string="Landed Costs" type="object"
                        name="action_view_landed_costs"
                        class="oe_stat_button" icon="fa-plus-square"
                        invisible="not landed_costs_ids"/>
                </t>
            </xpath>

            <field name="state" position="before">
                <t groups="stock.group_stock_manager">
                    <field name="landed_costs_visible" invisible="1" />
                    <button name="button_create_landed_costs" class="oe_highlight" string="Create Landed Costs" data-hotkey="l" type="object" groups="account.group_account_invoice" invisible="not landed_costs_visible"/>
                </t>
            </field>

            <xpath expr="//field[@name='invoice_line_ids']/list/field[@name='quantity']" position="before">
                <field name="product_type" column_invisible="True" groups="stock.group_stock_manager"/>
                <field name="is_landed_costs_line" string="Landed Costs" column_invisible="parent.move_type not in ('in_invoice', 'in_receipt')" readonly="product_type != 'service'" optional="hide" groups="stock.group_stock_manager"/>
            </xpath>

            <xpath expr="//field[@name='journal_line_ids' or @name='line_ids']/list/field[@name='name']" position="after">
                <field name="product_type" column_invisible="True" groups="stock.group_stock_manager"/>
                <field name="is_landed_costs_line" column_invisible="True" groups="stock.group_stock_manager"/>
            </xpath>
        </field>
    </record>

</odoo>
