自定义模块和在odoo 10中创建组 [英] Custom module and creating groups in odoo 10

查看:110
本文介绍了自定义模块和在odoo 10中创建组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows上使用odoo 10.我现在创建了一个新的自定义模块,我想向某些用户添加Costum模块的某些菜单.

I'm working with odoo 10 on windows. I've created a new custom module now I want to add some menus of my costum modules to certains users.

我是odoo的新手,所以我的问题是可以通过创建组,将菜单关联到我的组然后将用户添加到该组来做到这一点(我尝试过,但是当我使用用户我什么也没找到). 我在网上搜索,发现需要通过ir.model.access.csv(安全文件夹)创建我的群组,其中包括:id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create, perm_unlink access_testmod_test,access_testmod_test,model_testmod_test ,, 1,1,1,1. 不幸的是,我不太了解该怎么做以及在某些领域应该写些什么. 所以有人可以给我一个很好的教程,我可以用它来举例说明,女巫向我展示如何创建不同的组并向其中添加用户,并向其中添加自定义模块的某些菜单.

I'm new to odoo so my question is can I do that by creating group, associate the menus to my group then add the users to the group (I trid that but it did not work, when I log in with the user I find nothing). I've search on the web and I found that I need to creat my groups trough ir.model.access.csv (security folder) with this : id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_testmod_test,access_testmod_test,model_testmod_test,,1,1,1,1. Unfourtunately, I did not quite understand how can I do that and what should I write in some fields. So can someone please give me a good tutorial that I can use, with examples, witch shows me how to create diffrents groups and adde users to it and add also some of the menus of my custom module to it.

谢谢.

推荐答案

所以我尝试了这段代码,但是它对我不起作用,也许我在这里做错了:我在安全文件夹中创建了文件securuty.xml.包含以下

so I tried this code but it did not work with me maybe I did it wrong here what I did : I created a file securuty.xml in my security folder with contain the following

<?xml version="1.0" encoding="utf-8"?>
<odoo>
   <data noupdate="0">
       <!-- Creating a Group Category -->        
       <record id="evaluation_subj" model="ir.module.category">
           <field name="name">evaluation subjective</field>
           <field name="sequence">1</field>
       </record>
       <!-- Adding a Group to the Group Category -->
       <record id="group_eval_subj" model="res.groups">
           <field name="name">Groupe Evaluation Subjective</field>
           <field name="evaluation_subj" ref="evaluation subjective"/>
           <!-- Adding Rights of existing Groups -->
           <field name="implied_ids"
                  eval="[(4, ref('base.group_system')), (4,ref('base.group_sale_manager'))]"/>
       </record>
    </data>
</odoo>

然后在文件pnc_menus.xml中(我有一个名为pnc_menus.xml的文件,在该文件中创建了所有菜单),我在该菜单中添加了groups字段:

Then in the file pnc_menus.xml (I have a file called pnc_menus.xml where I created all of my menus) I added the groups field to this menu:

<menuitem name="Parties Prenantes" id="pnc_evaluation_stakeholders" action="pncevaluation_partieprenante" parent="pnc_documents" sequence="40" groups="base.group_system"/> 然后在我的安全文件夹的csv文件中添加了以下内容: id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink eval_group,groupe_evaluation,pnc_evaluation_stakeholders,group_eval_subj,1,1,1,1 更新模块时,出现错误消息无法处理csv文件"

<menuitem name="Parties Prenantes" id="pnc_evaluation_stakeholders" action="pncevaluation_partieprenante" parent="pnc_documents" sequence="40" groups="base.group_system"/> Then in csv file of my security folder I added this : id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink eval_group,groupe_evaluation,pnc_evaluation_stakeholders,group_eval_subj,1,1,1,1 When I updated my module I have an error saying "csv file could not be proccessed"

这篇关于自定义模块和在odoo 10中创建组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