does anyone know how I can change the field labels with javascript code for an xml form. I am trying to change the field labels dynamically based on a value that the field has. I tried using the <label> tags in the xml view to change them, but it messes up the form view when I do that. I was wondering if there is an easy way to use javascript to change the labels without changing the form view at all
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
I still haven't figured out how to change the field labels with Javascript, but I did manage to modify the xml view so that the data was displayed properly. Here is a short example:
<group>
<!--
When using dynamic labels in the same group as fields with non dynamic labels,
make sure the label and the field are broken up in their own div tag
This way the data will be displayed on the form properly
-->
<field name="another_field" />
<div>
<!-- Dynamic labels -->
<label for="field_1" string="Field 1 Name" attrs="{'invisible': [('another_field','!=','value')]}" />
<label for="field_1" string="Other Field 1 Name" attrs="{'invisible': [('another_field','=','value')]}" />
</div>
<div> <field name="field_1" /> </div>
</group>
Exactly what I was looking for. Thanks.
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
5
Agu 23
|
49895 | ||
|
1
Sep 15
|
5902 | ||
|
2
Mei 24
|
7339 | ||
|
0
Agu 15
|
2797 | ||
|
0
Mei 15
|
3603 |