<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="0">

        <!-- Extend res.partner tree view to show is_group and group_order_ids -->
        <record id="view_res_partner_tree_inherit" model="ir.ui.view">
            <field name="name">res.partner.tree.inherit</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//list" position="inside">
                    <field name="member_ids" optional="hide"/>
                    <field name="is_group" optional="hide"/>
                    <field name="group_order_ids" optional="hide"/>
                </xpath>
            </field>
        </record>

        <!-- Extend res.partner form view to show group_ids -->
        <record id="view_res_partner_form_inherit" model="ir.ui.view">
            <field name="name">res.partner.form.inherit</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <!-- Add group_ids page -->
                <xpath expr="//notebook/page[@name='internal_notes']" position="before">
                    <page name="group_orders" string="Group Orders">
                        <group>
                            <group name="group_membership">
                                <field name="is_group" colspan="2"/>
                                <field name="group_order_ids" widget="many2many_tags" colspan="2" help="Consumer Group orders this group manages"/>
                            </group>
                            <group name="members">
                                <field name="member_ids" widget="many2many_tags" colspan="2" help="Consumer Groups this partner belongs to"/>
                            </group>
                        </group>
                    </page>
                </xpath>
            </field>
        </record>

    </data>
</odoo>
