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

I am trying to change the definition on the 'standard_price' field in 'product.template' such that the cost price is not accessible to certain user groups.

As I understand this can be done using field access rights by modifying the group access at the field definition within the product_template class in the file product.py (located at openerp/addons/product), such that:

'standard_price': fields.float('Cost', digits_compute=dp.get_precision('Product Price'), help="Cost price of the product used for standard stock valuation in accounting and used as a base price on purchase orders.", groups="base.group_user")

becomes

'standard_price': fields.float('Cost', digits_compute=dp.get_precision('Product Price'), help="Cost price of the product used for standard stock valuation in accounting and used as a base price on purchase orders.", groups="group1"

where "group1" is the group which can access the field.

However, when this change is made any user not in the user group "group1" cannot access the product page at all (Access Denied- The requested operation cannot be completed due to security restrictions. Please contact your system administrator. (Document type: Product, Operation: read).

How should the change be applied such that users not in "group1" can still open the product view but just cannot see the field (or have the value blank)?

Thanks for reading this far!

Lawrence

الصورة الرمزية
إهمال

I was also struggling with this issue for the past 5 hours with no luck .. any updates??

I notice that it works find for the Admin user only .. meaning he can't see the cost price if he doesn't belong to group1. But I get this error for other users (Access Denied- The requested operation cannot be completed due to security restrictions. Please contact your system administrator. (Document type: Product, Operation: read).

أفضل إجابة

Pass groups from XML file

Example

<fields name="standard_price" groups="group1"/>

Hope this will help you

الصورة الرمزية
إهمال
الكاتب

Hello, thanks for the response. Are you referring to product_security.xml? I know that this can be done in product_view.xml to change the visibility, but I would like to restrict access. Thank you.

Check this link may be this will help security and access right management

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
نوفمبر 15
4852
1
مارس 15
5048
10
ديسمبر 23
36800
1
ديسمبر 21
9824
1
سبتمبر 21
3520