Skip to Content
Menu
This question has been flagged

Hello,

Im trying to install a new module using the access right's dropdown style.

For using the dropdown style, I configure the security.xml like this:

<odoo>

    

    <record model="ir.module.category" id="mymodel_category">

        <field name="name">My Model</field>

        <field name="description">Test my Module</field>

        <field name="sequence">81</field>

    </record>

    

    <record id="group_mymodel_manager" model="res.groups">

        <field name="name">Manager</field>

        <field name="category_id" ref="mymodel_category"/>

        <field name="implied_ids" eval="[(4, ref('group_mymodel_officer'))]"/>      

    </record>

    

    <record id="group_mymodel_officer" model="res.groups">

        <field name="name">Officer</field>

        <field name="category_id" ref="mymodel_category"/>      

        <field name="implied_ids" eval="[(4, ref('group_mymodel_user'))]"/>        

    </record>

    

    <record id="group_mymodel_user" model="res.groups">

        <field name="name">User</field>

        <field name="category_id" ref="mymodel_category"/>

    </record>    

</odoo>


I'd succeed when upgrading the module.

But when install the module in (UI), I got an error like this:

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 354, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 657, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/home/odoo/src/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/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1685, 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/odoo/src/odoo/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1674, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: mymodel.group_mymodel_officer

During handling of the above exception, another exception occurred:
.....

So, if I remove the 2 lines in security.xml:

    <field name="implied_ids" eval="[(4, ref('group_mymodel_officer'))]"/> 
and
    <field name="implied_ids" eval="[(4, ref('group_mymodel_user'))]"/> 

I can install the module normally and it works fine after install.

After that, I add those 2 lines again, and it works fine!

So how to solve that issue before installing the module?


Please help!
Thank you!
    


Avatar
Discard
Best Answer

Just re-ordering the appreance of the records

mymodel_category > group_mymodel_user > group_mymodel_officer > group_mymodel_manager
Avatar
Discard
Author

Yes, I got it. Thank you Mai !

Related Posts Replies Views Activity
2
Jul 20
4876
5
Jan 23
4375
1
Nov 24
2501
4
May 24
10070
1
Apr 24
1561