Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 937f966e

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 937f966ee50ff3c4b416bcb56ae85e65ad4c905a
  • Vorgänger 3886e8eb
  • Nachfolger 4890ac15

Model::Record: nutze neue Methoden in Workflow-Test

Unterschiede anzeigen:

t/workflow/delivery_order_reclamation.t
38 38
  $unit,
39 39
  @parts,
40 40
  $department,
41
  $relamation_reason,
41
  $reclamation_reason,
42 42
);
43 43

  
44 44

  
......
101 101
    partnumber => 'Serv_2'
102 102
  )->save;
103 103

  
104
  $relamation_reason = SL::DB::ReclamationReason->new(
104
  $reclamation_reason = SL::DB::ReclamationReason->new(
105 105
    name => "test_reason",
106 106
    description => "",
107 107
    position => 1,
......
125 125
  reclamation_items       => [
126 126
    SL::Dev::Record::create_reclamation_item(
127 127
      part => $parts[0], qty =>  3, sellprice => 70,
128
      reason => $relamation_reason,
128
      reason => $reclamation_reason,
129 129
    ),
130 130
    SL::Dev::Record::create_reclamation_item(
131 131
      part => $parts[1], qty => 10, sellprice => 50,
132
      reason => $relamation_reason,
132
      reason => $reclamation_reason,
133 133
    ),
134 134
  ],
135 135
)->load;
......
145 145
  reclamation_items       => [
146 146
    SL::Dev::Record::create_reclamation_item(
147 147
      part => $parts[0], qty =>  3, sellprice => 70,
148
      reason => $relamation_reason,
148
      reason => $reclamation_reason,
149 149
    ),
150 150
    SL::Dev::Record::create_reclamation_item(
151 151
      part => $parts[1], qty => 10, sellprice => 50,
152
      reason => $relamation_reason,
152
      reason => $reclamation_reason,
153 153
    ),
154 154
  ],
155 155
)->load;
......
182 182
)->load;
183 183

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

  
194
# TODO: use SL::Model::Record for conversion
195 194
# convert reclamation → order
196
my $converted_sales_delivery_order = $sales_reclamation->convert_to_delivery_order->save->load;
197
my $converted_purchase_delivery_order = $purchase_reclamation->convert_to_delivery_order->save->load;
195
my $converted_sales_delivery_order = SL::Model::Record->new_from_workflow($sales_reclamation, 'rma_delivery_order')->save->load;
196
my $converted_purchase_delivery_order = SL::Model::Record->new_from_workflow($purchase_reclamation, 'supplier_delivery_order')->save->load;
198 197

  
199 198

  
200 199
#get items before strip
t/workflow/invoice_to_reclamation.t
38 38
  $unit,
39 39
  @parts,
40 40
  $department,
41
  $relamation_reason,
41
  $reclamation_reason,
42 42
);
43 43

  
44 44

  
......
101 101
    partnumber => 'Serv_2'
102 102
  )->save;
103 103

  
104
  $relamation_reason = SL::DB::ReclamationReason->new(
104
  $reclamation_reason = SL::DB::ReclamationReason->new(
105 105
    name => "test_reason",
106 106
    description => "",
107 107
    position => 1,
......
125 125
  reclamation_items       => [
126 126
    create_reclamation_item(
127 127
      part => $parts[0], qty =>  3, sellprice => 70,
128
      reason => $relamation_reason,
128
      reason => $reclamation_reason,
129 129
    ),
130 130
    create_reclamation_item(
131 131
      part => $parts[1], qty => 10, sellprice => 50,
132
      reason => $relamation_reason,
132
      reason => $reclamation_reason,
133 133
    ),
134 134
  ],
135 135
)->load;
......
145 145
  reclamation_items       => [
146 146
    create_reclamation_item(
147 147
      part => $parts[0], qty =>  3, sellprice => 70,
148
      reason => $relamation_reason,
148
      reason => $reclamation_reason,
149 149
    ),
150 150
    create_reclamation_item(
151 151
      part => $parts[1], qty => 10, sellprice => 50,
152
      reason => $relamation_reason,
152
      reason => $reclamation_reason,
153 153
    ),
154 154
  ],
155 155
)->load;
......
183 183

  
184 184
# convert invoice → reclamation
185 185
my $converted_sales_reclamation =SL::Model::Record->new_from_workflow($sales_invoice, "sales_reclamation");
186
$converted_sales_reclamation->items_sorted->[0]->reason($relamation_reason);
187
$converted_sales_reclamation->items_sorted->[1]->reason($relamation_reason);
186
$converted_sales_reclamation->items_sorted->[0]->reason($reclamation_reason);
187
$converted_sales_reclamation->items_sorted->[1]->reason($reclamation_reason);
188 188
$converted_sales_reclamation->save->load;
189 189
my $converted_purchase_reclamation = SL::Model::Record->new_from_workflow($purchase_invoice, "purchase_reclamation");
190
$converted_purchase_reclamation->items_sorted->[0]->reason($relamation_reason);
191
$converted_purchase_reclamation->items_sorted->[1]->reason($relamation_reason);
190
$converted_purchase_reclamation->items_sorted->[0]->reason($reclamation_reason);
191
$converted_purchase_reclamation->items_sorted->[1]->reason($reclamation_reason);
192 192
$converted_purchase_reclamation->save->load;
193 193

  
194 194
#get items before strip
t/workflow/order_reclamation.t
38 38
  $unit,
