Skip to Content
Menu
This question has been flagged
1 Reply
7827 Views

Hi,
How can display a menu action button only in Invoices odoo13. It should not display in journal entries. Both are 'account.move' model, so now the action button is show in invoice and journals. How can i restrict it to not show in Journal entries.
Regards

Avatar
Discard
Best Answer

Hi,

I think you can solve this by using fields_view_get
Use the following code by inheriting the model account.move

def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
res = super().fields_view_get(view_id=view_id, view_type=view_type,
toolbar=toolbar, submenu=submenu)
if toolbar:
for action in res['toolbar'].get('action'):
if action.get('xml_id'):
if action['xml_id'] == 'your xml of action' and self._context.get(
'default_type') == 'entry':
res['toolbar']['action'].remove(action)
return res

Regards

Avatar
Discard