Revision 72c4037d
Von Sven Schöling vor mehr als 7 Jahren hinzugefügt
t/helper/shipped_qty.t | ||
---|---|---|
206 | 206 |
|
207 | 207 |
clear_up(); |
208 | 208 |
|
209 |
{ |
|
210 |
# legacy unlinked scenario: |
|
211 |
# |
|
212 |
# order with two positions of the same part, qtys: 5, 3. |
|
213 |
# 3 linked delivery orders, with positions: |
|
214 |
# 1: 3 unlinked |
|
215 |
# 2: 1 linked to 1, 3 linked to 2 |
|
216 |
# 3: 1 linked to 1 |
|
217 |
# |
|
218 |
# should be resolved under fill_up as 5/3, but gets resolved as 4/4 |
|
219 |
my $part = new_part()->save; |
|
220 |
my $order = create_sales_order( |
|
221 |
orderitems => [ |
|
222 |
create_order_item(part => $part, qty => 5), |
|
223 |
create_order_item(part => $part, qty => 3), |
|
224 |
], |
|
225 |
)->save; |
|
226 |
my $do1 = create_sales_delivery_order( |
|
227 |
orderitems => [ |
|
228 |
create_delivery_order_item(part => $part, qty => 3), |
|
229 |
], |
|
230 |
); |
|
231 |
my $do2 = create_sales_delivery_order( |
|
232 |
orderitems => [ |
|
233 |
create_delivery_order_item(part => $part, qty => 1), |
|
234 |
create_delivery_order_item(part => $part, qty => 3), |
|
235 |
], |
|
236 |
); |
|
237 |
my $do3 = create_sales_delivery_order( |
|
238 |
orderitems => [ |
|
239 |
create_delivery_order_item(part => $part, qty => 1), |
|
240 |
], |
|
241 |
); |
|
242 |
$order->link_to_record($do1); |
|
243 |
$order->link_to_record($do2); |
|
244 |
$order->items_sorted->[0]->link_to_record($do2->items_sorted->[0]); |
|
245 |
$order->items_sorted->[1]->link_to_record($do2->items_sorted->[1]); |
|
246 |
$order->link_to_record($do3); |
|
247 |
$order->items_sorted->[0]->link_to_record($do3->items->[0]); |
|
248 |
|
|
249 |
SL::Helper::ShippedQty |
|
250 |
->new(fill_up => 1, require_stock_out => 0) |
|
251 |
->calculate($order) |
|
252 |
->write_to_objects; |
|
253 |
|
|
254 |
is $order->items_sorted->[0]->{shipped_qty}, 5, 'unlinked legacy position test 1'; |
|
255 |
is $order->items_sorted->[1]->{shipped_qty}, 3, 'unlinked legacy position test 2'; |
|
256 |
} |
|
257 |
|
|
258 |
clear_up(); |
|
259 |
|
|
209 | 260 |
done_testing; |
210 | 261 |
|
211 | 262 |
sub clear_up { |
Auch abrufbar als: Unified diff
shipped_qty: Testfall uas realem Bug