I am working on python, xml in openerp. I am creating access right for manager and user. I want to hide "Convert to opportunity" button on user login. And show that button in manager login. how to hide this button on login user.

see the following screenshot.

enter image description here

I created groups for manager and user separately.

<button string="Convert to Opportunity" type="action" states="draft,open,pending" help="Convert to Opportunity" class="oe_highlight" position="replace"/>

while i am adding this code. "Convert to Opportunity" button will be hidden. But it is hidden user and manager.

Then i tried add "groups" attribute and place my groups name. but it will give architecture error

<button string="Convert to Opportunity" type="action" states="draft,open,pending" help="Convert to Opportunity" class="oe_highlight" group="User" position="replace"/>

what did i mistake?

有帮助吗?

解决方案

First of the attribute is "groups" with s not "group".

And you have to give it group ids (xml-ids) instead of simple names.

Througout the OpenERP Code you will find many examples for this, just search for "groups=" in xml files.

some examples for group ids:

  • base.group_sale_manager - base module for users with access right "manager" in sale
  • base.group_user - base module for basic users
  • and so on

if you want already installed/created groups and their ids go into your database and look into the table ir_model_data (filter by model='res.groups'). the column "name" in that table is the xml-id you need.

其他提示

in odoo 10, it should be:

groups="sales_team.group_sale_manager"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top