I have create some customized fields in normal.product.form but I want to show them only when the product belongs to a certain category name.
Could anyone give me a hand?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have create some customized fields in normal.product.form but I want to show them only when the product belongs to a certain category name.
Could anyone give me a hand?
You can use attrs
attribute in xml.
For example:
<field name="field_name" attrs="{'invisible': ('prod_categ_name', 'in', ['categ1', 'categ2'])}"
attrs: Permits to define attributes of a field depends on other fields of the same window. (It can be use on page, group, button and notebook tag also)
Format:
attrs=â{âattributeâ: [(âfield_nameâ,âoperatorâ,âvalueâ),(âfield_nameâ,âoperatorâ,âvalueâ)],âattribute2â:[(âfield_nameâ,âoperatorâ,âvalueâ),]}
Where attribute will be readonly, invisible, required
Default value: {}.
Example: (in product.product
)
<field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
The problem I have is that I don't know the field name I have to use because in product.product I can't see any field declared for category name and If I go to product.normal.form view I can see "categ_id". But "categ_id" is not what I want because I want the category name and I could write something like this: attrs="{'invisible': [('category_name', '!=', 'my_category') ] }" I guess. Maybe is not possible as simple like that and I would need advanced coding skills.
Hi Sudhir, I want to hide all fields except product name for a particular group(ie, portal group). How can configure it?
Hi sudhir, how can hide some properties of a product from a particular group?
Thank you very much. It helped me. How can i show some text when a selectbox value is some value
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 | |
---|---|---|---|---|
|
16
thg 9 24
|
76527 | ||
|
3
thg 10 22
|
9579 | ||
How to add a custom tag to products?
Đã xử lý
|
|
1
thg 12 21
|
9653 | |
|
11
thg 1 24
|
34920 | ||
|
5
thg 3 17
|
8252 |