Odoo Help

2

0
6 Answers
4
sepdau Vietnam
11/24/13, 11:41 PM

Hi, This is solution for that.

from openerp.osv.orm import setup_modifiers


def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
            res = super(uma_stock_picking_in, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type,
                                                                    context=context, toolbar=toolbar, submenu=submenu)
           if view_type == 'form':
                    doc = etree.XML(res['arch'])
                    for node in doc.xpath("//field[@name='min_date']"):
                            node.set('readonly', "0")
                            setup_modifiers(node, res['fields']['min_date'])

                    res['arch'] = etree.tostring(doc)
            return res

You should notice function setup_modifiers if you want to set option in ['invisible', 'readonly'] because in version 7 when you set readonly or invisible it will generate the modifiers attribute to take care this.

Cheer.

3 Comments
Prakash India
11/25/13, 1:09 AM

Thanks i will try using fields_view_get method to Particular Groups and Users to set field read-only is it possible in version 7 ?...

sepdau Vietnam
12/3/13, 10:47 PM

I don't know, most of work I am working on version 7. In that code above you can set user or group or other choice easy. But one thing I don't know how to override the tree view of field one2many or many2many field in form view because in fields_view_get we can not get its.

Audrius Lithuania
2/5/14, 9:26 AM

Thanks, it helped

0
Avatar

Vishal Gediya India

--Vishal Gediya--

772
| 3 2 4
Surat, India
--Vishal Gediya--

Python and Odoo Developer

Vishal Gediya India
2/9/16, 6:20 AM


Ask a Question
Writer
11631
Prakash
Tag
Keep Informed
0 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