[FIX] web: kanbanRenderer can choose if it supports Sortable

Before this commit, there was no way to set a finer condition upon which
the KanbanRenderer enables its sortable feature, that is, the drag and drop
of kanban cards.

After this commit, a getter is used instead of the hardcoded condition which checked
whether the the screen was small in the env.
It makes the KanbanRenderer more extendable.

closes odoo/odoo#105026

X-original-commit: 731371320a441cc10b97b7f45b511298c45ae10a
Related: odoo/enterprise#33640
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
Lucas Perais
2022-11-04 16:59:45 +01:00
parent 70c41dafd4
commit 7c1cf4f683
@@ -41,7 +41,7 @@ export class KanbanRenderer extends Component {
let dataRecordId;
let dataGroupId;
const rootRef = useRef("root");
if (!this.env.isSmall) {
if (this.canUseSortable) {
useSortable({
enable: () => this.canResequenceRecords,
// Params
@@ -151,6 +151,10 @@ export class KanbanRenderer extends Component {
// Getters
// ------------------------------------------------------------------------
get canUseSortable() {
return !this.env.isSmall;
}
get canMoveRecords() {
if (!this.canResequenceRecords) {
return false;