From 72ab222ccb9b4f968cda1f0ea49a4fb2d35e11ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 16 Jun 2021 11:40:00 +0200 Subject: [PATCH] =?utf8?q?S/H/Inventory.pm=20Kommentare=20beim=20Erzeugnis?= =?utf8?q?=20fertigen=20f=C3=BCr=20verbrauchte=20Artikel?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Helper/Inventory.pm | 1 + t/wh/inventory.t | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/SL/Helper/Inventory.pm b/SL/Helper/Inventory.pm index cc7601f6d..c9092c73c 100644 --- a/SL/Helper/Inventory.pm +++ b/SL/Helper/Inventory.pm @@ -332,6 +332,7 @@ sub produce_assembly { trans_type => $trans_type_out, shippingdate => $shippingdate, employee => SL::DB::Manager::Employee->current, + comment => t8('Used for assembly #1 #2', $part->partnumber, $part->description), ); } diff --git a/t/wh/inventory.t b/t/wh/inventory.t index a10b9cf16..5b59c9202 100644 --- a/t/wh/inventory.t +++ b/t/wh/inventory.t @@ -1,4 +1,5 @@ use strict; +use Test::Deep qw(cmp_deeply ignore superhashof); use Test::More; use Test::Exception; @@ -177,6 +178,37 @@ is(SL::Helper::Inventory::get_stock(part => $assembly1), "3.00000", 'produce wit is(SL::Helper::Inventory::get_stock(part => $part1), "2.00000", 'and consumes...'); is(SL::Helper::Inventory::get_stock(part => $part2), "7.00000", '..the materials'); +# check comments and warehouses +$::form->{l_comment} = 'Y'; +$::form->{l_warehouse_from} = 'Y'; +$::form->{l_warehouse_to} = 'Y'; +local $::instance_conf->data->{produce_assembly_same_warehouse} = 1; + +my @contents = WH->get_warehouse_journal(sort => 'date'); + +cmp_deeply(\@contents, + [ ignore(), ignore(), + superhashof({ + 'comment' => 'Used for assembly 6 Test Assembly', + 'warehouse_from' => 'Warehouse' + }), + superhashof({ + 'comment' => 'Used for assembly 6 Test Assembly', + 'warehouse_from' => 'Warehouse' + }), + superhashof({ + 'part_type' => 'assembly', + 'warehouse_to' => 'Warehouse' + }), + ], + "Comments for assembly productions are ok" +); + + + + + + # try to produce without allocations dies dies_ok(sub { -- 2.20.1