<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="view_partner_form" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="arch" type="xml">
            <field name="industry_id" position="after">
                <field name="brand_id" invisible="not is_company" />
            </field>
            <field name="image_1920" position="before">
                <field
                    name="brand_logo"
                    widget="image"
                    class="oe_avatar"
                    invisible="not brand_logo"
                />
            </field>
        </field>
    </record>

    <record id="view_partner_tree" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_tree" />
        <field name="arch" type="xml">
            <field name="company_id" position="after">
                <field name="brand_id" optional="hide" />
            </field>
        </field>
    </record>

    <record id="view_res_partner_filter" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_res_partner_filter" />
        <field name="arch" type="xml">
            <xpath expr="//group" position="inside">
                <filter
                    name="group_brand"
                    string="Brand"
                    context="{'group_by': 'brand_id'}"
                />
            </xpath>
        </field>
    </record>

    <record id="res_partner_kanban_view" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.res_partner_kanban_view" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='display_name']" position="before">
                <field name="brand_logo" invisible="1" />
                <span
                    title="This company is linked to a brand"
                    invisible="not brand_logo"
                >® &amp;nbsp;</span>
            </xpath>
        </field>
    </record>

    <record model="ir.ui.menu" id="res_brand_menu">
        <field name="name">Brands</field>
        <field name="parent_id" ref="contacts.res_partner_menu_config" />
        <field name="action" ref="brand.res_brand_act_window" />
    </record>
</odoo>
