<odoo>
    <!--
    AvaTax API Configuration in Odoo
    -->
    <record id="view_avalara_salestax_form" model="ir.ui.view">
        <field name="name">avalara.salestax.form</field>
        <field name="model">avalara.salestax</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="AvaTax API">
                <sheet>
                    <group>
                        <group>
                            <field
                                name="company_id"
                                options="{'no_create_edit': True}"
                            />
                        </group>
                        <group>
                            <field name="company_partner_id" />
                            <field name="disable_tax_calculation" />
                            <field name="disable_address_validation" />
                        </group>
                    </group>
                    <notebook>
                        <page string="Connection" name="connection_page">
                        <group>
                            <group>
                                <field name="account_number" />
                                <field name="license_key" password="True" />
                                <label for="service_url" string="Service URL" />
                                <div>
                                    <field name="service_url" class="oe_inline" />
                                    <button
                                            name="%(account_avatax_oca.action_avalara_salestax_ping)d"
                                            string="Test Connection"
                                            type="action"
                                            icon="fa-arrow-right"
                                            class="btn-link"
                                        />
                                </div>
                                <label for="company_code" string="Company Code" />
                                <div>
                                    <field name="company_code" class="oe_inline" />
                                    <button
                                            name="%(account_avatax_oca.action_avalara_salestax_getcompany)d"
                                            string="Select Company"
                                            type="action"
                                            icon="fa-arrow-right"
                                            class="btn-link"
                                        />
                                </div>
                                <a
                                        colspan="2"
                                        href="https://admin.avalara.com/"
                                        target="_blank"
                                    >Visit the AvaTax Admin webpage</a>
                            </group>
                            </group>
                        </page>

                        <page
                            string="Tax Calculation"
                            name="calculation_page"
                            attrs="{'invisible': [('disable_tax_calculation', '=', True)]}"
                        >
                        <div
                                class="row mt16 o_settings_container"
                                id="calculation_page_container"
                            >
                            <div class="col-lg-6 o_setting_box">
                                <div class="o_setting_left_pane">
                                    <field name="disable_tax_reporting" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="disable_tax_reporting" />
                                </div>
                            </div>
                            <div class="col-lg-6 o_setting_box">
                                <div class="o_setting_left_pane">
                                    <field name="upc_enable" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="upc_enable" />
                                </div>
                            </div>
                            <div class="col-lg-6 o_setting_box">

                                <div class="o_setting_left_pane">
                                    <field name="invoice_calculate_tax" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="invoice_calculate_tax" />
                                </div>
                            </div>
                            <div class="col-lg-6 o_setting_box">

                                <div class="o_setting_left_pane">
                                    <field name="use_so_partner_id" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="use_so_partner_id" />
                                </div>
                            </div>
                            <div class="col-lg-6 o_setting_box">

                                <div class="o_setting_left_pane">
                                    <field name="hide_exemption" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="hide_exemption" />
                                </div>
                            </div>
                        </div>
                        </page>

                        <page
                            string="Address Validation"
                            name="address_page"
                            attrs="{'invisible': [('disable_address_validation', '=', True)]}"
                        >
                        <div
                                class="row mt16 o_settings_container"
                                id="address_page_container"
                            >
                            <div class="col-lg-6 o_setting_box">
                                <div class="o_setting_left_pane">
                                    <field name="validation_on_save" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="validation_on_save" />
                                </div>
                            </div>
                            <div class="col-lg-6 o_setting_box">
                                <div class="o_setting_left_pane">
                                    <field name="force_address_validation" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="force_address_validation" />
                                </div>
                            </div>
                            <div class="col-lg-6 o_setting_box">
                                <div class="o_setting_left_pane">
                                    <field name="result_in_uppercase" />
                                </div>
                                <div class="o_setting_right_pane">
                                    <label for="result_in_uppercase" />
                                </div>
                            </div>
                        </div>
                        </page>
                        <page string="Advanced" name="advanced_page">
                            <div
                                class="row mt16 o_settings_container"
                                id="advanced_page_container"
                            >
                                <div class="col-lg-6 o_setting_box">
                                    <div class="o_setting_left_pane">
                                        <field name="auto_generate_customer_code" />
                                    </div>
                                    <div class="o_setting_right_pane">
                                        <label for="auto_generate_customer_code" />
                                    </div>
                                </div>
                                <div class="col-lg-6 o_setting_box">
                                    <div class="o_setting_left_pane">
                                        <field name="logging" />
                                    </div>
                                    <div class="o_setting_right_pane">
                                        <label for="logging" />
                                    </div>
                                </div>
                            </div>
                            <group>
                                <field name="request_timeout" />
                                <field name="country_ids" widget="many2many_tags" />
                            </group>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>
    <record id="view_avalara_salestax_tree" model="ir.ui.view">
        <field name="name">avalara.salestax.tree</field>
        <field name="model">avalara.salestax</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree>
                <field name="company_id" groups="base.group_multi_company" />
                <field name="company_code" />
                <field name="account_number" />
                <field name="service_url" />
            </tree>
        </field>
    </record>
    <record id="action_avalara_salestax" model="ir.actions.act_window">
        <field name="name">AvaTax API</field>
        <field name="res_model">avalara.salestax</field>
        <field name="binding_view_types">tree</field>
        <field name="view_mode">tree,form</field>
        <field name="help">Configuration of AvaTax in odoo</field>
    </record>
    <menuitem
        id="menu_avatax"
        name="AvaTax"
        parent="account.menu_finance_configuration"
        sequence="2"
    />
    <menuitem
        action="action_avalara_salestax"
        id="menu_avatax_api"
        name="AvaTax API"
        parent="menu_avatax"
        sequence="30"
    />
    <record id="exemption_code_tree_view" model="ir.ui.view">
        <field name="name">exemption.code.tree.view</field>
        <field name="model">exemption.code</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name" />
                <field name="code" />
            </tree>
        </field>
    </record>
    <record id="action_exemption_code_details" model="ir.actions.act_window">
        <field name="name">Exemption Code</field>
        <field name="res_model">exemption.code</field>
        <field name="binding_view_types">tree</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem
        action="action_exemption_code_details"
        id="menu_action_exemption_code_details"
        parent="menu_avatax"
        sequence="25"
    />
</odoo>
