+sub invoice_type {
+ my ($self) = @_;
+
+ return 'ar_transaction' if !$self->invoice;
+ return 'credit_note' if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno;
+ return 'invoice_storno' if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno;
+ return 'credit_note_storno' if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno;
+ return 'invoice';
+}
+
+sub displayable_state {
+ my $self = shift;
+
+ return $self->closed ? $::locale->text('closed') : $::locale->text('open');
+}
+
+sub displayable_type {
+ my ($self) = @_;
+
+ return t8('AR Transaction') if $self->invoice_type eq 'ar_transaction';
+ return t8('Credit Note') if $self->invoice_type eq 'credit_note';
+ return t8('Invoice') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'invoice_storno';
+ return t8('Credit Note') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'credit_note_storno';
+ return t8('Invoice');
+}
+
+sub abbreviation {
+ my ($self) = @_;
+
+ 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;
+
+ require SL::DB::AccTransaction;
+ SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $self->id ]);
+}
+