[FW][FIX] web, project, crm: allow hiding the properties option "View In Kanban"

Purpose
=======
Some models might use the properties field in the kanban view, some other no. For that purpose, we want to add an option in order to hide the "View In Kanban" checkbox in the properties definition.

Task-3012780

closes odoo/odoo#104252

Forward-port-of: odoo/odoo#102818
Related: odoo/enterprise#33292
Signed-off-by: David Beguin (dbe) <dbe@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Odoo's Mergebot
2022-11-02 12:37:05 +01:00
committed by GitHub
6 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -259,7 +259,7 @@
</group>
</group>
<field attrs="{'invisible': [('team_id', '=', False)]}"
name="lead_properties" nolabel="1" columns="2"/>
name="lead_properties" nolabel="1" columns="2" hideKanbanOption="1"/>
<notebook>
<page string="Internal Notes" name="internal_notes">
<field name="description" placeholder="Add a description..." options="{'collaborative': true}" />
+1 -1
View File
@@ -1188,7 +1188,7 @@
</group>
</group>
<field attrs="{'invisible': [('project_id', '=', False)]}"
name="task_properties" nolabel="1" columns="2"/>
name="task_properties" nolabel="1" columns="2" hideKanbanOption="1"/>
<notebook>
<page name="description_page" string="Description">
<field name="description" type="html" options="{'collaborative': true, 'resizable': false}" placeholder="Task description..."/>
@@ -13,6 +13,7 @@ import { usePopover } from "@web/core/popover/popover_hook";
import { sprintf } from "@web/core/utils/strings";
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
import { reposition } from '@web/core/position_hook';
import { archParseBoolean } from '@web/views/utils';
import { Component, useRef, useState, useEffect, onWillStart } from "@odoo/owl";
@@ -447,6 +448,7 @@ export class PropertiesField extends Component {
isNewlyCreated: isNewlyCreated,
propertyIndex: propertyIndex,
propertiesSize: propertiesList.length,
hideKanbanOption: this.props.hideKanbanOption,
},
{
preventClose: this.checkPopoverClose,
@@ -471,10 +473,12 @@ PropertiesField.components = {
PropertiesField.props = {
...standardFieldProps,
columns: { type: Number, optional: true },
hideKanbanOption: { type: Boolean, optional: true },
};
PropertiesField.extractProps = ({ attrs, field }) => {
const columns = parseInt(attrs.columns || "1");
return { columns };
const hideKanbanOption = archParseBoolean(attrs.hideKanbanOption);
return { columns, hideKanbanOption };
};
PropertiesField.displayName = _lt("Properties");
@@ -383,6 +383,7 @@ PropertyDefinition.props = {
readonly: { type: Boolean, optional: true },
canChangeDefinition: { type: Boolean, optional: true },
propertyDefinition: { optional: true },
hideKanbanOption: { type: Boolean, optional: true },
context: { type: Object },
isNewlyCreated: { type: Boolean, optional: true },
// index and number of properties, to hide the move arrows when needed
@@ -55,6 +55,14 @@
width: 100%;
display: inline-block !important;
}
.o-checkbox {
padding-left: 0 !important;
input {
margin-left: 0 !important;
}
}
}
.o_field_property_definition {
@@ -164,7 +164,7 @@
/>
</td>
</tr>
<tr class="o_field_property_definition_kanban">
<tr t-if="!props.hideKanbanOption" class="o_field_property_definition_kanban">
<td class="o_td_label align-top pe-2">
<b>View In Kanban</b>
</td>