<?xml version="1.0" encoding="UTF-8"?>
<odoo>

    <!-- Action to open all label templates -->
    <record id="action_print_product_label_template" model="ir.actions.act_window">
        <field name="name">Label Templates</field>
        <field name="res_model">print.product.label.template</field>
        <field name="view_mode">list,form</field>
        <field name="context">{'active_test': False}</field>
    </record>

    <!-- Action to open all label sections -->
    <record id="action_print_product_label_section" model="ir.actions.act_window">
        <field name="name">Label Sections</field>
        <field name="res_model">print.product.label.section</field>
        <field name="view_mode">list,form</field>
    </record>

    <!-- Inherit the base Fusion Labels settings form and add Pro settings -->
    <record id="res_config_settings_view_form" model="ir.ui.view">
        <field name="name">res.config.settings.view.form.inherit.fusion_labels_pro</field>
        <field name="model">res.config.settings</field>
        <field name="inherit_id" ref="fusion_labels.res_config_settings_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//block[@id='fusion_labels_general']" position="after">

                <block title="Label Preview" id="fusion_labels_preview">
                    <setting id="fusion_labels_preview_type"
                             string="Template Preview"
                             help="Configure how label templates are previewed in the designer.">
                        <div class="content-group">
                            <div class="mt16">
                                <label for="print_label_preview_type" string="Use in Preview" class="col-3 col-lg-3 o_light_label"/>
                                <field name="print_label_preview_type" class="o_light_label" required="True" widget="radio"/>
                            </div>
                            <div class="mt16" invisible="print_label_preview_type != 'demo_product'">
                                <label for="print_label_preview_product_id" string="Demo Product" class="col-3 col-lg-3 o_light_label"/>
                                <field name="print_label_preview_product_id" class="o_light_label" required="print_label_preview_type == 'demo_product'"/>
                            </div>
                            <div class="mt16">
                                <label for="print_label_preview_pricelist_id" string="Pricelist" class="col-3 col-lg-3 o_light_label"/>
                                <field name="print_label_preview_pricelist_id" class="o_light_label" options="{'no_create': True}"/>
                            </div>
                            <div class="mt16">
                                <label for="print_label_preview_sale_pricelist_id" string="Promo Pricelist" class="col-3 col-lg-3 o_light_label"/>
                                <field name="print_label_preview_sale_pricelist_id" class="o_light_label" options="{'no_create': True}"/>
                            </div>
                        </div>
                    </setting>
                </block>

                <block title="Label Templates" id="fusion_labels_templates">
                    <div class="o_setting_box">
                        <div class="o_setting_left_pane"/>
                        <div class="o_setting_right_pane">
                            <span class="o_form_label">Manage Templates</span>
                            <div class="text-muted">Create and configure label templates and their sections.</div>
                            <div class="mt16">
                                <button name="%(action_print_product_label_template)d"
                                        type="action"
                                        string="Label Templates"
                                        class="btn-link"
                                        icon="fa-arrow-right"/>
                            </div>
                            <div class="mt8">
                                <button name="%(action_print_product_label_section)d"
                                        type="action"
                                        string="Label Sections"
                                        class="btn-link"
                                        icon="fa-arrow-right"/>
                            </div>
                        </div>
                    </div>
                </block>

                <block title="Advanced" id="fusion_labels_advanced">
                    <setting id="fusion_labels_barcode_multiplier"
                             string="Barcode Size Multiplier"
                             help="Multiplier applied to barcode dimensions on labels. Increase for larger barcodes.">
                        <field name="barcode_multiplier"/>
                    </setting>
                    <setting id="fusion_labels_template_limit"
                             string="Template Display Limit"
                             help="Maximum number of label templates shown in the print wizard selection.">
                        <field name="show_label_template_limit"/>
                    </setting>
                </block>

            </xpath>
        </field>
    </record>

</odoo>
