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

    <record id="view_account_payment_form_inherit" model="ir.ui.view">
        <field name="name">account.payment.form.inherit</field>
        <field name="model">account.payment</field>
        <field name="inherit_id" ref="account.view_account_payment_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='destination_journal_id']" position="after">
                <field name="sale_order_id" attrs="{'invisible': [('state', '!=', 'draft'), ('sale_order_id', '=', False)], 'readonly': [('state', '!=', 'draft')]}" groups="account.group_account_readonly"/>
            </xpath>
        </field>
    </record>

</odoo>
