Revision 1e941de2
Von Jan Büren vor etwa 3 Jahren hinzugefügt
t/controllers/csvimport/inventory.t | ||
---|---|---|
276 | 276 |
is $tt->direction, 'in', "Transfer direction correct"; |
277 | 277 |
is $tt->description, 'correction', "Transfer description correct"; |
278 | 278 |
|
279 |
# target_qty is 0 |
|
280 |
|
|
281 |
$file = \<<EOL; |
|
282 |
warehouse,bin,partnumber,target_qty,comment |
|
283 |
Warehouse,"Bin 1","ap 1",0,"Jetzt wirklich" |
|
284 |
EOL |
|
285 |
$entries = test_import($file, $settings1); |
|
286 |
$entry = $entries->[0]; |
|
287 |
is scalar @{ $entry->{errors} }, 0, "No error for valid data occurred"; |
|
288 |
is $entry->{object}->qty, "-33.75", "Valid qty accepted"; # evals to text qty = target_qty - actual_qty |
|
289 |
is(SL::Helper::Inventory::get_stock(part => $part1), "0.00000", 'simple add (stock) qty works'); |
|
290 |
is(SL::Helper::Inventory::get_onhand(part => $part1), undef, 'simple add (onhand) qty works'); # hmm good return? |
|
291 |
|
|
292 |
# now check the real Inventory entry |
|
293 |
$trans_id = $entry->{object}->trans_id; |
|
294 |
$inv_obj = SL::DB::Manager::Inventory->find_by(trans_id => $trans_id); |
|
295 |
|
|
296 |
# we expect one entry for one trans_id |
|
297 |
is ref $inv_obj, "SL::DB::Inventory", "One inventory object, no array or undef"; |
|
298 |
is $inv_obj->qty == -33.75000, 1, "Valid qty accepted"; |
|
299 |
is $inv_obj->comment, |
|
300 |
"Jetzt wirklich", "Valid comment accepted"; |
|
301 |
is $inv_obj->employee_id, 1, "Employee valid"; |
|
302 |
is ref $inv_obj->shippingdate, 'DateTime', "Valid DateTime for shippingdate"; |
|
303 |
is $inv_obj->shippingdate, DateTime->today_local, "Default shippingdate set"; |
|
304 |
|
|
305 |
$tt = SL::DB::Manager::TransferType->find_by(id => $inv_obj->trans_type_id); |
|
306 |
|
|
307 |
is ref $tt, 'SL::DB::TransferType', "Valid TransferType, no undef"; |
|
308 |
is $tt->direction, 'out', "Transfer direction correct"; |
|
309 |
is $tt->description, 'correction', "Transfer description correct"; |
|
310 |
|
|
311 |
|
|
312 |
|
|
279 | 313 |
|
280 | 314 |
clear_up(); # remove all data at end of tests |
281 | 315 |
|
Auch abrufbar als: Unified diff
Testfall Lagerbewegung, Zielmenge kann auch 0 sein