When checking the condition
`isOnlyChildAndParentAlreadyInUseByHoursOrExpenses` the parent might
be a new object. In that case the check if false and no further
querying must be done in the parent.
This commit is contained in:
Oscar Gonzalez Fernandez 2014-04-01 18:22:42 +02:00
parent d57890ffa8
commit 70a8013eb9

View file

@ -931,7 +931,8 @@ public class OrderModel extends IntegrationEntityModel implements IOrderModel {
OrderElement orderElement) {
try {
OrderLineGroup parent = orderElement.getParent();
if (!parent.isOrder() && parent.getChildren().size() == 1) {
if (!parent.isOrder() && !parent.isNewObject()
&& parent.getChildren().size() == 1) {
if (orderElementDAO.isAlreadyInUse(parent)) {
return true;
}