Skip to content

Instantly share code, notes, and snippets.

@gdgellatly
Last active October 16, 2023 23:34
Show Gist options
  • Save gdgellatly/a998366b87b3226c671139fc9de6a851 to your computer and use it in GitHub Desktop.
Save gdgellatly/a998366b87b3226c671139fc9de6a851 to your computer and use it in GitHub Desktop.
Dynamic Field Labels
<group name="custom_questions" >
<label
for=""
attrs="{'invisible': [('internal_question_count', '&lt;', 1)]}"
>
<field name="internal_question_1_label" nolabel="1" attrs="{'invisible': [('internal_question_count', '&lt;', 1)]}" class="o_form_label" readonly="1"/>
</label>
<field
name="internal_question_1_answer"
attrs="{'invisible': [('internal_question_count', '&lt;', 1)]}"
nolabel="1"
/>
</group>
<!--
label fields are just computed from the name of each m2m of questions,
count is just the length of those m2ms
yes all those attrs are needed
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment