Accounting field as readonly in product category

As sseen in:

the field “Accounting” of product.category is readonly when the record has parent or children.

This make it pretty easy for a user to create an “invalid” or “unexpected” structure if:

  • User creates category A with Accounting=True
  • User creates category B with Accounting=False
  • User drags and drops B as a child of A.

In that situation the user finds that he/she cannot change the “Accounting” field for category B to “True” because it has a parent and does not easily/intuitively know how to fix it.

Any ideas on how to make it more robust?

Maybe adding a constraint on “parent” to ensure that the value of accounting is the same in self and parent?

This constraint is already present but it seems that is not enforced when using drag and drop.
So probably the client should be improved to show the domain validation error when using drag and drop.

Uops! I missed that, thanks.

I’ll check out how the user managed to get to that situation. Maybe the check is missed for the children field, too.

Indeed the drop should be denied if it would break the validity of the record. But it is not going to be simple to do.