Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to add custom product export to sidebar?

By
cancelcoffee
on 2/11/13, 10:45 AM 1,252 views

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.

0

Andreas Brueckl

--Andreas Brueckl--
5056
| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 3/10/13, 5:20 AM

I assume that you are using version 6.0. Please correct me if my assumption is not correct.

OpenERP models must contain at least one "." in their name. So you have to change custom_export to custom.export in both, python and XML file.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/11/13, 10:45 AM
Seen: 1252 times
Last updated: 3/16/15, 8:10 AM