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

Read only fields on products and customers in v7?

By
Sean Samborski
on 12/18/13, 11:33 PM 884 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.

4
Jasad
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.

Jasad
on 12/20/13, 12:51 AM
0
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

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: 12/18/13, 11:33 PM
Seen: 884 times
Last updated: 3/16/15, 8:10 AM