Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fbee3bde

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID fbee3bdeeee3656da988728a1fa66b85ace19a35
  • Vorgänger b61b36e7
  • Nachfolger d87306b2

MOdel::Record: Test angepasst

Unterschiede anzeigen:

t/db/delivery_order.t
40 40
is scalar @{ $delivery_order->items }, 2, "purchase delivery order keeps items";
41 41
is $delivery_order->vendor_id, $order1->vendor_id, "purchase delivery order keeps vendor";
42 42

  
43
my $supplier_delivery_order = SL::DB::DeliveryOrder->new_from($order1, type => SUPPLIER_DELIVERY_ORDER_TYPE);
43
my $supplier_delivery_order = SL::DB::DeliveryOrder->new_from($order1, destination_type => SUPPLIER_DELIVERY_ORDER_TYPE);
44 44

  
45 45
is $supplier_delivery_order->type, SUPPLIER_DELIVERY_ORDER_TYPE, "new_from purchase order with given type gives supplier delivery order";
46 46
is scalar @{ $supplier_delivery_order->items }, 0, "supplier delivery order ignores items";
t/workflow/delivery_order_reclamation.t
24 24
use SL::DB::Employee;
25 25
use SL::DB::Part;
26 26
use SL::DB::Unit;
27
use SL::Model::Record;
27 28

  
28 29
use Rose::DB::Object::Helpers qw(clone);
29 30

  
......
180 181
)->load;
181 182

  
182 183
# convert order → reclamation
183
my $converted_sales_reclamation = $sales_delivery_order->convert_to_reclamation;
184
my $converted_sales_reclamation = SL::Model::Record->new_from_workflow($sales_delivery_order, "sales_reclamation");
184 185
$converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
185 186
$converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
186 187
$converted_sales_reclamation->save->load;
187
my $converted_purchase_reclamation = $purchase_delivery_order->convert_to_reclamation;
188
my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_delivery_order, "purchase_reclamation");
188 189
$converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
189 190
$converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
190 191
$converted_purchase_reclamation->save->load;
191 192

  
193
# TODO: use SL::Model::Record for conversion
192 194
# convert reclamation → order
193 195
my $converted_sales_delivery_order = $sales_reclamation->convert_to_delivery_order->save->load;
194 196
my $converted_purchase_delivery_order = $purchase_reclamation->convert_to_delivery_order->save->load;
t/workflow/invoice_to_reclamation.t
24 24
use SL::DB::Employee;
25 25
use SL::DB::Part;
26 26
use SL::DB::Unit;
27
use SL::Model::Record;
27 28

  
28 29
use Rose::DB::Object::Helpers qw(clone);
29 30

  
......
180 181
)->load;
181 182

  
182 183
# convert invoice → reclamation
183
my $converted_sales_reclamation = $sales_invoice->convert_to_reclamation;
184
my $converted_sales_reclamation =SL::Model::Record->new_from_workflow($sales_invoice, "sales_reclamation");
184 185
$converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
185 186
$converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
186 187
$converted_sales_reclamation->save->load;
187
my $converted_purchase_reclamation = $purchase_invoice->convert_to_reclamation;
188
my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_invoice, "purchase_reclamation");
188 189
$converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
189 190
$converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
190 191
$converted_purchase_reclamation->save->load;
t/workflow/order_reclamation.t
24 24
use SL::DB::Employee;
25 25
use SL::DB::Part;
26 26
use SL::DB::Unit;
27
use SL::Model::Record;
27 28

  
28 29
use Rose::DB::Object::Helpers qw(clone);
29 30

  
......
180 181
)->load;
181 182

  
182 183
# convert order → reclamation
183
my $converted_sales_reclamation = $sales_order->convert_to_reclamation;
184
my $converted_sales_reclamation = SL::Model::Record->new_from_workflow($sales_order, "sales_reclamation");
184 185
$converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
185 186
$converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
186 187
$converted_sales_reclamation->save->load;
187
my $converted_purchase_reclamation = $purchase_order->convert_to_reclamation;
188
my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_order, "purchase_reclamation");
188 189
$converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
189 190
$converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
190 191
$converted_purchase_reclamation->save->load;
191 192

  
193
# TODO: use SL::Model::Record for conversion
192 194
# convert reclamation → order
193 195
my $converted_sales_order = $sales_reclamation->convert_to_order->save->load;
194 196
my $converted_purchase_order = $purchase_reclamation->convert_to_order->save->load;
t/workflow/reclamation_reclamation.t
22 22
use SL::DB::Employee;
23 23
use SL::DB::Part;
24 24
use SL::DB::Unit;
25
use SL::Model::Record;
25 26

  
26 27
use Rose::DB::Object::Helpers qw(clone);
27 28

  
......
150 151
)->load;
151 152

  
152 153
# new
153
my $new_sales_reclamation = SL::DB::Reclamation->new_from($sales_reclamation, destination_type => 'sales_reclamation')->save->load;
154
my $new_purchase_reclamation = SL::DB::Reclamation->new_from($purchase_reclamation, destination_type => 'purchase_reclamation')->save->load;
154
my $new_sales_reclamation = SL::Model::Record->new_from_workflow($sales_reclamation, 'sales_reclamation')->save->load;
155
my $new_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_reclamation, 'purchase_reclamation')->save->load;
155 156

  
156 157
# convert
157
my $converted_purchase_reclamation = SL::DB::Reclamation->new_from($sales_reclamation, destination_type => 'purchase_reclamation');
158
my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($sales_reclamation, 'purchase_reclamation');
158 159
$converted_purchase_reclamation->vendor_id($purchase_reclamation->{vendor_id});
159 160
$converted_purchase_reclamation->save->load;
160
my $converted_sales_reclamation = SL::DB::Reclamation->new_from($purchase_reclamation, destination_type => 'sales_reclamation');
161
my $converted_sales_reclamation = SL::Model::Record->new_from_workflow($purchase_reclamation, 'sales_reclamation');
161 162
$converted_sales_reclamation->customer_id($sales_reclamation->{customer_id});
162 163
$converted_sales_reclamation->save->load;
163 164

  

Auch abrufbar als: Unified diff