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 group A "readonly" for "field_x" and group B "editable" for the same "field_x"?

By
vx2008
on 7/24/16, 6:24 PM 198 views

.py file:

....

field_x=fields.Char("Name")

....


in xml file:

....

<name="field_x" groups="A" readonly="1"/>

<name="field_x" groups="B" />  

....

I have tried to set it like this, but group A will see nothing forever even if group B has changed the "field_x";

in the fact I just want to group A can read the "field_x" rather than write it and group B can both read and write it; shall I ?

in addition, I also want to get this effect: once  the "field_x" is filled by something, nobody can edit again. shall I?

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 7/25/16, 5:44 PM

You need to create two XML views.  

The first one contains field_x once, and is for the least restrictive permissions - read/write - group B.  

The second one contains field_x once, and is for the most restrictive permissions - read.

Give the second XML view a higher priority than the first, and use the groups tag ON THE VIEW to restrict it just to those in the first group.  You don't need to use the groups tag on the field in either view if you do it this way.

Take a look at res.partner.property.form.inherit which adds new fields to the view - but only for those in the Accounting & Finance group.  You will replace the fields with the read only versions of themselves.

UPDATE:

In Developer Mode:

1. Visit Settings --> Technical --> User Interface --> Views

2. Enter res.partner.property.form.inherit into the search box to find the View.


thanks for your explanation; but I don;t know how to find "res.partner.property.form.inherit"?

could you give me more details about it? for example, which module?which view? like this

vx2008
on 7/26/16, 7:02 PM

thank you

vx2008
on 7/31/16, 7:23 PM

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: 7/24/16, 6:24 PM
Seen: 198 times
Last updated: 7/31/16, 7:23 PM