<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <!-- User Types -->
        <record id="group_super_admin" model="res.groups">
            <field name="name">Super Admin</field>
            <field name="implied_ids" eval="[(4, ref('base.group_system')),(4, ref('base.group_user')),(4, ref('mahalla.group_moderator')),(4, ref('mahalla.group_reader'))]"/>
        </record>

        <record id="group_moderator" model="res.groups">
            <field name="name">Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_republic_moderator')),
            ]"/>
        </record>

        <record id="group_reader" model="res.groups">
            <field name="implied_ids" eval="[
            (4, ref('group_republic_reader')),
            ]"/>
            <field name="name">Reader</field>
        </record>

        <!-- Role-based Groups -->
        <!-- Republic -->
        <record id="group_republic_moderator" model="res.groups">
            <field name="name">Republic Moderator</field>
            <field name="implied_ids" eval="[(4, ref('group_region_reader')), (4, ref('group_region_moderator'))]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_republic_reader" model="res.groups">
            <field name="name">Republic Reader</field>
            <field name="implied_ids" eval="[(4, ref('group_region_reader'))]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Region -->
        <record id="group_region_moderator" model="res.groups">
            <field name="name">Region Moderator</field>
            <field name="implied_ids" eval="[(4, ref('group_district_moderator'))]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_region_reader" model="res.groups">
            <field name="name">Region Reader</field>
            <field name="implied_ids" eval="[(4, ref('group_district_reader'))]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- District -->
        <record id="group_district_moderator" model="res.groups">
            <field name="name">District Moderator</field>
            <field name="implied_ids" eval="[(4, ref('group_mahalla_moderator'))]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_district_reader" model="res.groups">
            <field name="name">District Reader</field>
            <field name="implied_ids" eval="[(4, ref('group_mahalla_reader'))]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Mahalla -->
        <record id="group_mahalla_moderator" model="res.groups">
            <field name="name">Mahalla Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_mahalla_moderator')),
            (4, ref('group_application_mahalla_moderator')),
            (4, ref('group_questionnaire_mahalla_moderator')),
            (4, ref('group_user_questionnaire_mahalla_moderator')),
            (4, ref('group_res_users_mahalla_moderator')),
            (4, ref('group_res_partner_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_mahalla_reader" model="res.groups">
            <field name="name">Mahalla Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_mahalla_reader')), 
            (4, ref('group_application_mahalla_reader')),
            (4, ref('group_questionnaire_mahalla_reader')),
            (4, ref('group_user_questionnaire_mahalla_reader')),
            (4, ref('group_res_users_mahalla_reader')),
            (4, ref('group_res_partner_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Model-specific Groups -->
        <!-- Announcement Moderators -->
        <record id="group_announcement_republic_moderator" model="res.groups">
            <field name="name">Announcement Republic Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_region_moderator')), 
            (4, ref('group_announcement_district_moderator')), 
            (4, ref('group_announcement_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_announcement_region_moderator" model="res.groups">
            <field name="name">Announcement Region Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_district_moderator')), 
            (4, ref('group_announcement_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_announcement_district_moderator" model="res.groups">
            <field name="name">Announcement District Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_announcement_mahalla_moderator" model="res.groups">
            <field name="name">Announcement Mahalla Moderator</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Announcement Readers -->
        <record id="group_announcement_republic_reader" model="res.groups">
            <field name="name">Announcement Republic Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_region_reader')), 
            (4, ref('group_announcement_district_reader')), 
            (4, ref('group_announcement_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_announcement_region_reader" model="res.groups">
            <field name="name">Announcement Region Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_district_reader')), 
            (4, ref('group_announcement_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_announcement_district_reader" model="res.groups">
            <field name="name">Announcement District Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_announcement_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_announcement_mahalla_reader" model="res.groups">
            <field name="name">Announcement Mahalla Reader</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Application Moderators -->
        <record id="group_application_republic_moderator" model="res.groups">
            <field name="name">Application Republic Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_application_region_moderator')), 
            (4, ref('group_application_district_moderator')), 
            (4, ref('group_application_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_application_region_moderator" model="res.groups">
            <field name="name">Application Region Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_application_district_moderator')), 
            (4, ref('group_application_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_application_district_moderator" model="res.groups">
            <field name="name">Application District Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_application_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_application_mahalla_moderator" model="res.groups">
            <field name="name">Application Mahalla Moderator</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Application Readers -->
        <record id="group_application_republic_reader" model="res.groups">
            <field name="name">Application Republic Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_application_region_reader')), 
            (4, ref('group_application_district_reader')), 
            (4, ref('group_application_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_application_region_reader" model="res.groups">
            <field name="name">Application Region Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_application_district_reader')), 
            (4, ref('group_application_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_application_district_reader" model="res.groups">
            <field name="name">Application District Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_application_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_application_mahalla_reader" model="res.groups">
            <field name="name">Application Mahalla Reader</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Questionnaire Moderators -->
        <record id="group_questionnaire_republic_moderator" model="res.groups">
            <field name="name">Questionnaire Republic Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_questionnaire_region_moderator')), 
            (4, ref('group_questionnaire_district_moderator')), 
            (4, ref('group_questionnaire_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_questionnaire_region_moderator" model="res.groups">
            <field name="name">Questionnaire Region Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_questionnaire_district_moderator')), 
            (4, ref('group_questionnaire_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_questionnaire_district_moderator" model="res.groups">
            <field name="name">Questionnaire District Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_questionnaire_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_questionnaire_mahalla_moderator" model="res.groups">
            <field name="name">Questionnaire Mahalla Moderator</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Questionnaire Readers -->
        <record id="group_questionnaire_republic_reader" model="res.groups">
            <field name="name">Questionnaire Republic Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_questionnaire_region_reader')), 
            (4, ref('group_questionnaire_district_reader')), 
            (4, ref('group_questionnaire_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_questionnaire_region_reader" model="res.groups">
            <field name="name">Questionnaire Region Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_questionnaire_district_reader')), 
            (4, ref('group_questionnaire_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_questionnaire_district_reader" model="res.groups">
            <field name="name">Questionnaire District Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_questionnaire_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_questionnaire_mahalla_reader" model="res.groups">
            <field name="name">Questionnaire Mahalla Reader</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- User Questionnaire Readers -->
        <record id="group_user_questionnaire_republic_reader" model="res.groups">
            <field name="name">User Questionnaire Republic Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_user_questionnaire_region_reader')), 
            (4, ref('group_user_questionnaire_district_reader')), 
            (4, ref('group_user_questionnaire_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_user_questionnaire_region_reader" model="res.groups">
            <field name="name">User Questionnaire Region Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_user_questionnaire_district_reader')), 
            (4, ref('group_user_questionnaire_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_user_questionnaire_district_reader" model="res.groups">
            <field name="name">User Questionnaire District Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_user_questionnaire_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_user_questionnaire_mahalla_reader" model="res.groups">
            <field name="name">User Questionnaire Mahalla Reader</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Res Users Moderators -->
        <record id="group_res_users_republic_moderator" model="res.groups">
            <field name="name">Res Users Republic Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_users_region_moderator')), 
            (4, ref('group_res_users_district_moderator')), 
            (4, ref('group_res_users_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_users_region_moderator" model="res.groups">
            <field name="name">Res Users Region Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_users_district_moderator')), 
            (4, ref('group_res_users_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_users_district_moderator" model="res.groups">
            <field name="name">Res Users District Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_users_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_users_mahalla_moderator" model="res.groups">
            <field name="name">Res Users Mahalla Moderator</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Res Users Readers -->
        <record id="group_res_users_republic_reader" model="res.groups">
            <field name="name">Res Users Republic Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_users_region_reader')), 
            (4, ref('group_res_users_district_reader')), 
            (4, ref('group_res_users_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_users_region_reader" model="res.groups">
            <field name="name">Res Users Region Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_users_district_reader')), 
            (4, ref('group_res_users_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_users_district_reader" model="res.groups">
            <field name="name">Res Users District Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_users_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_users_mahalla_reader" model="res.groups">
            <field name="name">Res Users Mahalla Reader</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Res Partner Moderators -->
        <record id="group_res_partner_republic_moderator" model="res.groups">
            <field name="name">Res Partner Republic Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_partner_region_moderator')), 
            (4, ref('group_res_partner_district_moderator')), 
            (4, ref('group_res_partner_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_partner_region_moderator" model="res.groups">
            <field name="name">Res Partner Region Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_partner_district_moderator')), 
            (4, ref('group_res_partner_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_partner_district_moderator" model="res.groups">
            <field name="name">Res Partner District Moderator</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_partner_mahalla_moderator'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_partner_mahalla_moderator" model="res.groups">
            <field name="name">Res Partner Mahalla Moderator</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <!-- Res Partner Readers -->
        <record id="group_res_partner_republic_reader" model="res.groups">
            <field name="name">Res Partner Republic Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_partner_region_reader')), 
            (4, ref('group_res_partner_district_reader')), 
            (4, ref('group_res_partner_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_partner_region_reader" model="res.groups">
            <field name="name">Res Partner Region Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_partner_district_reader')), 
            (4, ref('group_res_partner_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_partner_district_reader" model="res.groups">
            <field name="name">Res Partner District Reader</field>
            <field name="implied_ids" eval="[
            (4, ref('group_res_partner_mahalla_reader'))
            ]"/>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>

        <record id="group_res_partner_mahalla_reader" model="res.groups">
            <field name="name">Res Partner Mahalla Reader</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>
    </data>
</odoo> heres xml groups code in odoo17, but in there record blocks in incorrect order, records referenced before representation and if groups not base, add mahallam. when referencing mahallam.group_res_partner_mahalla_reader