Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged

have created server action button in res.partner tree view but I want to show it only in the menu that I have created in purchase. If the menu is contact then button should be hidden.


I want to show that button here only:

But the button should be hidden here:

Any suggestions would be appreciated. Thanks

Avatar
Zrušit
Autor Nejlepší odpověď

Finally was able to achieve it by using fields_view_get method:

def fields_view_get(self, view_id=None, view_type='tree', toolbar=False,
submenu=False):
res = super(ResPartner, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu)

if not self._context.get('validate', False):
approve_button_id = self.env.ref('bv_vendor_approval.action_bulk_approve_vendors').id or False
for button in res.get('toolbar', {}).get('action', []):
if approve_button_id and button['id'] == approve_button_id:
res['toolbar']['action'].remove(button)

  return res

Avatar
Zrušit

is it possible without fields_view_get ? if not then why?

Autor

Yes, possible by using javascript.

That helped me, thank you

Related Posts Odpovědi Zobrazení Aktivita
0
čvc 21
58
0
kvě 23
2706
1
led 23
7498
1
pro 20
7057
0
pro 20
3061