- if (!$form->{id}) {
- my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1;
- my $next_workday = DateTime->today_local->add(days => $extra_days);
- my $day_of_week = $next_workday->day_of_week;
-
- $next_workday->add(days => (8 - $day_of_week)) if $day_of_week >= 6;
+ # If collective order was created from exactly 1 order, we assume the same
+ # behaviour as a "save as new" from within an order is actually desired, i.e.
+ # the original order isn't part of a workflow where we want to remember
+ # record_links, but simply a quick way of generating a new order from an old
+ # one without having to enter everything again.
+ # Setting useasnew will prevent the creation of record_links for the items
+ # when saving the new order.
+ # This form variable is probably not necessary, could just set saveasnew instead
+ $form->{useasnew} = 1 if $is_collective_order == 1;