From cc369842195a17aafd168223733eaf52c8d4731c Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Wed, 15 Jul 2015 16:32:05 +0200 Subject: [PATCH] =?utf8?q?Sammelauftr=C3=A4ge=20-=20fehlerhaftes=20Verhalt?= =?utf8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Standardmäßig wird der Sammelauftrag, zusammen mit den Positionen, per RecordLinks verlinkt. Eine Ausnahme besteht wenn der Sammelauftrag aus genau einem Auftrag entstanden ist, in dem Fall wird angenommen, daß "als neu speichern" gemeint ist, und es gibt keine Verlinkung. Dies entspricht dem eigentlich gewünschten Verhalten aus Commit d40a8e2 . --- SL/OE.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SL/OE.pm b/SL/OE.pm index 74733c867..f776d515a 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -864,7 +864,16 @@ sub retrieve { # and remember for the rest of the function my $is_collective_order = scalar @ids; - $form->{useasnew} = !!$is_collective_order; + + # 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; if (!$form->{id}) { my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1; @@ -1069,6 +1078,8 @@ sub retrieve { } # delete orderitems_id in collective orders, so that they get cloned no matter what + # is this correct? or is the following meant? + # remember orderitems_ids in converted_from_orderitems_ids, so that they may be linked $ref->{converted_from_orderitems_id} = delete $ref->{orderitems_id} if $is_collective_order; # get tax rates and description -- 2.20.1