<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="choose_delivery_carrier_view_form" model="ir.ui.view">
        <field name="name">choose.delivery.carrier.form</field>
        <field name="model">choose.delivery.carrier</field>
        <field name="arch" type="xml">
            <form>
                <group>
                    <group>
                        <field name="carrier_id"/>
                        <label name="carried_weight_label" for="total_weight" groups="uom.group_uom"/>
                        <div name="carried_weight" class="o_row" groups="uom.group_uom">
                            <field name="total_weight"/>
                            <field name="weight_uom_name"/>
                        </div>
                        <field name="delivery_type" invisible="1"/>
                        <field name="currency_id" invisible="1"/>
                        <field name="order_id" invisible="1"/>
                        <field name='delivery_price' invisible="1"/>
                        <label for="display_price"/>
                        <div class="o_row">
                            <field name='display_price' widget="monetary" options="{'currency_field': 'currency_id'}" invisible="not carrier_id"/>
                            <button name="update_price" type="object" invisible="delivery_type in ('fixed', 'base_on_rule')">
                                <i class="oi oi-arrow-right me-1"/>Get rate
                            </button>
                        </div>
                    </group>
                </group>
                <div role="alert" class="alert alert-warning" invisible="invoicing_message == ''">
                    <field name="invoicing_message" nolabel="1"/>
                </div>
                <div role="alert" class="alert alert-info" invisible="context.get('no_rate') or not delivery_message">
                    <field name="delivery_message" nolabel="1"/>
                </div>
                <div role="alert" class="alert alert-danger" invisible="not context.get('no_rate') or not delivery_message">
                    <field name="delivery_message" nolabel="1"/>
                </div>
                <footer>
                    <button name="button_confirm" invisible="not context.get('carrier_recompute')" type="object" string="Update" class="btn-primary" data-hotkey="q"/>
                    <button
                        name="button_confirm"
                        type="object"
                        invisible="context.get('carrier_recompute') or not delivery_type in ('fixed', 'base_on_rule') and not display_price"
                        string="Add"
                        class="btn-primary"
                        data-hotkey="q"/>
                    <button
                        name="button_confirm"
                        type="object"
                        invisible="context.get('carrier_recompute') or display_price or delivery_type in ('fixed', 'base_on_rule')"
                        confirm="Are you sure you want the delivery to be free for this order? You might have forgotten to compute the rates."
                        string="Add"
                        class="btn-primary"
                        data-hotkey="q"/>
                    <button string="Discard" special="cancel" data-hotkey="x" class="btn-secondary"/>
                </footer>
            </form>
        </field>
    </record>
</odoo>
