Odoo Help

1

How to add custom product export to sidebar?

By
cancelcoffee
on 2/11/13, 10:45 AM 1,500 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--
5161
| 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.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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