تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4950 أدوات العرض

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
ديسمبر 24
1117
2
أكتوبر 20
5259
4
أكتوبر 19
33789
1
أبريل 17
3910
2
مارس 15
7319