]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/DB/Assembly.pm
Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / DB / Assembly.pm
index 2519c1a459f128ffdb60c591f6577354c1ce2f69..fd645c2c98eaaa94b3961d2745095ebeae74c129 100644 (file)
@@ -1,6 +1,3 @@
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
 package SL::DB::Assembly;
 
 use strict;
@@ -26,4 +23,11 @@ sub linetotal_lastcost {
   return $self->qty * $self->part->lastcost / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 );
 }
 
+sub linetotal_weight {
+  my ($self) = @_;
+
+  return 0 unless $self->qty > 0 and ($self->part->weight||0) > 0;
+  return $self->qty * $self->part->weight;
+}
+
 1;