[WISH]sidebar, allow to hide item on context

Asked by Serge

for a customer, we create many view on res.partner, but we need to hide some action in sidebar in some view.

(Sidebar show all action for the current model, in this case res.partner)

At the moment i dont found a way to do it, so is possible to add this in a future release ?

(if a way already exist tell me please)

Thank

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #680679.

Revision history for this message
DBR (OpenERP) (dbr-openerp) said :
#1

Hello Serge,

There are two ways I suggest to perform your aim:
1) Hide the act_windows : You have to create one group and assign that group to that act window and no need to assign this new group to particular user who want to hide particular act window.so this field is only assigned when you add that new group to user.

2) Remove the act_windows :Administration/Low Level Objects/Actions/Window Actions/select particular act_window and remove it.

Thanks.

Revision history for this message
Serge (sboivin) said :
#2

2 solutions dont work for my case, i explain why

one user, can go in all view,

View #1 see all action

View #2 have other action, hide other

So i cant use group because is not based on user is based on the current view we see.

Revision history for this message
Numérigraphe (numerigraphe) said :
#3

I was wondering too, but I suppose the whole point of the side bar is
that it's generic not context-specific.
If you really need to do that, I guess you'd better remove the actions
from the side bar and replace them with buttons on the views where you
need them.
Lionel Sausin.

Revision history for this message
Serge (sboivin) said :
#4

So ...
    i will modify all action link with partner (lot of job) i will and context like {'category_id.code':'ALLOW_ACTION_X'} and in each action i will test if the partner have this category, if no i will cancel the action.

But the best solution is to add a new parameter in action like
   allowed : condition

<record id="xxxxxxxxxr" model="ir.actions.act_window">
            <field name="name">xxxxxxxxx</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.partner</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="xxxxxxxxxxx"/>
            <field name="target">new</field>
            <field name="allowed">[('category_id.code','=','ALLOW_ACTION_X')]</field>
</record>

when clien get the action, if allowed in parameter, test condition, if result is false, dont execute action

*fields code is a custom fields used for my sample.

Can you help with this problem?

Provide an answer of your own, or ask Serge for more information if necessary.

To post a message you must log in.