diff --git a/addons/web/static/src/views/list/list_renderer.js b/addons/web/static/src/views/list/list_renderer.js
index e6aabcfeed3..be0921bf9d4 100644
--- a/addons/web/static/src/views/list/list_renderer.js
+++ b/addons/web/static/src/views/list/list_renderer.js
@@ -670,10 +670,21 @@ export class ListRenderer extends Component {
}
get getEmptyRowIds() {
- const nbEmptyRow = Math.max(0, 4 - this.props.list.records.length);
+ let nbEmptyRow = Math.max(0, 4 - this.props.list.records.length);
+ if (nbEmptyRow > 0 && this.displayRowCreates) {
+ nbEmptyRow -= 1;
+ }
return Array.from(Array(nbEmptyRow).keys());
}
+ get displayRowCreates() {
+ const activeActions = this.props.activeActions;
+ return (
+ activeActions &&
+ ("canLink" in activeActions ? activeActions.canLink : activeActions.canCreate)
+ );
+ }
+
// Group headers logic:
// if there are aggregates, the first th spans until the first
// aggregate column then all cells between aggregates are rendered
@@ -1064,7 +1075,7 @@ export class ListRenderer extends Component {
switch (hotkey) {
case "tab":
// X2many add a line
- if (activeActions && (activeActions.canLink || activeActions.canCreate)) {
+ if (this.displayRowCreates) {
if (record.isNew && !record.isDirty) {
list.unselectRecord(true);
return false;
@@ -1133,7 +1144,7 @@ export class ListRenderer extends Component {
case "tab": {
const index = list.records.indexOf(record);
if (index === list.records.length - 1) {
- if (activeActions && (activeActions.canLink || activeActions.canCreate)) {
+ if (this.displayRowCreates) {
if (record.isNew && !record.isDirty) {
list.unselectRecord(true);
return false;
@@ -1208,11 +1219,7 @@ export class ListRenderer extends Component {
if (futureRecord) {
futureRecord.switchMode("edit");
- } else if (
- this.lastIsDirty ||
- !record.canBeAbandoned ||
- (activeActions && (activeActions.canLink || activeActions.canCreate))
- ) {
+ } else if (this.lastIsDirty || !record.canBeAbandoned || this.displayRowCreates) {
this.props.onAdd({ group });
} else {
futureRecord = list.records.at(0);
diff --git a/addons/web/static/src/views/list/list_renderer.xml b/addons/web/static/src/views/list/list_renderer.xml
index 9b2ed6fdbf8..ccf5fd68ddd 100644
--- a/addons/web/static/src/views/list/list_renderer.xml
+++ b/addons/web/static/src/views/list/list_renderer.xml
@@ -34,26 +34,6 @@