Resolving a KeyError in Odoo 13, where the required key is stored in a ‘/security.xml’ file

Try to reinstall a set of custom Odoo 13 modules on a new Ubuntu-based virtual machine. For one of the modules (material_purchase_requisitions), I keep encountering the following server error at the point of installation (Error message shortened to only the most relevant part):

Odoo Server Error

Traceback (most recent call last):
  File "/home/odoo13/odoo/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/home/odoo13/odoo/odoo/tools/func.py", line 69, in wrapper
    return func(self, *args, **kwargs)
  File "/home/odoo13/odoo/odoo/tools/lru.py", line 44, in __getitem__
    a = self.d[obj].me
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f476ef59e50>, 'material_purchase_requisitions.inventory_keeper_manager_role')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo13/odoo/odoo/tools/convert.py", line 712, in parse
    self._tag_root(de)
  File "/home/odoo13/odoo/odoo/tools/convert.py", line 674, in _tag_root
    f(rec)
  File "/home/odoo13/odoo/odoo/tools/convert.py", line 674, in _tag_root
    f(rec)
  File "/home/odoo13/odoo/odoo/tools/convert.py", line 472, in _tag_menuitem
    group_id = self.id_get(group)
  File "/home/odoo13/odoo/odoo/tools/convert.py", line 657, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/home/odoo13/odoo/odoo/tools/convert.py", line 663, in model_id_get
    return self.env['ir.model.data'].xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
  File "/home/odoo13/odoo/odoo/addons/base/models/ir_model.py", line 1697, in xmlid_to_res_model_res_id
    return self.xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-24>", line 2, in xmlid_lookup
  File "/home/odoo13/odoo/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/home/odoo13/odoo/odoo/addons/base/models/ir_model.py", line 1686, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: material_purchase_requisitions.inventory_keeper_manager_role

The indicated missing/unidentified key (inventory_keeper_manager_role) is located within the module’s security.xml file, and is used for the purposes of creating custom user groups for access rights:

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

        <record model="ir.module.category" id="purchase_requisition_role">
            <field name="name">Material Purchase Requisition</field>
        </record>

        <record id="group_purchase_requisition_user" model="res.groups">
            <field name="name">Material Purchase Requisition User</field>
            <field name="implied_ids" eval="[(4, ref('stock.group_stock_user'))]"/>
            <field name="category_id" ref="purchase_requisition_role"/>
        </record>
        
        <record id="group_all_administrator" model="res.groups">
            <field name="name">Administrator </field>
             <field name="implied_ids" eval="[
             (4, ref('base.group_user')),
             (4, ref('material_purchase_requisitions.group_purchase_requisition_department')),
             (4, ref('material_purchase_requisitions.inventory_keeper_manager_role')),
             (4, ref('material_purchase_requisitions.purchase_officer_role')),
             ]"/>
            <field name="category_id" ref="purchase_requisition_role"/>
            <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
        </record>

        <record id="group_purchase_requisition_department" model="res.groups">
            <field name="name">Material Purchase Requisition Department Manager</field>
            <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
            <field name="category_id" ref="purchase_requisition_role"/>
        </record>

         <record id="inventory_keeper_role" model="res.groups">
             <field name="name">Inventory Keeper</field>
             <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
             <field name="category_id" ref="purchase_requisition_role"/>
        </record>

        <record id="inventory_keeper_manager_role" model="res.groups">
             <field name="name">Inventory Manager</field>
             <field name="implied_ids" eval="[(4, ref('material_purchase_requisitions.inventory_keeper_role'))]"/>
             <field name="category_id" ref="purchase_requisition_role"/>
        </record>

        <record id="purchase_officer_role" model="res.groups">
             <field name="name">Purchase Officer</field>
             <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
             <field name="category_id" ref="purchase_requisition_role"/>
        </record>
        
        <record id="purchase_requisition_own_rule" model="ir.rule">
            <field name="name">Employee Material Purchase Requistion Own</field>
            <field name="model_id" ref="model_material_purchase_requisition"/>
            <field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_user'))]"/>
        </record>

        <record id="purchase_requisition_line_department_manager_rule" model="ir.rule">
            <field name="name">Department Manager Material Purchase Requistion</field>
            <field name="model_id" ref="model_material_purchase_requisition"/>
            <field name="domain_force">[('employee_id.department_id.manager_id.user_id','=',user.id)]</field>
            <field name="groups" eval="[(4, ref('material_purchase_requisitions.group_purchase_requisition_department'))]"/>
        </record>

        <record id="purchase_requisition_all_rule" model="ir.rule">
            <field name="name">Material Purcahse Requisitions All</field>
            <field name="model_id" ref="model_material_purchase_requisition"/>
            <field name="domain_force">[(1,'=',1)]</field>
            <field name="groups" eval="[(4, ref('material_purchase_requisitions.group_all_administrator')),
                                        (4, ref('material_purchase_requisitions.inventory_keeper_role')),
                                        (4, ref('material_purchase_requisitions.purchase_officer_role'))]"/>
        </record>

        <record id="purchase_requisition_line_all_rule" model="ir.rule">
            <field name="name">Material Purcahse Requisitions Line All</field>
            <field name="model_id" ref="model_material_purchase_requisition_line"/>
            <field name="domain_force">[(1,'=',1)]</field>
            <field name="groups" eval="[(4, ref('material_purchase_requisitions.group_all_administrator')),
                                        (4, ref('material_purchase_requisitions.inventory_keeper_role')),
                                        (4, ref('material_purchase_requisitions.purchase_officer_role'))]"/>
        </record>
    </data>
</odoo>

Given that I can accurately trace the key location and its implementation within the code, and as far I can tell there are no syntax errors. Files are also being called in a correct order within the module’s manifest file. Therefore, what is causing the KeyError to manifest?

New contributor

Evan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật