Revision 0eb90109
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/DB/Invoice.pm | ||
---|---|---|
164 | 164 |
my $terms = $source->can('payment_id') ? $source->payment_terms : undef; |
165 | 165 |
|
166 | 166 |
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber department_id |
167 |
cp_id language_id taxzone_id shipto_id globalproject_id transaction_description currency_id delivery_term_id payment_id), @columns),
|
|
167 |
cp_id language_id taxzone_id globalproject_id transaction_description currency_id delivery_term_id payment_id), @columns), |
|
168 | 168 |
transdate => DateTime->today_local, |
169 | 169 |
gldate => DateTime->today_local, |
170 | 170 |
duedate => $terms ? $terms->calc_date(reference_date => DateTime->today_local) : DateTime->today_local, |
... | ... | |
182 | 182 |
$args{quodate} = $source->transdate; |
183 | 183 |
} |
184 | 184 |
|
185 |
# Custom shipto addresses (the ones specific to the sales/purchase |
|
186 |
# record and not to the customer/vendor) are only linked from shipto |
|
187 |
# → ar. Meaning ar.shipto_id will not be filled in that |
|
188 |
# case. |
|
189 |
if (!$source->shipto_id && $source->id) { |
|
190 |
$args{custom_shipto} = $source->custom_shipto->clone($class) if $source->can('custom_shipto') && $source->custom_shipto; |
|
191 |
|
|
192 |
} else { |
|
193 |
$args{shipto_id} = $source->shipto_id; |
|
194 |
} |
|
195 |
|
|
185 | 196 |
my $invoice = $class->new(%args); |
186 | 197 |
$invoice->assign_attributes(%{ $params{attributes} }) if $params{attributes}; |
187 | 198 |
my $items = delete($params{items}) || $source->items_sorted; |
Auch abrufbar als: Unified diff
SL::DB::Invoice->new_from: individuelle Lieferadressen richtig behandeln
Individuelle Lieferadressen werden nur von shipto.trans_id zu ar.id
verlinkt, nicht aber in ar.shipto_id. Die Implementation ist analog zu
SL::DB::DeliveryOrder->new_from.