39 39
  @parts,
40 40
  $department,
41
  $relamation_reason,
41
  $reclamation_reason,
42 42
);
43 43

  
44 44

  
......
101 101
    partnumber => 'Serv_2'
102 102
  )->save;
103 103

  
104
  $relamation_reason = SL::DB::ReclamationReason->new(
104
  $reclamation_reason = SL::DB::ReclamationReason->new(
105 105
    name => "test_reason",
106 106
    description => "",
107 107
    position => 1,
......
125 125
  reclamation_items       => [
126 126
    SL::Dev::Record::create_reclamation_item(
127 127
      part => $parts[0], qty =>  3, sellprice => 70,
128
      reason => $relamation_reason,
128
      reason => $reclamation_reason,
129 129
    ),
130 130
    SL::Dev::Record::create_reclamation_item(
131 131
      part => $parts[1], qty => 10, sellprice => 50,
132
      reason => $relamation_reason,
132
      reason => $reclamation_reason,
133 133
    ),
134 134
  ],
135 135
)->load;
......
145 145
  reclamation_items       => [
146 146
    SL::Dev::Record::create_reclamation_item(
147 147
      part => $parts[0], qty =>  3, sellprice => 70,
148
      reason => $relamation_reason,
148
      reason => $reclamation_reason,
149 149
    ),
150 150
    SL::Dev::Record::create_reclamation_item(
151 151
      part => $parts[1], qty => 10, sellprice => 50,
152
      reason => $relamation_reason,
152
      reason => $reclamation_reason,
153 153
    ),
154 154
  ],
155 155
)->load;
......
183 183

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

  
194
# TODO: use SL::Model::Record for conversion
195 194
# convert reclamation → order
196
my $converted_sales_order = $sales_reclamation->convert_to_order->save->load;
197
my $converted_purchase_order = $purchase_reclamation->convert_to_order->save->load;
195
my $converted_sales_order = SL::Model::Record->new_from_workflow($sales_reclamation, 'sales_order')->save->load;
196
my $converted_purchase_order = SL::Model::Record->new_from_workflow($purchase_reclamation, 'purchase_order')->save->load;
198 197

  
199 198

  
200 199
#get items before strip
t/workflow/reclamation_reclamation.t
36 36
  $unit,
37 37
  @parts,
38 38
  $department,
39
  $relamation_reason,
39
  $reclamation_reason,
40 40
);
41 41

  
42 42

  
......
98 98
    partnumber => 'Serv_2'
99 99
  )->save;
100 100

  
101
  $relamation_reason = SL::DB::ReclamationReason->new(
101
  $reclamation_reason = SL::DB::ReclamationReason->new(
102 102
    name => "test_reason",
103 103
    description => "",
104 104
    position => 1,
......
122 122
  reclamation_items       => [
123 123
    create_reclamation_item(
124 124
      part => $parts[0], qty =>  3, sellprice => 70,
125
      reason => $relamation_reason,
125
      reason => $reclamation_reason,
126 126
    ),
127 127
    create_reclamation_item(
128 128
      part => $parts[1], qty => 10, sellprice => 50,
129
      reason => $relamation_reason,
129
      reason => $reclamation_reason,
130 130
    ),
131 131
  ],
132 132
)->load;
......
142 142
  reclamation_items       => [
143 143
    create_reclamation_item(
144 144
      part => $parts[0], qty =>  3, sellprice => 70,
145
      reason => $relamation_reason,
145
      reason => $reclamation_reason,
146 146
    ),
147 147
    create_reclamation_item(
148 148
      part => $parts[1], qty => 10, sellprice => 50,
149
      reason => $relamation_reason,
149
      reason => $reclamation_reason,
150 150
    ),
151 151
  ],
152 152
)->load;

Auch abrufbar als: Unified diff