<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record model="ir.ui.view" id="purchase_order_tree">
        <field name="model">purchase.order</field>
        <field name="type">tree</field>
        <field name="inherit_id" ref="purchase.purchase_order_tree" />
        <field name="arch" type="xml">
            <xpath expr="//tree" position="attributes">
                <attribute name="decoration-danger">fop_reached == False</attribute>
            </xpath>
            <field name="origin" position="after">
                <field name="fop_reached" optional="show" />
                <field name="fop_shipping" optional="show" />
            </field>
        </field>
    </record>
    <record model="ir.ui.view" id="purchase_order_view_tree">
        <field name="model">purchase.order</field>
        <field name="type">tree</field>
        <field name="inherit_id" ref="purchase.purchase_order_view_tree" />
        <field name="arch" type="xml">
            <xpath expr="//tree" position="attributes">
                <attribute name="decoration-danger">fop_reached == False</attribute>
            </xpath>
            <field name="origin" position="after">
                <field name="fop_reached" optional="show" />
                <field name="fop_shipping" optional="show" />
            </field>
        </field>
    </record>
    <record model="ir.ui.view" id="purchase_order_kpis_tree">
        <field name="model">purchase.order</field>
        <field name="type">tree</field>
        <field name="inherit_id" ref="purchase.purchase_order_kpis_tree" />
        <field name="arch" type="xml">
            <xpath expr="//tree" position="attributes">
                <attribute name="decoration-danger">fop_reached == False</attribute>
            </xpath>
            <field name="origin" position="after">
                <field name="fop_reached" optional="show" />
            </field>
        </field>
    </record>
    <record model="ir.ui.view" id="purchase_order_delivery_paid_form_view_inherit">
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form" />
        <field name="type">form</field>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='partner_ref']" position="after">
                <field
                    name="force_order_under_fop"
                    groups="purchase_fop_shipping.group_fop_shipping_purchase_manager"
                />
            </xpath>
            <field name="tax_totals" position="after">
                 <field
                    name="fop_shipping"
                    readonly="1"
                    attrs="{'invisible':[('fop_shipping', '=', 0)]}"
                    widget="monetary"
                    options="{'currency_field': 'currency_id'}"
                />
             </field>
        </field>
    </record>
</odoo>
