<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <record id="view_res_partner_map" model="ir.ui.view">
        <field name="name">view.res.partner.map</field>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <map class="o_res_partner_map" library="geometry" string="Map" lat="partner_latitude" lng="partner_longitude" colors="blue:company_type=='person';green:company_type=='company';">
                <field name="id"/>
                <field name="partner_latitude"/>
                <field name="partner_longitude"/>
                <field name="company_type"/>
                <field name="color"/>
                <field name="display_name"/>
                <field name="title"/>
                <field name="email"/>
                <field name="parent_id"/>
                <field name="is_company"/>
                <field name="function"/>
                <field name="phone"/>
                <field name="street"/>
                <field name="street2"/>
                <field name="zip"/>
                <field name="city"/>
                <field name="country_id"/>
                <field name="mobile"/>
                <field name="state_id"/>
                <field name="category_id"/>
                <field name="image_small"/>
                <field name="type"/>
                <templates>
                    <t t-name="kanban-box">
                        <div class="oe_kanban_global_click o_res_partner_kanban">
                            <div class="o_kanban_image">
                                <t t-if="record.image_small.raw_value">
                                    <img t-att-src="kanban_image('res.partner', 'image_small', record.id.raw_value)"/>
                                </t>
                                <t t-if="!record.image_small.raw_value">
                                    <t t-if="record.type.raw_value === 'delivery'">
                                        <img t-att-src='_s + "/base/static/src/img/truck.png"' class="o_kanban_image oe_kanban_avatar_smallbox"/>
                                    </t>
                                    <t t-if="record.type.raw_value === 'invoice'">
                                        <img t-att-src='_s + "/base/static/src/img/money.png"' class="o_kanban_image oe_kanban_avatar_smallbox"/>
                                    </t>
                                    <t t-if="record.type.raw_value != 'invoice' &amp;&amp; record.type.raw_value != 'delivery'">
                                        <t t-if="record.is_company.raw_value === true">
                                            <img t-att-src='_s + "/base/static/src/img/company_image.png"'/>
                                        </t>
                                        <t t-if="record.is_company.raw_value === false">
                                            <img t-att-src='_s + "/base/static/src/img/avatar.png"'/>
                                        </t>
                                    </t>
                                </t>
                            </div>
                            <div class="oe_kanban_details">
                                <strong class="o_kanban_record_title oe_partner_heading">
                                    <field name="display_name"/>
                                </strong>
                                <div class="o_kanban_tags_section oe_kanban_partner_categories">
                                    <span class="oe_kanban_list_many2many">
                                        <field name="category_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
                                    </span>
                                </div>
                                <ul>
                                    <li t-if="record.parent_id.raw_value and !record.function.raw_value">
                                        <field name="parent_id"/>
                                    </li>
                                    <li t-if="!record.parent_id.raw_value and record.function.raw_value">
                                        <field name="function"/>
                                    </li>
                                    <li t-if="record.parent_id.raw_value and record.function.raw_value">
                                        <field name="function"/> at <field name="parent_id"/>
                                    </li>
                                    <li t-if="record.city.raw_value and !record.country_id.raw_value">
                                        <field name="city"/>
                                    </li>
                                    <li t-if="!record.city.raw_value and record.country_id.raw_value">
                                        <field name="country_id"/>
                                    </li>
                                    <li t-if="record.city.raw_value and record.country_id.raw_value">
                                        <field name="city"/>
                ,                        <field name="country_id"/>
                                    </li>
                                    <li t-if="record.email.raw_value" class="o_text_overflow">
                                        <field name="email"/>
                                    </li>
                                </ul>
                                <div class="oe_kanban_partner_links"/>
                            </div>
                        </div>
                    </t>
                </templates>
            </map>
        </field>
    </record>

    <record id="contacts.action_contacts" model="ir.actions.act_window">
        <field name="view_mode">kanban,tree,form,activity,map</field>
    </record>

    <record id="action_contacts_view_map" model="ir.actions.act_window.view">
        <field name="sequence" eval="3"/>
        <field name="view_mode">map</field>
        <field name="view_id" ref="view_res_partner_map"/>
        <field name="act_window_id" ref="contacts.action_contacts"/>
    </record>

</odoo>
