<?xml version="1.0" ?>
<odoo>
    <menuitem
        name="Printing"
        id="printing_menu"
        sequence="1"
        parent="base.menu_administration"
        groups="printing_group_manager"
    />
    <record model="ir.ui.view" id="printing_printer_view_form">
        <field name="name">printing.printer.form (in base_report_to_printer)</field>
        <field name="model">printing.printer</field>
        <field name="arch" type="xml">
            <form string="Printers">
                <header>
                    <button
                        name="enable"
                        type="object"
                        string="Enable"
                        attrs="{'invisible': [('status', 'in', ('available', 'printing'))]}"
                    />
                    <button
                        name="disable"
                        type="object"
                        string="Disable"
                        attrs="{'invisible': [('status', '=', 'unavailable')]}"
                    />
                    <button
                        name="action_cancel_all_jobs"
                        type="object"
                        string="Cancel all running jobs"
                        confirm="Are you sure to want to cancel all jobs of this printer?"
                    />
                    <button
                        name="print_test_page"
                        type="object"
                        string="Print Test Page"
                        confirm="Are you sure to want to print a test page?"
                    />
                </header>
                <sheet>
                    <widget
                        name="web_ribbon"
                        text="Archived"
                        bg_color="bg-danger"
                        attrs="{'invisible': [('active', '=', True)]}"
                    />
                    <field name="active" invisible="1" />
                    <div class="oe_title">
                        <h1>
                            <field name="name" />
                        </h1>
                    </div>
                    <group name="name">
                        <field name="system_name" />
                        <field name="server_id" />
                    </group>
                    <group col="4" colspan="4" name="default">
                        <field name="default" />
                        <button
                            name="set_default"
                            string="Set Default"
                            type="object"
                            attrs="{'invisible': [('default','=', True)]}"
                            colspan="2"
                        />
                        <button
                            name="unset_default"
                            string="Unset Default"
                            type="object"
                            attrs="{'invisible': [('default','=', False)]}"
                            colspan="2"
                        />
                    </group>
                    <group name="details">
                        <field name="uri" />
                        <field name="model" />
                        <field name="location" />
                        <field name="status" />
                        <field name="status_message" />
                        <field name="multi_thread" />
                    </group>
                    <group string="Trays" name="trays">
                        <field name="tray_ids" nolabel="1" colspan="2">
                            <form>
                                <group name="name_fields">
                                    <field name="name" />
                                    <field name="system_name" />
                                </group>
                            </form>
                        </field>
                    </group>
                    <group name="jobs" string="Jobs">
                        <field name="job_ids" nolabel="1" colspan="2" />
                    </group>
                </sheet>
            </form>
        </field>
    </record>
    <record model="ir.ui.view" id="printing_printer_view_tree">
        <field name="name">printing.printer.tree (in base_report_to_printer)</field>
        <field name="model">printing.printer</field>
        <field name="arch" type="xml">
            <tree
                decoration-success="status=='available'"
                decoration-warning="status=='printing'"
                decoration-danger="status not in ['printing', 'available']"
            >
                <field name="default" />
                <field name="name" />
                <field name="system_name" />
                <field name="server_id" />
                <field name="status" />
            </tree>
        </field>
    </record>
    <record model="ir.ui.view" id="printing_printer_view_search">
        <field name="name">printing.printer.search (in base_report_to_printer)</field>
        <field name="model">printing.printer</field>
        <field name="arch" type="xml">
            <search string="Printers">
                <field name="name" />
                <field name="system_name" />
                <field name="location" />
                <field name="status" />
                <filter
                    string="Archived"
                    name="inactive"
                    domain="[('active', '=', False)]"
                />
            </search>
        </field>
    </record>
    <record model="ir.actions.act_window" id="printing_printer_action">
        <field name="name">Show Printers</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">printing.printer</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem
        name="Printers"
        sequence="20"
        id="printing_printer_menu"
        parent="printing_menu"
        action="printing_printer_action"
    />
</odoo>
