49 |
49 |
new_part( %part_defaults, partnumber => $i, description => "part $i test" )->save;
|
50 |
50 |
};
|
51 |
51 |
|
52 |
|
my $part1 = SL::DB::Manager::Part->find_by( partnumber => '1' );
|
53 |
|
my $part2 = SL::DB::Manager::Part->find_by( partnumber => '2' );
|
54 |
|
my $part3 = SL::DB::Manager::Part->find_by( partnumber => '3' );
|
55 |
|
my $part4 = SL::DB::Manager::Part->find_by( partnumber => '4' );
|
|
52 |
my $part1 = SL::DB::Manager::Part->find_by( partnumber => '1' ) or die;
|
|
53 |
my $part2 = SL::DB::Manager::Part->find_by( partnumber => '2' ) or die;
|
|
54 |
my $part3 = SL::DB::Manager::Part->find_by( partnumber => '3' ) or die;
|
|
55 |
my $part4 = SL::DB::Manager::Part->find_by( partnumber => '4' ) or die;
|
56 |
56 |
|
57 |
57 |
my @part_ids; # list of all part_ids to run checks against
|
58 |
58 |
push( @part_ids, $_->id ) foreach ( $part1, $part2, $part3, $part4 );
|
... | ... | |
305 |
305 |
|
306 |
306 |
is $order->items_sorted->[0]->{shipped_qty}, 5, 'unlinked legacy position test 1';
|
307 |
307 |
is $order->items_sorted->[1]->{shipped_qty}, 3, 'unlinked legacy position test 2';
|
|
308 |
|
|
309 |
}
|
|
310 |
|
|
311 |
{
|
|
312 |
# edge case:
|
|
313 |
#
|
|
314 |
# suppose an order was delivered, and someone removes one item from the delivery order.
|
|
315 |
# make sure the order is then shown as not delivered.
|
|
316 |
#
|
|
317 |
my $sales_order = create_sales_order(
|
|
318 |
save => 1,
|
|
319 |
orderitems => [ create_order_item(part => new_part()->save, qty => 5),
|
|
320 |
create_order_item(part => new_part()->save, qty => 6),
|
|
321 |
create_order_item(part => new_part()->save, qty => 7),
|
|
322 |
]
|
|
323 |
);
|
|
324 |
$sales_order->load;
|
|
325 |
|
|
326 |
my $delivery_order = SL::DB::DeliveryOrder->new_from($sales_order);
|
|
327 |
$delivery_order->save;
|
|
328 |
|
|
329 |
$delivery_order->items(@{ $delivery_order->items_sorted }[0..1]);
|
|
330 |
$delivery_order->save;
|
|
331 |
|
|
332 |
SL::Helper::ShippedQty
|
|
333 |
->new(fill_up => 0, require_stock_out => 0)
|
|
334 |
->calculate($sales_order)
|
|
335 |
->write_to_objects;
|
|
336 |
|
|
337 |
ok !$sales_order->delivered, 'after deleting a position from a delivery order, the order is undelivered again';
|
308 |
338 |
}
|
309 |
339 |
|
310 |
340 |
clear_up();
|
ShippedQty: delivered korrekt setzen
Wenn der Helper ohne fill_up aufgerufen wurde, wurden nicht existierende
Positionen für die delivered Berechnung ignoriert