ar/ap/gl - neues Relationship "transactions"
[kivitendo-erp.git] / SL / DB / Invoice.pm
index 7626793..08c5809 100644 (file)
@@ -45,6 +45,15 @@ __PACKAGE__->meta->add_relationship(
     column_map      => { id => 'trans_id' },
     query_args      => [ module => 'AR' ],
   },
+  transactions   => {
+    type         => 'one to many',
+    class        => 'SL::DB::AccTransaction',
+    column_map   => { id => 'trans_id' },
+    manager_args => {
+      with_objects => [ 'chart' ],
+      sort_by      => 'acc_trans_id ASC',
+    },
+  },
 );
 
 __PACKAGE__->meta->initialize;
@@ -351,15 +360,6 @@ sub customervendor {
   goto &customer;
 }
 
-sub transactions {
-  my ($self) = @_;
-
-  return unless $self->id;
-
-  require SL::DB::AccTransaction;
-  SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $self->id ]);
-}
-
 1;
 
 __END__