Odoo Help

6
2 Answers
2
sridhar
5/19/14, 8:22 AM

In the Tree view we can put editable="bottom", now we can edit in the same form,

                          <field name="One2many_field_name" >
                                    <tree editable="bottom">
                                        <field name="name"/>                                       
                                    </tree>
                                </field>

9
Avatar

Mohammad Alhashash

--Mohammad Alhashash--
2078
| 5 5 8
October City, Egypt
--Mohammad Alhashash--

Developer

Mohammad Alhashash
3/12/13, 3:29 PM

You can create a type='object' button in the tree view. The button method should return an action to open the selected line. You have to click on the button, not anywhere in the line.

class mymodule_model(osv.osv):
    _name = 'my_module.model'
    ...
    ...
    def open_line(self, cr, uid, id, context=None):
        return {
            'type': 'ir.actions.act_window',
            'name': 'Model Title', 
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': self._name,
            'res_id': id[0],
            'target': 'current',
        }
6 Comments
Mohammad Alhashash
3/14/13, 5:47 PM

Glad it worked. _() is the string translation function. If you want to translate the action title, you should use it and add from openerp.tools.translate import _ to your module.

Brett Lehrer
3/15/13, 12:27 PM

Ahh, that makes sense. Thanks again, that one has been bugging me for a while.

Mohammad Alhashash
3/15/13, 12:46 PM

I updated the answer to prevent confusion. Actually I'm not sure if it is required to do the translation on server side or the client would translate it.

todd
4/17/13, 7:13 AM

Mohammad Ali, is it possible to do this without adding a new button and just directing the original 'Add an item' button to return a full page?

Mohammad Alhashash
4/17/13, 8:05 AM

No. But you can disable list view editing and always get the form dialog for editing.

Cyrus Waithaka
4/28/15, 9:22 AM

What if you wanted to open a related object (many2one) instead of the current object. For instance, open the product from the mrp.bom.line

Ask a Question
Writer
Keep Informed
2 follower(s)
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