I need to make this field read-only. I have set it as such in the Studio, but unfortunately it makes it read-only for just me. How can I make this read-only for all users?
SH
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I need to make this field read-only. I have set it as such in the Studio, but unfortunately it makes it read-only for just me. How can I make this read-only for all users?
SH
Hi,
1- By using the following code, you can make the cost field read-only for all users
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.view.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='standard_price']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
2- By using the studio.
Or by adding the readonly attribute in the product view, you can achieve this.
Hope it helps
Hi,
You can make the "Cost" field (standard_price) read-only for all users using both
1. By using Studio
You can also set it based on a condition
2. By using Code
<record id="product_template_only_form_view"
model="ir.ui.view">
<field name="name">product.template.form.readonly.cost</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='standard_price']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 3 25
|
1287 | ||
|
1
thg 2 25
|
1581 | ||
|
1
thg 12 24
|
2089 | ||
|
0
thg 12 24
|
1643 | ||
|
2
thg 12 24
|
1463 |