Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
123 Näkymät

My code in Odoo 18 is:

...

<record id="action_packing_order" model="ir.actions.act_window">

        <field name="name">Packing tasks</field>

        <field name="res_model">packing.order</field>

        <field name="view_mode">list,form</field>

    </record>

...

<menuitem

        id="menu_packing_order"

        name="Packing"

        action="action_packing_order"

        parent="stock.menu_stock_root"/>

It installs correctly but I can't find my menu item in stock app.



Avatar
Hylkää
Tekijä

Thank you very much. It works

Paras vastaus

Your menu item is most probably there already. You could verify its existence in Settings -> Technical --> User Interface -> Menu Items to ensure your data-key in your __manifest__.py-file is correct and your module is correctly installed/updated.

If this is the case, you are most likely missing the permission to actually see (read) from the packing.order model - thus you can't access its action(s) either. Ensure you have either a security.xml or ir.model.access.csv added to the data-key of your __manifest__.py-file as well (the file names are not fixed but reflect best practices).

security.xml could look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="access_packing_order" model="ir.model.access">
<field name="name">access.packing.order</field>
<field name="model_id" ref="model_packing_order"/>
<field name="group_id" ref="base.group_user"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>
</odoo>

Alternatively, your ir.model.access.csv could look like this:

"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
access_packing_order,access_packing_order,model_packing_order,base.group_user,1,1,1,1


You could do this manually via UI as well, however, with a model created in a custom module, I would not suggest to do so in the beginning: https://www.odoo.com/documentation/18.0/applications/general/users/access_rights.html

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
syysk. 25
161
2
syysk. 25
275
1
elok. 25
349
0
elok. 25
1033
0
heinäk. 25
354