I want to add a new menu item to the right side menu in the product list. When the menu item is clicked I want to call a method on the server which packs a zip file of the images of the selected products and offers it to the user as a download.
I got a general idea of some of the necessary steps, but I can't quite manage to put it all together.
I found how to add a menu item to the side menu:
Code:
<act_window
context="{'product_id': active_id}"
id="act_window_custom_export"
name="Custom Export"
res_model="custom_export"
src_model="product.product"
groups="base.group_extended"/>
And I found that returning an act_url will let me redirect the user to where I want them to be:
Code:
class custom_export(osv.osv_memory):
_name = 'custom_export'
def export(self,cr,uid,ids,context={}):
return {
'type': 'ir.actions.act_url',
'url': "link removed due to karma",
'target': 'new'
}
custom_export()
Once I figure out how to call the method from the menu item the rest won't be a problem, just add code to create the file and return the file's location as the URL. But how can I connect these two things, the menu item and the method?
I read and tried some things with regular actions, server actions and wizards, but nothing I did solved the problem. Unfortunately I didn't find any good documentation on this kind of problem.