Odoo Help


Read only fields on products and customers in v7?

Sean Samborski
on 12/18/13, 11:33 PM 1,223 views

Is there a way to define a specific field as readonly on products and customers? I.e. a payment method is created for a customer and only those with access to change this field should be able to change the field. All other fields on the customer like address are writable by regular users.

On 12/19/13, 1:24 AM

Hi Sean Samborski,

You can write the fields as below:

'approved': fields.boolean('Approved', write=['base.group_sale_manager']),

And in xml as normal fields without any readonly or groups.

<field name="approved"/>

This won't be readonly field. But it is writable only to the users having sale manager access rights.

If you don't want to show this field to the users having no access rights, better write as normal fields and assign groups in xml file.

+1 this sounds really great. Where would I put the first snippet you added?

Elephante, Sean Samborski
on 12/20/13, 12:02 AM

Inherit the model product and customer, add the above field in py file.

on 12/20/13, 12:51 AM
Subhin P V
On 12/19/13, 12:42 AM

You Can Specify Group in xml for that particular field.

<field name="date"  readonly="1" groups="base.group_user"/>

where group_user is the name of the group and base is the module in which group is defined. Then

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.


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

1 follower(s)


Asked: 12/18/13, 11:33 PM
Seen: 1223 times
Last updated: 3/16/15, 8:10 AM