New behavior when using the ‘supr’ key on a One2Many

I think that, this new behavior in the 5.2 version when the user press the key ‘supr’ (unlink the register with his parent), is not intuitive and causes more problems than benefits.

First of all, I think that is not easy for all the users to know which is the difference between remove and delete and also, there is nothing that notify to them this change. The only site where is shown any difference is if you open the keyboard shortcuts and take a look on this (most of the users won’t do):
image
Which also I don’t think make any clear the difference.

Furthermore, in the majority of the programs the key ‘supr’ it’s used to delete, so the users are accustomed to it.

Of course, this functionality can be useful in some cases, but I think that it is needed to clarify the difference or/and change the key, because they press ‘supr’ instinctively to delete, and in a big number of o2m, it returns an uncontroled error cause the field which relates the two entities can not be null.

Anyone else think that is needed some change on this behavior?

The behavior is by default to delete when Delete key is pressed on a One2Many. The behavior only change if there is an add_remove attribute which transform the widget into a mix of One2Many and Many2Many. So if add_remove is present the removal should not fail for a not null constraint otherwise there are no record to add and so add_remove is useless.

Probably, there is something I’m missing… but what I see is that by default, pressing the key ‘Supr’ it’s removing the register and ‘Control’ + ‘Supr’ is deleting it.
*Just to be clear, ‘remove’ it’s the same as unlinking the register with his parent.

Only if add_remove is set otherwise it delete it.

I’m trying it on a o2m where ‘add_remove’ is not set, but anyway the register is getting removed.
I’m not sure but, it seems to be because “remove = True” when ‘Control’ is not pressed so shouldn’t this line be evaluated with a ‘bool’ instead of a ‘not’?

We do not care about the remove value as long as add_remove attribute is not set.

I just tried on a sale line and it works. Pressing del key delete the line with no error.

The remove value is being checked on ‘_sig_remove function’ also when the add_remove attribute is not set.

I did it (just pressing the Supr key), and of course, it does not return any error, but at least in my case the line is getting removed instead of deleted.

Indeed you are right. The sale on the line is not required so it works.
So I think remove should be forced to false when add_remove is not set.
Please fill a bug.

Done.

1 Like