Odoo Help

0

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

By
priyankahdp
on 4/19/13, 10:07 AM 2,085 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

--Ray Carnes--
17170
| 9 7 9
Atlanta, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0.

Completed Odoo Functional and Technical Training.

Major Skills:

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

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. 

I am a skilled Communicator and I only take the serious things seriously!

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: 2085 times
Last updated: 3/16/15, 8:10 AM