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

<record id="image_form_view" model="ir.ui.view">
    <field name="name">Multi image form</field>
    <field name="model">base_multi_image.image</field>
    <field name="arch" type="xml">
        <form string="Image">
            <sheet>
                <group>
                    <group
                            string="Owner"
                            attrs="{
                                'invisible': [
                                    ('show_technical', '=', False),
                                ],
                            }"
                        >
                        <field name="show_technical" invisible="True" />
                        <field name="owner_model" />
                        <field name="owner_id" />
                        <field name="owner_ref_id" />
                    </group>
                    <group string="Image">
                        <field name="name" />
                        <field
                                name="image_1920"
                                widget="image"
                                class="oe_avatar"
                                nolabel="1"
                                colspan="2"
                                options="{'preview_image': 'image_128'}"
                            />
                        <field name="image_128" invisible="1" />
                        <field name="load_from" />
                    </group>
                </group>
                <group string="Options" name="option">
                    <field name="sequence" />
                </group>
                <group string="Comments">
                    <field name="comments" colspan="2" nolabel="1" />
                </group>
            </sheet>
        </form>
    </field>
</record>

<record id="image_tree_view" model="ir.ui.view">
    <field name="name">Multi image tree</field>
    <field name="model">base_multi_image.image</field>
    <field name="arch" type="xml">
        <tree>
            <field name="name" />
            <field name="owner_model" />
            <field name="owner_id" />
            <field name="sequence" invisible="True" />
        </tree>
    </field>
</record>

<record id="image_kanban_view" model="ir.ui.view">
    <field name="name">Multi image kanban</field>
    <field name="model">base_multi_image.image</field>
    <field name="arch" type="xml">
        <kanban string="Images">
            <field name="id" />
            <field name="name" />
            <field name="sequence" />
            <templates>
                <t t-name="kanban-box">
                    <div style="position: relative">
                        <a
                                t-if="! read_only_mode"
                                type="delete"
                                style="position: absolute; right: 0; padding: 4px; diplay: inline-block"
                            >X</a>
                        <div class="oe_module_vignette">
                            <a type="open">
                                <img
                                        t-att-alt="record.name"
                                        t-att-src="kanban_image(
                                            'base_multi_image.image',
                                            'image_128',
                                            record.id.raw_value)"
                                        class="oe_kanban_image"
                                    />
                            </a>
                            <div class="oe_module_desc">
                                <div
                                        class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border"
                                    >
                                    <table class="oe_kanban_table" name="main_table">
                                        <tr>
                                            <td
                                                    class="oe_kanban_title1"
                                                    align="left"
                                                    valign="middle"
                                                >
                                                <h4>
                                                    <a type="open">
                                                        <field name="name" />
                                                    </a>
                                                </h4>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </t>
            </templates>
        </kanban>
    </field>
</record>

<record id="image_action" model="ir.actions.act_window">
    <field name="name">Multi images</field>
    <field name="res_model">base_multi_image.image</field>
    <field name="view_mode">kanban,tree,form</field>
    <field name="help">Click to add an image attached to an specific record.</field>
</record>

<menuitem id="image_menu" action="image_action" parent="base.menu_custom" />

</odoo>
