[IMP] web, project, (_todo): add hide_label options in the state_selection in all view
If someone wants to show the label of the state_selection field then
it can be shown
like-
<field name="xxx" widget="state_selection" options="{'hide_label': False}"/>
task-3475416
closes odoo/odoo#136901
Related: odoo/enterprise#48060
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
This commit is contained in:
@@ -156,7 +156,8 @@
|
||||
<field name="name"/>
|
||||
<field name="date_start"/>
|
||||
<field string="Reference Working Time" name="resource_calendar_id" optional="hide"/>
|
||||
<field name="under_contract_state" widget="state_selection" optional="hide"/>
|
||||
<field name="under_contract_state" widget="state_selection" optional="hide"
|
||||
options="{'hide_label': False}"/>
|
||||
<field name="structure_type_id" optional="hide"/>
|
||||
<field name="currency_id" column_invisible="True"/>
|
||||
<field name="wage" optional="hide"/>
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
<field name="user_id" optional="show" string="Project Manager" widget="many2one_avatar_user" options="{'no_open':True, 'no_create': True, 'no_create_edit': True}"/>
|
||||
<field name="last_update_color" column_invisible="True"/>
|
||||
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" optional="hide"/>
|
||||
<field name="last_update_status" string="Status" nolabel="1" optional="show" widget="project_state_selection" options="{'hide_label': True}"/>
|
||||
<field name="last_update_status" string="Status" nolabel="1" optional="show" widget="project_state_selection"/>
|
||||
<field name="stage_id" options="{'no_open': True}" domain="[('company_id', 'in', (company_id, False))]" optional="show"/>
|
||||
<button string="View Tasks" name="action_view_tasks" type="object"/>
|
||||
</tree>
|
||||
|
||||
@@ -388,7 +388,7 @@
|
||||
<field name="id" optional="hide"/>
|
||||
<field name="parent_id" column_invisible="True"/>
|
||||
<field name="priority" widget="priority" nolabel="1" options="{'autosave': False}" width="40px"/>
|
||||
<field name="state" widget="project_task_state_selection" nolabel="1" options="{'hide_label': 1, 'autosave': False}" width="40px"/>
|
||||
<field name="state" widget="project_task_state_selection" nolabel="1" options="{'autosave': False}" width="40px"/>
|
||||
<field name="name" widget="name_with_subtask_count"/>
|
||||
<field name="subtask_count" column_invisible="True"/>
|
||||
<field name="closed_subtask_count" column_invisible="True"/>
|
||||
@@ -649,7 +649,7 @@
|
||||
<div t-att-class="['1_done', '1_canceled'].includes(record.state.raw_value) ? 'opacity-50' : ''">
|
||||
<field name="user_ids" widget="many2many_avatar_user" domain="[('share', '=', False)]"/>
|
||||
</div>
|
||||
<field name="state" widget="project_task_state_selection" options="{'hide_label': 1, 'is_toggle_mode': false}"/>
|
||||
<field name="state" widget="project_task_state_selection" options="{'is_toggle_mode': false}"/>
|
||||
</div>
|
||||
</div>
|
||||
<t t-if="record.project_id.raw_value and record.subtask_count.raw_value and record.subtask_count.raw_value > record.closed_subtask_count.raw_value">
|
||||
@@ -677,7 +677,7 @@
|
||||
<field name="closed_subtask_count" column_invisible="True"/>
|
||||
<field name="id" optional="hide"/>
|
||||
<field name="priority" widget="priority" nolabel="1"/>
|
||||
<field name="state" widget="project_task_state_selection" nolabel="1" options="{'hide_label': 1, 'is_toggle_mode': false}"/>
|
||||
<field name="state" widget="project_task_state_selection" nolabel="1" options="{'is_toggle_mode': false}"/>
|
||||
<field name="name" string="Title" widget="name_with_subtask_count"/>
|
||||
<field name="project_id" widget="project" optional="show" options="{'no_open': 1}" readonly="1" column_invisible="context.get('default_project_id')"/>
|
||||
<field name="milestone_id" invisible="not allow_milestones" context="{'default_project_id': project_id}" groups="project.group_project_milestone" optional="hide"/>
|
||||
@@ -813,7 +813,7 @@
|
||||
</div>
|
||||
<div class="d-flex justify-content-end gap-2 flex-grow-1">
|
||||
<field name="state" widget="project_task_state_selection" class="align-self-center"
|
||||
options="{'hide_label': 1, 'is_toggle_mode': false}"/>
|
||||
options="{'is_toggle_mode': false}"/>
|
||||
<field name="user_ids" widget="many2many_avatar_user" class="o_many2many_avatar_user_no_wrap"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<div class="o_kanban_record_headings">
|
||||
<div class="d-flex justify-content-start">
|
||||
<div>
|
||||
<field name="state" widget="todo_done_checkmark" options="{'hide_label': 1}"/>
|
||||
<field name="state" widget="todo_done_checkmark"/>
|
||||
</div>
|
||||
<div t-att-class="['1_done', '1_canceled'].includes(record.state.raw_value) ? 'opacity-50' : ''">
|
||||
<strong class="o_kanban_record_title align-middle">
|
||||
@@ -82,7 +82,7 @@
|
||||
multi_edit="1"
|
||||
open_form_view="True"
|
||||
js_class="todo_list">
|
||||
<field name="state" widget="todo_done_checkmark" nolabel="1" options="{'hide_label': 1}"/>
|
||||
<field name="state" widget="todo_done_checkmark" nolabel="1"/>
|
||||
<field name="name"/>
|
||||
<field name="user_ids" optional="show" widget="many2many_avatar_user" options="{'no_quick_create': True}"/>
|
||||
<field name="tag_ids" optional="show" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
|
||||
|
||||
@@ -92,13 +92,12 @@ export const stateSelectionField = {
|
||||
label: _t("Hide label"),
|
||||
name: "hide_label",
|
||||
type: "boolean",
|
||||
viewTypes: ["list"],
|
||||
},
|
||||
],
|
||||
supportedTypes: ["selection"],
|
||||
extractProps({ options, viewType }, dynamicInfo) {
|
||||
return {
|
||||
showLabel: viewType === "list" && !options.hide_label,
|
||||
showLabel: 'hide_label' in options ? !options.hide_label : false,
|
||||
withCommand: viewType === "form",
|
||||
readonly: dynamicInfo.readonly,
|
||||
autosave: "autosave" in options ? !!options.autosave : true,
|
||||
@@ -107,4 +106,3 @@ export const stateSelectionField = {
|
||||
};
|
||||
|
||||
registry.category("fields").add("state_selection", stateSelectionField);
|
||||
registry.category("fields").add("list.state_selection", stateSelectionField);
|
||||
|
||||
@@ -209,6 +209,21 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.isNotVisible(target.querySelector(".dropdown-menu"));
|
||||
});
|
||||
|
||||
QUnit.test("StateSelectionField for form view with hide_label option", async function (assert) {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="selection" widget="state_selection" options="{'hide_label': False}"/>
|
||||
</form>
|
||||
`,
|
||||
resId: 1,
|
||||
});
|
||||
assert.containsOnce(target, ".o_status_label");
|
||||
});
|
||||
|
||||
QUnit.test("StateSelectionField for list view with hide_label option", async function (assert) {
|
||||
Object.assign(serverData.models.partner.fields, {
|
||||
graph_type: {
|
||||
@@ -230,7 +245,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
arch: `
|
||||
<tree>
|
||||
<field name="graph_type" widget="state_selection" options="{'hide_label': True}"/>
|
||||
<field name="selection" widget="state_selection"/>
|
||||
<field name="selection" widget="state_selection" options="{'hide_label': False}"/>
|
||||
</tree>`,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user