<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- ================================================================= -->
    <!-- VENDOR FORM: Add Block Email Bill checkbox -->
    <!-- ================================================================= -->
    <record id="view_partner_form_fusion_accounts" model="ir.ui.view">
        <field name="name">res.partner.form.fusion.accounts</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="priority">50</field>
        <field name="arch" type="xml">
            <xpath expr="//page[@name='internal_notes']" position="before">
                <page string="Fusion Accounts" name="fusion_accounts">
                    <group>
                        <group string="Email Bill Settings">
                            <field name="x_fa_block_email_bill" widget="boolean_toggle"/>
                            <div class="alert alert-info" role="alert" colspan="2"
                                 invisible="not x_fa_block_email_bill">
                                <i class="fa fa-info-circle"/>
                                Emails from this vendor will <strong>not</strong> create vendor bills automatically.
                                Bills for this vendor should be created through Purchase Orders.
                            </div>
                        </group>
                    </group>
                </page>
            </xpath>
        </field>
    </record>

    <!-- ================================================================= -->
    <!-- FUSION ACCOUNTS: Custom Vendor List View (clean actions) -->
    <!-- ================================================================= -->
    <record id="view_partner_list_fusion_accounts" model="ir.ui.view">
        <field name="name">res.partner.list.fusion.accounts</field>
        <field name="model">res.partner</field>
        <field name="priority">99</field>
        <field name="arch" type="xml">
            <list string="Vendors" multi_edit="1">
                <header>
                    <button name="action_fa_block_vendors" type="object"
                            string="Block Email Bills" class="btn-secondary"
                            icon="fa-ban"/>
                    <button name="action_fa_enable_vendors" type="object"
                            string="Enable Email Bills" class="btn-secondary"
                            icon="fa-check"/>
                </header>
                <field name="name"/>
                <field name="email"/>
                <field name="phone"/>
                <field name="x_fa_block_email_bill" string="Blocked" widget="boolean_toggle"/>
                <field name="supplier_rank" column_invisible="True"/>
            </list>
        </field>
    </record>

    <!-- ================================================================= -->
    <!-- Add block/enable methods to res.partner -->
    <!-- ================================================================= -->
</odoo>
