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;
sub items_sorted {
my ($self) = @_;
- return [ sort {$a->id <=> $b->id } @{ $self->items } ];
+ return [ sort {$a->position <=> $b->position } @{ $self->items } ];
}
sub is_sales {
SL::DB::InvoiceItem->new(map({ ( $_ => $source_item->$_ ) }
qw(parts_id description qty sellprice discount project_id serialnumber pricegroup_id transdate cusordnumber unit
- base_qty longdescription lastcost price_factor_id), @item_columns),
+ base_qty longdescription lastcost price_factor_id active_discount_source active_price_source), @item_columns),
deliverydate => $source_item->reqdate,
fxsellprice => $source_item->sellprice,
custom_variables => \@custom_variables,
}
sub abbreviation {
- my $self = shift;
+ my ($self) = @_;
- return t8('AR Transaction (abbreviation)') if !$self->invoice;
- return t8('Credit note (one letter abbreviation)') if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno;
- return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno;
- return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno;
+ return t8('AR Transaction (abbreviation)') if $self->invoice_type eq 'ar_transaction';
+ return t8('Credit note (one letter abbreviation)') if $self->invoice_type eq 'credit_note';
+ return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'invoice_storno';
+ return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'credit_note_storno';
return t8('Invoice (one letter abbreviation)');
-
}
sub date {
goto &transdate;
}
-sub transactions {
- my ($self) = @_;
-
- return unless $self->id;
+sub reqdate {
+ goto &duedate;
+}
- require SL::DB::AccTransaction;
- SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $self->id ]);
+sub customervendor {
+ goto &customer;
}
1;