4 @EXPORT = qw(create_part create_service);
8 use SL::DB::Buchungsgruppe;
13 my ($buchungsgruppe, $unit);
14 $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || die "No accounting group";
15 $unit = SL::DB::Manager::Unit->find_by(name => 'Stck') || die "No unit";
17 my $part = SL::DB::Part->new_part(
18 description => 'Test part',
21 buchungsgruppen_id => $buchungsgruppe->id,
24 $part->assign_attributes( %params );
31 my ($buchungsgruppe, $unit);
32 $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || die "No accounting group";
33 $unit = SL::DB::Manager::Unit->find_by(name => 'Stck') || die "No unit";
35 my $part = SL::DB::Part->new_service(
36 description => 'Test service',
39 buchungsgruppen_id => $buchungsgruppe->id,
42 $part->assign_attributes( %params );
52 SL::Dev::Part - create part objects for testing, with minimal defaults
56 =head2 C<create_part %PARAMS>
58 Creates a new part (part_type = part).
60 Minimal usage, default values, without saving to database:
62 my $part = SL::Dev::Part::create_part();
64 Create a test part with a default warehouse and bin and save it:
66 my $wh = SL::Dev::Inventory::create_warehouse_and_bins()->save;
67 my $part1 = SL::Dev::Part::create_part(partnumber => 'a123',
68 description => 'Testpart 1',
69 warehouse_id => $wh->id,
70 bin_id => $wh->bins->[0]->id,
77 =item * create_assembly
87 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>