Revision e4deca80
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
| t/db/delivery_order.t | ||
|---|---|---|
| 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";
 | ||
| t/workflow/delivery_order_reclamation.t | ||
|---|---|---|
| use SL::DB::Employee;
 | ||
| use SL::DB::Part;
 | ||
| use SL::DB::Unit;
 | ||
| use SL::Model::Record;
 | ||
|  | ||
| use Rose::DB::Object::Helpers qw(clone);
 | ||
|  | ||
| ... | ... | |
| )->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;
 | ||
| t/workflow/invoice_to_reclamation.t | ||
|---|---|---|
| use SL::DB::Employee;
 | ||
| use SL::DB::Part;
 | ||
| use SL::DB::Unit;
 | ||
| use SL::Model::Record;
 | ||
|  | ||
| use Rose::DB::Object::Helpers qw(clone);
 | ||
|  | ||
| ... | ... | |
| )->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;
 | ||
| t/workflow/order_reclamation.t | ||
|---|---|---|
| use SL::DB::Employee;
 | ||
| use SL::DB::Part;
 | ||
| use SL::DB::Unit;
 | ||
| use SL::Model::Record;
 | ||
|  | ||
| use Rose::DB::Object::Helpers qw(clone);
 | ||
|  | ||
| ... | ... | |
| )->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;
 | ||
| t/workflow/reclamation_reclamation.t | ||
|---|---|---|
| use SL::DB::Employee;
 | ||
| use SL::DB::Part;
 | ||
| use SL::DB::Unit;
 | ||
| use SL::Model::Record;
 | ||
|  | ||
| use Rose::DB::Object::Helpers qw(clone);
 | ||
|  | ||
| ... | ... | |
| )->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;
 | ||
|  | ||
Auch abrufbar als: Unified diff
MOdel::Record: Test angepasst