$_->{_record_link_direction} = $wanted;
$_->{_record_link} = $link;
$_
- } @{ $manager_class->get_all(query => [ id => $link->$sub_wanted_id, @get_objects_query ]) };
+ } @{
+ $manager_class->get_all(
+ query => [ id => $link->$sub_wanted_id, @get_objects_query ],
+ (with_objects => $params{with_objects}) x !!$params{with_objects},
+ )
+ };
};
# If no 'via' is given then use a simple(r) method for querying the wanted objects.
sub shipped_qty {
my ($self) = @_;
- my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder');
+ my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder', with_objects => [ 'orderitems' ]);
my @doi = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @$d_orders;
- require SL::AM;
return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi);
}