<data><xpath expr="//field[@name='commitment_date']" position="attributes">
                    <attribute name="decoration-danger">
                        (
                            (
                                commitment_date &lt; effective_date
                                or commitment_date &lt; datetime.datetime.combine(
                                    datetime.date.today(),
                                    datetime.time(0,0,0)
                                ).to_utc().strftime('%Y-%m-%d %H:%M:%S')
                            )
                            and delivery_status in ['pending', 'started']
                            and effective_date &lt;= commitment_date
                            or delivery_status == 'partial'
                        )
                    </attribute>
                </xpath>
                <field name="invoice_status" position="before">
                    <field name="effective_date" column_invisible="True"/>
                    <field name="delivery_status" decoration-success="delivery_status == 'full'" decoration-warning="delivery_status == 'partial'" decoration-info="delivery_status in ['pending', 'started']" widget="badge" optional="hide"/>
                </field>
            </data>