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.


How to add edit button in tree view to get form view

on 9/10/15, 1:36 AM 1,094 views

how to add a button in tree view to get the form view of the desired record(as the list view is in editable mode,it wont directly go to the form view)?.how to set the action of the button to open the edit mode of form view?

not really useful since you can open the form by clicking directly on the record line, why do you need a button in the record to do specifically the same? or in the top buttons of the tree where you can select multiple record lines?

Axel Mendoza
on 9/10/15, 2:04 AM

i actually changed the list view as editable ,so it wont go to the form view directly when click.so i would like to add a edit button next to every record,so when i click on edit,it should go to the edit part of form view.

on 9/10/15, 3:40 AM

Ray Carnes

--Ray Carnes--
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 9/11/15, 10:38 PM

1. Add a function (something like this) to the model that opens the form

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

if not context:
context = {}

name = '<Name>' res_model = '<model>'
view_name = '<view>'

document_id = self.browse(cr, uid, ids[0]).id

view = models.get_object_reference(cr, uid, name, view)
view_id = view and view[1] or False

return {
'name': (name),
'view_type': 'form',
'view_mode': 'form',
'view_id': [view_id],
'res_model': res_model,
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'current',
'res_id': document_id,


2. Add a button to your treeview like this:

<button name="open_to_form_view" type="object" icon="STOCK_INDEX"/>

On 7/27/16, 4:33 AM

can u explain deeper about the

    name = '<Name>'
 res_model = '<model>'  
 view_name = '<view>'

name as you give.

res_model like sale.order, product.product (table name)

view_name --> sale.view_order_form (sale order form view)

on 11/29/16, 8:30 AM

view_name xml id of sale order form view.

on 11/29/16, 8:32 AM

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

2 follower(s)


Asked: 9/10/15, 1:36 AM
Seen: 1094 times
Last updated: 7/27/16, 4:33 AM