Skip to Content
Menu
This question has been flagged
1 Reply
3161 Views
How to apply an action available on the form view to the list view (multiple records)
Avatar
Discard
Author Best Answer

If you want to use an action available on the form view in the tree view for the selected records:


1) Go to the form view and check the name of the action you want to use (by leaving your mouse on the button in debug mode) - see attachment










2) Go to Configuration / Technical / Server Action and create a server action using this code

context = dict(env.context)
invoice = env['account.invoice']
for rec in invoice.browse(context.get('active_ids')):
    rec.action_open_invoice() 

Comments:

- "invoice" is a variable name you can change

- you can change the env you want to use (account_invoice = model name of invoices)

- change the action name and add "()" at the end


3) Create a contextual action for your server action (green button on the server action)


//!!\\ In V10 you should replace rec by object:

context = dict(env.context)
invoice = env['account.invoice']
for object in invoice.browse(context.get('active_ids')):
    object.action_open_invoice() 

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 21
3370
5
Oct 24
9755
3
Nov 24
15460
2
Mar 24
2943
1
Oct 22
83