[IMP] web: use the and syntax instead of && for properties

Purpose
=======
Most of the template in web use the `and` syntax instead of `&&`,
use this syntax for consistency.

Task-3188915

Part-of: odoo/odoo#119811
This commit is contained in:
std-odoo
2023-05-03 10:11:53 +02:00
parent 1f80810e39
commit c706ae6e4f
4 changed files with 13 additions and 14 deletions
@@ -6,7 +6,7 @@
t-foreach="propertiesList"
t-as="propertyConfiguration"
t-key="propertyConfiguration.name"
t-if="(propertyConfiguration.value || ['integer', 'float'].includes(propertyConfiguration.type)) && propertyConfiguration.view_in_kanban">
t-if="(propertyConfiguration.value || ['integer', 'float'].includes(propertyConfiguration.type)) and propertyConfiguration.view_in_kanban">
<div class="mw-100 text-truncate">
<PropertyValue
id="generateUniqueDomID()"
@@ -16,7 +16,7 @@
t-attf-class="o_field_property_label o_form_label text-break {{state.movedPropertyName === propertyConfiguration.name ? 'o_property_field_highlight' : ''}} d-flex align-items-center"
t-att-for="domId">
<b
t-if="propertyConfiguration.string &amp;&amp; propertyConfiguration.string.length"
t-if="propertyConfiguration.string and propertyConfiguration.string.length"
t-out="propertyConfiguration.string"
class="text-900"/>
<i
@@ -24,7 +24,7 @@
New Property
</i>
<i
t-if="state.canChangeDefinition &amp;&amp; !props.readonly"
t-if="state.canChangeDefinition and !props.readonly"
class="o_field_property_open_popover fa fa-pencil ms-2"
t-on-click="(event) => this.onPropertyEdit(event, propertyConfiguration.name)"/>
</label>
@@ -52,7 +52,7 @@
class="o_field_property_add"
t-att-class="{'g-col-2': props.columns !== 1, 'd-none': state.hideAddButton}">
<button
t-if="!props.readonly &amp;&amp; state.canChangeDefinition &amp;&amp; definitionRecordId"
t-if="!props.readonly and state.canChangeDefinition and definitionRecordId"
class="btn btn-light text-muted text-break m-0"
t-on-click="onPropertyCreate">
<i class="fa fa-plus"/>
@@ -61,7 +61,6 @@
</div>
</div>
</t>
</div>
</t>
</templates>
@@ -26,7 +26,7 @@
<i class="fa fa-chevron-down"/>
</button>
<button
t-if="!props.readonly &amp;&amp; props.canChangeDefinition"
t-if="!props.readonly and props.canChangeDefinition"
class="btn text-danger p-0 float-end o_field_property_definition_delete ms-3"
title="Remove Property"
t-on-click="props.onDelete">
@@ -126,7 +126,7 @@
</td>
</tr>
<tr t-if="(state.propertyDefinition.type === 'many2one' || state.propertyDefinition.type === 'many2many')
&amp;&amp; state.propertyDefinition.comodel &amp;&amp; state.propertyDefinition.comodel.length">
and state.propertyDefinition.comodel and state.propertyDefinition.comodel.length">
<td class="o_td_label align-top pe-2">
<b>Domain</b>
</td>
@@ -149,8 +149,8 @@
</td>
</tr>
<tr t-if="!['tags', 'selection'].includes(state.propertyDefinition.type)
&amp;&amp; (!['many2one', 'many2many'].includes(state.propertyDefinition.type)
|| (state.propertyDefinition.comodel &amp;&amp; state.propertyDefinition.comodel.length))"
and (!['many2one', 'many2many'].includes(state.propertyDefinition.type)
|| (state.propertyDefinition.comodel and state.propertyDefinition.comodel.length))"
class="o_field_property_definition_value">
<td class="o_td_label align-top pe-2">
<label t-att-for="getUniqueDomID('default')">
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="web.PropertyValue" owl="1">
<t t-if="props.readonly &amp;&amp; !['boolean', 'many2one', 'many2many', 'tags'].includes(props.type)">
<t t-if="props.readonly and !['boolean', 'many2one', 'many2many', 'tags'].includes(props.type)">
<span t-if="displayValue" t-out="displayValue"/>
</t>
<t t-else="">
@@ -75,13 +75,13 @@
t-attf-class="d-flex flex-row align-items-center o_field_property_many2one_value {{showAvatar ? 'avatar' : ''}}">
<t t-if="props.comodel">
<t t-set="hasAccess" t-value="!propertyValue || propertyValue[1]"/>
<img t-if="showAvatar &amp;&amp; propertyValue[0] &amp;&amp; hasAccess"
<img t-if="showAvatar and propertyValue[0] and hasAccess"
t-attf-src="/web/image/{{props.comodel}}/{{propertyValue[0]}}/avatar_128"
class="rounded-circle me-1"/>
<t t-if="props.readonly || !hasAccess">
<a
t-if="clickableRelational || !hasAccess"
t-attf-class="o_form_uri {{propertyValue &amp;&amp; propertyValue[1] ? '' : 'disabled'}}"
t-attf-class="o_form_uri {{propertyValue and propertyValue[1] ? '' : 'disabled'}}"
t-att-href="propertyValue[0] ? `#id=${propertyValue[0]}&amp;model=${props.comodel}` : '#'"
t-on-click.prevent="onMany2oneClick">
<t t-if="hasAccess" t-out="propertyValue[1]"/>
@@ -89,7 +89,7 @@
</a>
<span
t-else=""
t-out="propertyValue &amp;&amp; propertyValue[1] || ''" />
t-out="propertyValue and propertyValue[1] || ''" />
</t>
<Many2XAutocomplete
t-else=""
@@ -106,7 +106,7 @@
activeActions="{ create: true, createEdit: true, write: true }"
/>
<button
t-if="!props.readonly &amp;&amp; propertyValue &amp;&amp; propertyValue[0] &amp;&amp; hasAccess"
t-if="!props.readonly and propertyValue and propertyValue[0] and hasAccess"
type="button"
class="btn btn-secondary fa fa-arrow-right o_external_button o_properties_external_button py-0"
tabindex="-1"