- $entry->{object}->income_accno_id( $bg->income_accno_id_0 );
- $entry->{object}->expense_accno_id( $bg->expense_accno_id_0 );
+ $entry->{object}->assembly($type eq 'assembly');
+
+ # when saving income_accno_id or expense_accno_id use ids from the selected
+ # $bg according to the default tax_zone (the one with the highest sort
+ # order). Alternatively one could use the ids from defaults, but they might
+ # not all be set.
+
+ $entry->{object}->income_accno_id( $bg->income_accno_id( SL::DB::Manager::TaxZone->get_default->id ) );
+
+ if ($type eq 'part' || $type eq 'service') {
+ $entry->{object}->expense_accno_id( $bg->expense_accno_id( SL::DB::Manager::TaxZone->get_default->id ) );
+ }