Odoo Help

Welcome!

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.

0

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

By
priyankahdp
on 4/19/13, 10:07 AM 1,854 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--
15717
| 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 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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