Odoo Help


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.


Show model data in popup opened from button

Tobias Wetzel
on 8/5/15, 6:11 AM 730 views


I have a model and a tree view defined for listing all the entrys. Now I want to have a button in this tree view and when I click on it a popup should be opened and show specific data from the entry that has been clicked on, similar to a tree view in a notebook page in the models form view.

This is my model:

class Paper(models.Model):
_name = 'paper_submission.paper'
_rec_name = "title"

title = fields.Char(string='Title', required='True')
review_ids = fields.One2many('paper_submission.review', 'paper_id', string='Reviews')

The tree view:

<record id="paper_submission_paper_tree" model="ir.ui.view">
name="name">Paper List View</field>
name="arch" type="xml">
name="state" invisible="1"/>
string="Assign Reviews" type="action" attrs="{'invisible': [('state','!=','submitted')]}"/>

When I click on the button I want to have a popup tree view where I can create new reviews and list the currently available reviews like this:

<record id="paper_submission_assigned_review_tree" model="ir.ui.view">
name="name">Assigned Review Tree</field>
name="arch" type="xml">
            <field name="avg_grade"/>  

How can I achieve this?


Drees Far

--Drees Far--
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 8/5/15, 7:03 AM

In your XML you have to add some thing like this:

<button name="open_sale_order_lines" string="Open Form" type="object">

And in your python:

def open_sale_order_lines(self,cr,uid,ids,context=None):

if context is None:

context = {}

sale_ids = self.pool.get('sale.order').search(cr,uid,[('project_id','=',context.get('search_default_project_id',False)),('partner_id','in',context.get('search_default_partner_id',False))])

names = [record.name for record in self.browse(cr, uid, ids, context=context)]

name = _('Sales Order Lines of %s') % ','.join(names)

return {

'type': 'ir.actions.act_window',

'name': name,

'view_type': 'form',

'view_mode': 'tree,form',

'context': context,

'domain' : [('order_id','in',sale_ids)],

'res_model': 'sale.order.line',

'nodestroy': True,


Try to learn from those useful links:




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)


Asked: 8/5/15, 6:11 AM
Seen: 730 times
Last updated: 8/5/15, 7:03 AM