[FIX] web: StateSelectionField display Label only in list view
Since commit 17a24020ac, StateSelectionField
displays its label in all views. This was an error. It should only
display its label in list views.
closes odoo/odoo#114538
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
-4
@@ -26,10 +26,6 @@ export class ProjectStateSelectionField extends StateSelectionField {
|
||||
export const projectStateSelectionField = {
|
||||
...stateSelectionField,
|
||||
component: ProjectStateSelectionField,
|
||||
extractProps: (fieldInfo) => ({
|
||||
...stateSelectionField.extractProps(fieldInfo),
|
||||
hideLabel: !!fieldInfo.options.hideLabel,
|
||||
}),
|
||||
};
|
||||
|
||||
registry.category("fields").add("kanban.project_state_selection", projectStateSelectionField);
|
||||
|
||||
@@ -921,7 +921,7 @@
|
||||
<field name="activity_ids" widget="kanban_activity"/>
|
||||
</div>
|
||||
<div class="oe_kanban_bottom_right">
|
||||
<field t-if="record.last_update_status.value && widget.editable" name="last_update_status" widget="project_state_selection" options="{'hide_label': 1}"/>
|
||||
<field t-if="record.last_update_status.value && widget.editable" name="last_update_status" widget="project_state_selection"/>
|
||||
<span t-if="record.last_update_status.value && !widget.editable" t-att-class="'o_status_bubble mx-0 o_color_bubble_' + record.last_update_color.value" t-att-title="record.last_update_status.value"></span>
|
||||
<field name="user_id" widget="many2one_avatar_user" t-if="record.user_id.raw_value"/>
|
||||
</div>
|
||||
|
||||
@@ -18,11 +18,11 @@ export class StateSelectionField extends Component {
|
||||
};
|
||||
static props = {
|
||||
...standardFieldProps,
|
||||
hideLabel: { type: Boolean, optional: true },
|
||||
showLabel: { type: Boolean, optional: true },
|
||||
withCommand: { type: Boolean, optional: true },
|
||||
};
|
||||
static defaultProps = {
|
||||
hideLabel: false,
|
||||
showLabel: true,
|
||||
};
|
||||
|
||||
setup() {
|
||||
@@ -63,9 +63,6 @@ export class StateSelectionField extends Component {
|
||||
}
|
||||
return formatSelection(this.currentValue, { selection: this.options });
|
||||
}
|
||||
get showLabel() {
|
||||
return !this.props.hideLabel;
|
||||
}
|
||||
get isReadonly() {
|
||||
return this.props.record.isReadonly(this.props.name);
|
||||
}
|
||||
@@ -92,7 +89,7 @@ export const stateSelectionField = {
|
||||
displayName: _lt("Label Selection"),
|
||||
supportedTypes: ["selection"],
|
||||
extractProps: ({ options, viewType }) => ({
|
||||
hideLabel: !!options.hide_label && viewType === "list",
|
||||
showLabel: viewType === "list" && !options.hide_label,
|
||||
withCommand: viewType === "form",
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<t t-if="isReadonly">
|
||||
<button class="d-flex align-items-center btn fw-normal p-0">
|
||||
<span t-attf-class="o_status {{ statusColor(currentValue) }} "/>
|
||||
<span t-if="showLabel" class="o_status_label ms-1" t-esc="label"/>
|
||||
<span t-if="props.showLabel" class="o_status_label ms-1" t-esc="label"/>
|
||||
</button>
|
||||
</t>
|
||||
<t t-else="">
|
||||
@@ -13,7 +13,7 @@
|
||||
<t t-set-slot="toggler">
|
||||
<div class="d-flex align-items-center">
|
||||
<span t-attf-class="o_status {{ statusColor(currentValue) }} "/>
|
||||
<span t-if="showLabel" class="o_status_label ms-1" t-esc="label"/>
|
||||
<span t-if="props.showLabel" class="o_status_label ms-1" t-esc="label"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-foreach="options" t-as="option" t-key="option[0]">
|
||||
|
||||
@@ -532,6 +532,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
return performRPC(route, args);
|
||||
},
|
||||
});
|
||||
assert.containsNone(target, ".o_status_label");
|
||||
|
||||
await click(target, ".o_field_state_selection button");
|
||||
const doneItem = target.querySelectorAll(".dropdown-item")[2]; // item "done";
|
||||
|
||||
Reference in New Issue
Block a user