[IMP] spreadsheet[_dashboard]: delete relation filter values using backspace key

This commit implements the functionality of using backspace key to
delete values in relation filter.

task 3324738

closes odoo/odoo#121513

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This commit is contained in:
Chenyun Yang
2023-05-16 18:08:07 +02:00
committed by Lucas Lefèvre
parent 00de4c6ff0
commit 085fd873d6
4 changed files with 45 additions and 2 deletions
@@ -27,6 +27,15 @@ export class RecordsSelector extends Component {
}));
}
onKeydown(ev) {
if (this.props.resIds.length === 0) {
return;
}
if (ev.key.toUpperCase() === "BACKSPACE") {
this.removeRecord(this.props.resIds[this.props.resIds.length - 1]);
}
}
searchDomain() {
return Domain.not([["id", "in", this.props.resIds]]).toList();
}
@@ -3,7 +3,9 @@
<div t-name="spreadsheet.RecordsSelector" class="o_field_widget o_field_many2many_tags" owl="1">
<div class="o_field_tags d-inline-flex flex-wrap mw-100 o_tags_input o_input">
<TagsList tags="tags"/>
<div class="o_field_many2many_selection d-inline-flex w-100">
<div
class="o_field_many2many_selection d-inline-flex w-100"
t-on-keydown="onKeydown">
<Many2XAutocomplete
placeholder="props.placeholder"
resModel="props.resModel"