5 our @EXPORT = qw(create_part create_service);
9 use SL::DB::Buchungsgruppe;
14 my ($buchungsgruppe, $unit);
15 $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || die "No accounting group";
16 $unit = SL::DB::Manager::Unit->find_by(name => 'Stck') || die "No unit";
18 my $part = SL::DB::Part->new_part(
19 description => 'Test part',
22 buchungsgruppen_id => $buchungsgruppe->id,
25 $part->assign_attributes( %params );
32 my ($buchungsgruppe, $unit);
33 $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || die "No accounting group";
34 $unit = SL::DB::Manager::Unit->find_by(name => 'Stck') || die "No unit";
36 my $part = SL::DB::Part->new_service(
37 description => 'Test service',
40 buchungsgruppen_id => $buchungsgruppe->id,
43 $part->assign_attributes( %params );
53 SL::Dev::Part - create part objects for testing, with minimal defaults
57 =head2 C<create_part %PARAMS>
59 Creates a new part (part_type = part).
61 Minimal usage, default values, without saving to database:
63 my $part = SL::Dev::Part::create_part();
65 Create a test part with a default warehouse and bin and save it:
67 my $wh = SL::Dev::Inventory::create_warehouse_and_bins()->save;
68 my $part1 = SL::Dev::Part::create_part(partnumber => 'a123',
69 description => 'Testpart 1',
70 warehouse_id => $wh->id,
71 bin_id => $wh->bins->[0]->id,
78 =item * create_assembly
88 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>