تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
3643 أدوات العرض

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.

الصورة الرمزية
إهمال
أفضل إجابة

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?

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

أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 15
5674
0
يناير 23
1291
3
مارس 22
17442
1
مارس 15
6191
4
يونيو 24
3040