Skip to content

Commit

Permalink
EK-Rechnung: EK-Preis nur aktualisieren, wenn geändert
Browse files Browse the repository at this point in the history
  • Loading branch information
bblessmann committed Oct 16, 2023
1 parent 418078a commit ddf3c55
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions SL/IR.pm
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,11 @@ sub _post_invoice {
# change lastcost for part and all assemblies and assortments recursively
my $a = SL::DB::Part->load_cached(conv_i($form->{"id_$i"}));
my $part_price_factor = $a->price_factor_id ? $a->price_factor->factor : 1;
$a->update_attributes(lastcost => abs($fxsellprice * $form->{exchangerate} / $basefactor / $price_factor * $part_price_factor));
$a->set_lastcost_assemblies_and_assortiments;
my $new_lastcost = abs($fxsellprice * $form->{exchangerate} / $basefactor / $price_factor * $part_price_factor);
if ( abs($a->lastcost - $new_lastcost) >= 0.009 ) {
$a->update_attributes(lastcost => $new_lastcost);
$a->set_lastcost_assemblies_and_assortiments;
}

# check if we sold the item already and
# make an entry for the expense and inventory
Expand Down

0 comments on commit ddf3c55

Please sign in to comment.