From 8f413df46f21248aa3593b21b72febe65b9751e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 23 Jun 2021 13:13:52 +0200 Subject: [PATCH] =?utf8?q?S/DB/Order=20convert=5Fto=5Fdelivery=5Forder=20d?= =?utf8?q?elivered=20in=20Abh=C3=A4ngigkeit=20von=20stock=5Fout=20setzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Testfall ergänzt --- SL/DB/Order.pm | 2 +- t/helper/shipped_qty.t | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index b3741df98..fe0b32153 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -275,7 +275,7 @@ sub convert_to_delivery_order { } } - $self->update_attributes(delivered => 1); + $self->update_attributes(delivered => 1) unless $::instance_conf->get_shipped_qty_require_stock_out; 1; })) { return undef; diff --git a/t/helper/shipped_qty.t b/t/helper/shipped_qty.t index f9fc4f9d7..592134b53 100644 --- a/t/helper/shipped_qty.t +++ b/t/helper/shipped_qty.t @@ -75,6 +75,7 @@ my $purchase_order = create_purchase_order( Rose::DB::Object::Helpers::forget_related($purchase_order, 'orderitems'); $purchase_order->orderitems; +local $::instance_conf->data->{shipped_qty_require_stock_out} = 1; SL::Helper::ShippedQty ->new(require_stock_out => 1) # should make no difference while there is no delivery order ->calculate($purchase_order) @@ -88,6 +89,7 @@ my $purchase_orderitem_part1 = SL::DB::Manager::OrderItem->find_by( parts_id => is($purchase_orderitem_part1->shipped_qty, 0, "OrderItem shipped_qty method ok"); is($purchase_order->closed, 0, 'purchase order is open'); +# set delivered only if the do is also stocked in ok(!$purchase_order->delivered, 'purchase order is not delivered'); note('converting purchase order to delivery order'); -- 2.20.1