コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
4960 ビュー

Hi all,

I am trying to create menu item in new module and display it in manufacturing module in Master Data tab. I have defined menu item and security file but still menu item is not shown.

Here is my code:

models.py

class GearManufacturing(models.Model):
_name = 'gear.manufacturing'
product_tmpl_id = fields.Many2one('product.template', 'Product',
domain="[('type', 'in', ['product', 'consu'])]", required=True)
model = fields.Many2one('product.template', 'Model',required=True)
product_to_dispatch = fields.Integer('Products to Dispatch')
dispatch_date = fields.Datetime('Dispatch Date', copy=False, default=fields.Datetime.now, index=True, required=True)

views.xml
<odoo>
<data>
<!-- explicit list view definition -->
<record model="ir.ui.view" id="gear_manufacturing.list">
<field name="name">GearManufacturing list</field>
<field name="model">gear.manufacturing</field>
<field name="arch" type="xml">
<tree>
<field name="product_tmpl_id"/>
<field name="product_to_dispatch"/>
<field name="dispatch_date"/>
</tree>
</field>
</record>
<!-- actions opening views on models -->
<record model="ir.actions.act_window" id="gear_manufacturing.action_window">
<field name="name">GearManufacturing window</field>
<field name="res_model">gear.manufacturing</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem name="Honda Dispatch Plan" parent="mrp.menu_mrp_bom" id="menu_honda_dispatch_plan"
action="gear_manufacturing.action_window" groups="base.group_user"/>
</data>
</odoo>

ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_gear_manufacturing_gear_manufacturing,gear_manufacturing.gear_manufacturing,model_gear_manufacturing_gear_manufacturing,,1,0,0,0
access_gear_manufacturing_gear_manufacturing,gear_manufacturing.gear_manufacturing,model_gear_manufacturing_gear_manufacturing,base.group_user,1,1,1,0
What's wrong in this code. Kindly assist me
アバター
破棄
最善の回答

 Hi,

  Change the model id in the    ir.model.access.csv to  model_gear_manufacturing not model_gear_manufacturing_gear_manufacturing


UPDT : Change the view


<record id="gear_manufacturing_tree" model="ir.ui.view">
<field name="name">gear.manufacturing.tree</field>
<field name="model">gear.manufacturing</field>
<field name="arch" type="xml">
<tree>
<field name="product_tmpl_id"/>
<field name="product_to_dispatch"/>
<field name="dispatch_date"/>
</tree>
</field>
</record>

<record model="ir.actions.act_window" id="gear_manufacturing_action">
<field name="name">GearManufacturing window</field>
<field name="res_model">gear.manufacturing</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem name="Honda Dispatch Plan" parent="mrp.menu_mrp_bom" id="menu_honda_dispatch_plan"
groups="base.group_user" action="gear_manufacturing_action"/>

   CSV 


id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_gear_manufacturing_gear_manufacturing,gear_manufacturing.gear_manufacturing,model_gear_manufacturing,base.group_user,1,1,1,0

アバター
破棄
著作者

Thanks for pointing out! but unfortunately the menu item still not appears

Hi,

Make sure yo have added the security file in the manifest

著作者

It's working now, thanks

最善の回答

Hi,

Please try this,

<menuitem name="Honda Dispatch " parent="mrp.menu_mrp_bom" id="menu_honda_dispatch_plan_parent"
 groups="base.group_user"/>

<menuitem name="Honda Dispatch Plan" parent="menu_honda_dispatch_plan_parent" id="menu_honda_dispatch_plan"
action="gear_manufacturing.action_window" groups="base.group_user"/>

and make sure 'mrp' in your depends [manifest]

Thanks

Aswini - iWesabe

アバター
破棄
著作者

I tried this above solution but its not working

関連投稿 返信 ビュー 活動
0
12月 24
1136
2
10月 20
5269
4
10月 19
33852
1
4月 17
3937
2
3月 15
7350