->calculate($purchase_order)
->write_to_objects;
-is($purchase_order->orderitems->[0]->{shipped_qty}, 0, "first purchase orderitem has no shipped_qty");
-ok(!$purchase_order->orderitems->[0]->{delivered}, "first purchase orderitem is not delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 0, "first purchase orderitem has no shipped_qty");
+ok(!$purchase_order->items_sorted->[0]->{delivered}, "first purchase orderitem is not delivered");
my $purchase_orderitem_part1 = SL::DB::Manager::OrderItem->find_by( parts_id => $part1->id, trans_id => $purchase_order->id);
->calculate($purchase_order)
->write_to_objects;
-is($purchase_order->orderitems->[0]->{shipped_qty}, 11, "require_stock_out => 0: first purchase orderitem has shipped_qty");
-ok($purchase_order->orderitems->[0]->{delivered}, "require_stock_out => 0: first purchase orderitem is delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 11, "require_stock_out => 0: first purchase orderitem has shipped_qty");
+ok($purchase_order->items_sorted->[0]->{delivered}, "require_stock_out => 0: first purchase orderitem is delivered");
Rose::DB::Object::Helpers::forget_related($purchase_order, 'orderitems');
$purchase_order->orderitems;
->calculate($purchase_order)
->write_to_objects;
-is($purchase_order->orderitems->[0]->{shipped_qty}, 0, "require_stock_out => 1: first purchase orderitem has no shipped_qty");
-ok(!$purchase_order->orderitems->[0]->{delivered}, "require_stock_out => 1: first purchase orderitem is not delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 0, "require_stock_out => 1: first purchase orderitem has no shipped_qty");
+ok(!$purchase_order->items_sorted->[0]->{delivered}, "require_stock_out => 1: first purchase orderitem is not delivered");
# ship items from delivery order
SL::Dev::Inventory::transfer_purchase_delivery_order($purchase_delivery_order);
->calculate($purchase_order)
->write_to_objects;
-is($purchase_order->orderitems->[0]->{shipped_qty}, 11, "require_stock_out => 1: first purchase orderitem has shipped_qty");
-ok($purchase_order->orderitems->[0]->{delivered}, "require_stock_out => 1: first purchase orderitem is delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 11, "require_stock_out => 1: first purchase orderitem has shipped_qty");
+ok($purchase_order->items_sorted->[0]->{delivered}, "require_stock_out => 1: first purchase orderitem is delivered");
my $purchase_orderitem_part2 = SL::DB::Manager::OrderItem->find_by(parts_id => $part1->id, trans_id => $purchase_order->id);
->calculate($sales_order)
->write_to_objects;
-is($sales_order->orderitems->[0]->{shipped_qty}, 0, "first sales orderitem has no shipped_qty");
-ok(!$sales_order->orderitems->[0]->{delivered}, "first sales orderitem is not delivered");
+is($sales_order->items_sorted->[0]->{shipped_qty}, 0, "first sales orderitem has no shipped_qty");
+ok(!$sales_order->items_sorted->[0]->{delivered}, "first sales orderitem is not delivered");
my $orderitem_part1 = SL::DB::Manager::OrderItem->find_by(parts_id => $part1->id, trans_id => $sales_order->id);
my $orderitem_part2 = SL::DB::Manager::OrderItem->find_by(parts_id => $part2->id, trans_id => $sales_order->id);
->calculate($sales_order)
->write_to_objects;
-is($sales_order->orderitems->[0]->{shipped_qty}, 5, "require_stock_out => 0: first sales orderitem has shipped_qty");
-ok($sales_order->orderitems->[0]->{delivered}, "require_stock_out => 0: first sales orderitem is delivered");
+is($sales_order->items_sorted->[0]->{shipped_qty}, 5, "require_stock_out => 0: first sales orderitem has shipped_qty");
+ok($sales_order->items_sorted->[0]->{delivered}, "require_stock_out => 0: first sales orderitem is delivered");
Rose::DB::Object::Helpers::forget_related($sales_order, 'orderitems');
$sales_order->orderitems;
->calculate($sales_order)
->write_to_objects;
-is($sales_order->orderitems->[0]->{shipped_qty}, 0, "require_stock_out => 1: first sales orderitem has no shipped_qty");
-ok(!$sales_order->orderitems->[0]->{delivered}, "require_stock_out => 1: first sales orderitem is not delivered");
+is($sales_order->items_sorted->[0]->{shipped_qty}, 0, "require_stock_out => 1: first sales orderitem has no shipped_qty");
+ok(!$sales_order->items_sorted->[0]->{delivered}, "require_stock_out => 1: first sales orderitem is not delivered");
# ship items from delivery order
SL::Dev::Inventory::transfer_sales_delivery_order($sales_delivery_order);