Odoo Help

0

How to set field as readonly, by function [Closed]

By
priyankahdp
on 4/19/13, 10:07 AM 2,279 views

The Question has been closed

by
priyankahdp
on 04/22/2013 04:52:56

Please advice me on how to set form's field to readonly when form onload. i need to do it from python function (not in view.xml with attr invisible option).

form onload if user company based then need to company readonly, if user department based then need to company and department readonly

Please help me to implement this

or include its in below function

def _default_company(self, cr, uid, context=None):
    user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
    if user.company_id:
        [here add code to set department field readonly]
        return user.company_id.id
1
Ray Carnes
On 4/19/13, 5:11 PM

You are asking to change the schema of a model during runtime. I don't believe this is supported.

The way to do this would be with security rules.

priyankahdp
on 4/22/13, 3:21 AM

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

0 follower(s)

Stats

Asked: 4/19/13, 10:07 AM
Seen: 2279 times
Last updated: 3/16/15, 8:10 AM