From: Jan Büren Date: Wed, 23 Jun 2021 11:13:52 +0000 (+0200) Subject: S/DB/Order convert_to_delivery_order delivered in Abhängigkeit von stock_out setzen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~158 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=8f413df46f21248aa3593b21b72febe65b9751e7;p=kivitendo-erp.git S/DB/Order convert_to_delivery_order delivered in Abhängigkeit von stock_out setzen Testfall ergänzt --- 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');