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

    <record id="sale_order_form_view_inherit" model="ir.ui.view">
        <field name="name">sale.order.form.inherit</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='state']" position="after">
                <field name="singifyd_score" invisible="1"/>
            </xpath>
            <xpath expr="//div[@name='button_box']" position="inside">
                <field name="signifyd_case_id" invisible="1"/>
                <button name="action_view_signifyd_case" type="object" class="oe_stat_button text-success"
                        icon="fa-flag-checkered"
                        attrs="{'invisible': [ '|', ('singifyd_score', '&lt;=', 600), ('signifyd_case_id', '=', False)]}">
                    <field string="Signifyd Score" name="singifyd_score" widget="statinfo"/>
                </button>
                <button name="action_view_signifyd_case" type="object" class="oe_stat_button text-warning"
                        icon="fa-flag"
                        attrs="{'invisible': [ '|', '|', ('singifyd_score', '&gt;', 600), ('singifyd_score', '&lt;=', 300), ('signifyd_case_id', '=', False)]}">
                    <field string="Signifyd Score" name="singifyd_score" widget="statinfo"/>
                </button>
                <button name="action_view_signifyd_case" type="object" class="oe_stat_button text-danger" icon="fa-flag"
                        attrs="{'invisible': [ '|', ('singifyd_score', '&gt;', 300), ('signifyd_case_id', '=', False)]}">
                    <field string="Signifyd Score" name="singifyd_score" widget="statinfo"/>
                </button>
            </xpath>
            <xpath expr="//field[@name='payment_term_id']" position="after">
                <field name="signifyd_case_id" attrs="{'invisible': [('signifyd_case_id', '=', False)]}"/>
                <field name="signifyd_checkpoint_action" string="Signifyd Status"
                       attrs="{'invisible': [('signifyd_case_id', '=', False)]}"/>
            </xpath>
        </field>
    </record>

    <record id="sale_view_order_tree_inherit" model="ir.ui.view">
        <field name="name">sale.order.tree.inherit</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='invoice_status']" position="after">
                <field name="signifyd_checkpoint_action"/>
            </xpath>
        </field>
    </record>

    <record id="disposition_change" model="mail.message.subtype">
        <field name="name">Signifyd Updated</field>
        <field name="res_model">sale.order</field>
        <field name="default" eval="True"/>
        <field name="description">Signifyd Status Updated</field>
        <field name="relation_field">signifyd_case_id.checkpoint_action</field>
        <field name="internal" eval="True"/>
    </record>

</odoo>