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 make readonly field base on condition?

By
Darek
on 10/25/13, 6:48 AM 2,639 views

base.group_user can edit project.issue in every stage. portal.group_portal can edit SOME fields of the issue only in NEW stage. In two other stages (of all 7) portal user can press buttons Accept or Reject and change the stage value of the issue. I can't limit rights to record, because I need to change the value of the stage. I think I have to limit rights to some fields on the view.xml:

if the user group = portal.group_portal and stage_id != new readonly="1"

How to implement this condition to a single field?

0
Abhishek H Menon
On 10/25/13, 9:50 AM

add this code in your xml file

 <field name="field_name"  attrs="{'readonly':[('stage_id','!=','new')]}"/>

and in your python file, specify

field_name :  fields.char('Field Label',size=32,read=['portal.group_portal'])

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/25/13, 6:48 AM
Seen: 2639 times
Last updated: 3/16/15, 8:10 AM