<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2021 Sygel - Valentin Vinagre
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
    <record id="crm_salesperson_planner_visit_close_wiz_view_form" model="ir.ui.view">
        <field name="name">crm.salesperson.lost.form</field>
        <field name="model">crm.salesperson.planner.visit.close.wiz</field>
        <field name="arch" type="xml">
            <form string="Close Reason">
                <group>
                    <field
                        name="reason_id"
                        options="{'no_create': True, 'no_edit': True, 'no_open': True}"
                        domain="[('close_type','=', context.get('att_close_type', 'cancel'))]"
                    />
                    <field name="notes" />
                    <field name="allow_reschedule" invisible="1" />
                    <field
                        name="reschedule"
                        attrs="{'invisible': [('allow_reschedule', '=', False)]}"
                    />
                    <field
                        name="new_date"
                        attrs="{'invisible': ['|', ('allow_reschedule', '=', False), ('reschedule', '=', False)]}"
                    />
                    <field
                        name="new_sequence"
                        attrs="{'invisible': ['|', ('allow_reschedule', '=', False), ('reschedule', '=', False)]}"
                    />
                    <field name="require_image" invisible="1" />
                    <field
                        name="image"
                        widget="image"
                        attrs="{'invisible': [('require_image', '=', False)], 'required': [('require_image', '=', True)]}"
                    />
                </group>
                <footer>
                    <button
                        name="action_close_reason_apply"
                        string="Submit"
                        type="object"
                        class="btn-primary"
                    />
                    <button string="Cancel" class="btn-secondary" special="cancel" />
                </footer>
            </form>
        </field>
    </record>
    <record
        id="crm_salesperson_planner_visit_close_wiz_action"
        model="ir.actions.act_window"
    >
        <field name="name">Close Reasons</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">crm.salesperson.planner.visit.close.wiz</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="crm_salesperson_planner_visit_close_wiz_view_form" />
        <field name="target">new</field>
    </record>
</odoo>
