Revision 2fe91d5d
Von Sven Schöling vor mehr als 8 Jahren hinzugefügt
t/part/assembly.t | ||
---|---|---|
42 | 42 |
|
43 | 43 |
# create an assembly that consists of two parts |
44 | 44 |
my ($part1, $part2, $unit, $assembly_part, $assembly_1, $assembly_2); |
45 |
my $unit = SL::DB::Manager::Unit->find_by(name => 'Stck') || die "Can't find unit 'Stck'";
|
|
45 |
$unit = SL::DB::Manager::Unit->find_by(name => 'Stck') || die "Can't find unit 'Stck'"; |
|
46 | 46 |
|
47 | 47 |
$part1 = SL::DB::Part->new_part(partnumber => '19000', |
48 | 48 |
unit => $unit->name, |
... | ... | |
51 | 51 |
$part2->partnumber($part1->partnumber + 1); |
52 | 52 |
$part2->save; |
53 | 53 |
|
54 |
my $assembly_part = SL::DB::Part->new_assembly(partnumber => 'as1',
|
|
54 |
$assembly_part = SL::DB::Part->new_assembly(partnumber => 'as1', |
|
55 | 55 |
description => 'assembly', |
56 | 56 |
unit => $unit->name, |
57 | 57 |
inventory_accno_id => undef, # override |
58 | 58 |
); |
59 |
my $assembly_1 = SL::DB::Assembly->new(parts_id => $part1->id, qty => 3, bom => 1);
|
|
60 |
my $assembly_2 = SL::DB::Assembly->new(parts_id => $part2->id, qty => 3, bom => 1);
|
|
59 |
$assembly_1 = SL::DB::Assembly->new(parts_id => $part1->id, qty => 3, bom => 1); |
|
60 |
$assembly_2 = SL::DB::Assembly->new(parts_id => $part2->id, qty => 3, bom => 1); |
|
61 | 61 |
$assembly_part->add_assemblies($assembly_1, $assembly_2); |
62 | 62 |
$assembly_part->save; |
63 | 63 |
}; |
Auch abrufbar als: Unified diff
Tests: warnings in t/part/assembly.t