with_objects => [ 'part' ]
}
},
- payment_term => {
- type => 'one to one',
- class => 'SL::DB::PaymentTerm',
- column_map => { payment_id => 'id' },
- },
- contact => {
- type => 'one to one',
- class => 'SL::DB::Contact',
- column_map => { cp_id => 'cp_id' },
- },
- shipto => {
- type => 'one to one',
- class => 'SL::DB::Shipto',
- column_map => { shipto_id => 'shipto_id' },
- },
- department => {
- type => 'one to one',
- class => 'SL::DB::Department',
- column_map => { department_id => 'id' },
- },
- language => {
- type => 'one to one',
- class => 'SL::DB::Language',
- column_map => { language_id => 'id' },
- },
- employee => {
- type => 'one to one',
- class => 'SL::DB::Employee',
- column_map => { employee_id => 'id' },
+ storno_invoices => {
+ type => 'one to many',
+ class => 'SL::DB::Invoice',
+ column_map => { id => 'storno_id' },
},
);
sub items { goto &invoiceitems; }
+sub is_sales {
+ # For compatibility with Order, DeliveryOrder
+ croak 'not an accessor' if @_ > 1;
+ return 1;
+}
+
# it is assumed, that ordnumbers are unique here.
sub first_order_by_ordnumber {
my $self = shift;
croak("Unsupported source object type '" . ref($source) . "'") unless ref($source) =~ m/^ SL::DB:: (?: Order | DeliveryOrder ) $/x;
croak("Cannot create invoices for purchase records") unless $source->customer_id;
- my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_term->terms_netto : 0;
+ my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_terms->terms_netto : 0;
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes curr salesman_id cusordnumber ordnumber quonumber
department_id cp_id language_id payment_id delivery_customer_id delivery_vendor_id taxzone_id shipto_id
sub _post_add_acctrans {
my ($self, $entries) = @_;
+ my $default_tax_id = SL::DB::Manager::Tax->find_by(taxkey => 0)->id;
+ my $chart_link;
+
while (my ($chart_id, $spec) = each %{ $entries }) {
- $spec = { taxkey => 0, amount => $spec } unless ref $spec;
+ $spec = { taxkey => 0, tax_id => $default_tax_id, amount => $spec } unless ref $spec;
+ $chart_link = SL::DB::Manager::Chart->find_by(id => $chart_id)->{'link'};
+ $chart_link ||= '';
+
SL::DB::AccTransaction->new(trans_id => $self->id,
chart_id => $chart_id,
amount => $spec->{amount},
+ tax_id => $spec->{tax_id},
taxkey => $spec->{taxkey},
project_id => $self->globalproject_id,
- transdate => $self->transdate)->save;
+ transdate => $self->transdate,
+ chart_link => $chart_link)->save;
}
}
=item 6. Items in C<invoice> are updated according to their allocation
status (regarding for costs of goold sold). Will only be done if
-Lx-Office is not configured to use Einnahmenüberschussrechnungen
-(see config/lx_office.conf, section "system", variable "eur").
+kivitendo is not configured to use Einnahmenüberschussrechnungen.
=item 7. The invoice and its items are saved.