commit c90c2c71111c753f86a72ce9faba31503339ddca
Author: Tamino Steinert <tamino.steinert@tamino.st>
Date:   Tue Feb 14 17:48:23 2023 +0100

    MOdel::Record: Test angepasst

diff --git a/t/db/delivery_order.t b/t/db/delivery_order.t
index 372cc872f..223137aa9 100644
--- a/t/db/delivery_order.t
+++ b/t/db/delivery_order.t
@@ -40,7 +40,7 @@ is $delivery_order->type, PURCHASE_DELIVERY_ORDER_TYPE, "new_from purchase order
 is scalar @{ $delivery_order->items }, 2, "purchase delivery order keeps items";
 is $delivery_order->vendor_id, $order1->vendor_id, "purchase delivery order keeps vendor";
 
-my $supplier_delivery_order = SL::DB::DeliveryOrder->new_from($order1, type => SUPPLIER_DELIVERY_ORDER_TYPE);
+my $supplier_delivery_order = SL::DB::DeliveryOrder->new_from($order1, destination_type => SUPPLIER_DELIVERY_ORDER_TYPE);
 
 is $supplier_delivery_order->type, SUPPLIER_DELIVERY_ORDER_TYPE, "new_from purchase order with given type gives supplier delivery order";
 is scalar @{ $supplier_delivery_order->items }, 0, "supplier delivery order ignores items";
diff --git a/t/workflow/delivery_order_reclamation.t b/t/workflow/delivery_order_reclamation.t
index 89a439ddc..a22f2578a 100644
--- a/t/workflow/delivery_order_reclamation.t
+++ b/t/workflow/delivery_order_reclamation.t
@@ -24,6 +24,7 @@ use SL::DB::DeliveryTerm;
 use SL::DB::Employee;
 use SL::DB::Part;
 use SL::DB::Unit;
+use SL::Model::Record;
 
 use Rose::DB::Object::Helpers qw(clone);
 
@@ -180,15 +181,16 @@ my $purchase_delivery_order = SL::Dev::Record::create_purchase_delivery_order(
 )->load;
 
 # convert order → reclamation
-my $converted_sales_reclamation = $sales_delivery_order->convert_to_reclamation;
+my $converted_sales_reclamation = SL::Model::Record->new_from_workflow($sales_delivery_order, "sales_reclamation");
 $converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
 $converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
 $converted_sales_reclamation->save->load;
-my $converted_purchase_reclamation = $purchase_delivery_order->convert_to_reclamation;
+my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_delivery_order, "purchase_reclamation");
 $converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
 $converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
 $converted_purchase_reclamation->save->load;
 
+# TODO: use SL::Model::Record for conversion
 # convert reclamation → order
 my $converted_sales_delivery_order = $sales_reclamation->convert_to_delivery_order->save->load;
 my $converted_purchase_delivery_order = $purchase_reclamation->convert_to_delivery_order->save->load;
diff --git a/t/workflow/invoice_to_reclamation.t b/t/workflow/invoice_to_reclamation.t
index 7d5744a60..dde95fc04 100644
--- a/t/workflow/invoice_to_reclamation.t
+++ b/t/workflow/invoice_to_reclamation.t
@@ -24,6 +24,7 @@ use SL::DB::DeliveryTerm;
 use SL::DB::Employee;
 use SL::DB::Part;
 use SL::DB::Unit;
+use SL::Model::Record;
 
 use Rose::DB::Object::Helpers qw(clone);
 
@@ -180,11 +181,11 @@ my $purchase_invoice = SL::Dev::Record::create_purchase_invoice(
 )->load;
 
 # convert invoice → reclamation
-my $converted_sales_reclamation = $sales_invoice->convert_to_reclamation;
+my $converted_sales_reclamation =SL::Model::Record->new_from_workflow($sales_invoice, "sales_reclamation");
 $converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
 $converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
 $converted_sales_reclamation->save->load;
-my $converted_purchase_reclamation = $purchase_invoice->convert_to_reclamation;
+my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_invoice, "purchase_reclamation");
 $converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
 $converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
 $converted_purchase_reclamation->save->load;
diff --git a/t/workflow/order_reclamation.t b/t/workflow/order_reclamation.t
index 0ef60b65d..5d12599a5 100644
--- a/t/workflow/order_reclamation.t
+++ b/t/workflow/order_reclamation.t
@@ -24,6 +24,7 @@ use SL::DB::DeliveryTerm;
 use SL::DB::Employee;
 use SL::DB::Part;
 use SL::DB::Unit;
+use SL::Model::Record;
 
 use Rose::DB::Object::Helpers qw(clone);
 
@@ -180,15 +181,16 @@ my $purchase_order = SL::Dev::Record::create_purchase_order(
 )->load;
 
 # convert order → reclamation
-my $converted_sales_reclamation = $sales_order->convert_to_reclamation;
+my $converted_sales_reclamation = SL::Model::Record->new_from_workflow($sales_order, "sales_reclamation");
 $converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
 $converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
 $converted_sales_reclamation->save->load;
-my $converted_purchase_reclamation = $purchase_order->convert_to_reclamation;
+my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_order, "purchase_reclamation");
 $converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
 $converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
 $converted_purchase_reclamation->save->load;
 
+# TODO: use SL::Model::Record for conversion
 # convert reclamation → order
 my $converted_sales_order = $sales_reclamation->convert_to_order->save->load;
 my $converted_purchase_order = $purchase_reclamation->convert_to_order->save->load;
diff --git a/t/workflow/reclamation_reclamation.t b/t/workflow/reclamation_reclamation.t
index ae609db52..efba93b66 100644
--- a/t/workflow/reclamation_reclamation.t
+++ b/t/workflow/reclamation_reclamation.t
@@ -22,6 +22,7 @@ use SL::DB::DeliveryTerm;
 use SL::DB::Employee;
 use SL::DB::Part;
 use SL::DB::Unit;
+use SL::Model::Record;
 
 use Rose::DB::Object::Helpers qw(clone);
 
@@ -150,14 +151,14 @@ my $purchase_reclamation = SL::Dev::Record::create_purchase_reclamation(
 )->load;
 
 # new
-my $new_sales_reclamation = SL::DB::Reclamation->new_from($sales_reclamation, destination_type => 'sales_reclamation')->save->load;
-my $new_purchase_reclamation = SL::DB::Reclamation->new_from($purchase_reclamation, destination_type => 'purchase_reclamation')->save->load;
+my $new_sales_reclamation = SL::Model::Record->new_from_workflow($sales_reclamation, 'sales_reclamation')->save->load;
+my $new_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_reclamation, 'purchase_reclamation')->save->load;
 
 # convert
-my $converted_purchase_reclamation = SL::DB::Reclamation->new_from($sales_reclamation, destination_type => 'purchase_reclamation');
+my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($sales_reclamation, 'purchase_reclamation');
 $converted_purchase_reclamation->vendor_id($purchase_reclamation->{vendor_id});
 $converted_purchase_reclamation->save->load;
-my $converted_sales_reclamation = SL::DB::Reclamation->new_from($purchase_reclamation, destination_type => 'sales_reclamation');
+my $converted_sales_reclamation = SL::Model::Record->new_from_workflow($purchase_reclamation, 'sales_reclamation');
 $converted_sales_reclamation->customer_id($sales_reclamation->{customer_id});
 $converted_sales_reclamation->save->load;
 
