<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="project_sharing_inherit_project_task_view_form" model="ir.ui.view">
        <field name="name">project.task.view.inherit</field>
        <field name="model">project.task</field>
        <field name="priority">300</field>
        <field name="inherit_id" ref="project.project_sharing_project_task_view_form"/>
        <field name="arch" type="xml">
            <div name="button_box" position="inside">
                <field name="display_sale_order_button" invisible="1"/>
                <field name="allow_billable" invisible="1"/>
                <button class="oe_stat_button"
                        type="object" name="action_project_sharing_view_so" icon="fa-dollar"
                        invisible="not display_sale_order_button">
                        <div class="o_stat_info">
                            <span class="o_stat_text">Sales Order</span>
                        </div>
                </button>
            </div>
            <xpath expr="//field[@name='partner_id']" position="attributes">
                <attribute name="invisible">not allow_billable</attribute>
            </xpath>
            <xpath expr="//field[@name='partner_id']" position="after">
                <field name="sale_line_id" string="Sales Order Item" options='{"no_open": True}' readonly="1" invisible="not partner_id" context="{'create': False, 'edit': False, 'delete': False}"/>
            </xpath>
            <xpath expr="//field[@name='child_ids']/tree/field[@name='partner_id']" position="after">
                <field name="allow_billable" invisible="1"/>
            </xpath>
            <xpath expr="//field[@name='child_ids']/tree/field[@name='partner_id']" position="attributes">
                <attribute name="column_invisible">not parent.allow_billable</attribute>
                <attribute name="invisible">not allow_billable</attribute>
            </xpath>
        </field>
    </record>

</odoo>
