Revision e73be2a8
Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
851 | 851 |
|
852 | 852 |
my $destination_type = $::form->{to_type} ? $::form->{to_type} : ''; |
853 | 853 |
|
854 |
my $from_side = $self->order->is_sales ? 'sales' : 'purchase'; |
|
855 |
my $to_side = (any { $destination_type eq $_ } (sales_order_type(), sales_quotation_type())) ? 'sales' : 'purchase'; |
|
856 |
|
|
854 | 857 |
# check for direct delivery |
855 | 858 |
# copy shipto in custom shipto (custom shipto will be copied by new_from() in case) |
856 | 859 |
my $custom_shipto; |
... | ... | |
861 | 864 |
|
862 | 865 |
$self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type)); |
863 | 866 |
|
864 |
# no linked records from order to quotations |
|
865 |
if (any { $destination_type eq $_ } (sales_quotation_type(), request_quotation_type())) { |
|
867 |
# no linked records to quotations from the same side (sales -> sales or purchase -> purchase) |
|
868 |
if ( (any { $destination_type eq $_ } (sales_quotation_type(), request_quotation_type())) |
|
869 |
&& $from_side eq $to_side) { |
|
866 | 870 |
delete $::form->{id}; |
867 | 871 |
delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids); |
868 | 872 |
} else { |
... | ... | |
2285 | 2289 |
t8('Save and Quotation'), |
2286 | 2290 |
call => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_quotation_type()), '#order_form' ], |
2287 | 2291 |
checks => [ @req_trans_cost_art, @req_cusordnumber ], |
2288 |
only_if => (any { $self->type eq $_ } (sales_order_type())), |
|
2292 |
only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())),
|
|
2289 | 2293 |
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef, |
2290 | 2294 |
], |
2291 | 2295 |
action => [ |
SL/DB/Order.pm | ||
---|---|---|
343 | 343 |
{ from => 'purchase_order', to => 'sales_order', abbr => 'poso' }, |
344 | 344 |
{ from => 'sales_order', to => 'sales_quotation', abbr => 'sosq' }, |
345 | 345 |
{ from => 'purchase_order', to => 'request_quotation', abbr => 'porq' }, |
346 |
{ from => 'request_quotation', to => 'sales_quotation', abbr => 'rqsq' }, |
|
346 | 347 |
); |
347 | 348 |
my $from_to = (grep { $_->{from} eq $source->type && $_->{to} eq $destination_type} @from_tos)[0]; |
348 | 349 |
croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") if !$from_to; |
... | ... | |
381 | 382 |
$args{payment_id} = undef; |
382 | 383 |
$args{delivery_term_id} = undef; |
383 | 384 |
} |
384 |
if ( $is_abbr_any->(qw(poso)) ) { |
|
385 |
if ( $is_abbr_any->(qw(poso rqsq)) ) {
|
|
385 | 386 |
$args{vendor_id} = undef; |
386 | 387 |
} |
387 | 388 |
if ( $is_abbr_any->(qw(soso)) ) { |
388 | 389 |
$args{periodic_invoices_config} = $source->periodic_invoices_config->clone_and_reset if $source->periodic_invoices_config; |
389 | 390 |
} |
390 |
if ( $is_abbr_any->(qw(sosq porq)) ) { |
|
391 |
if ( $is_abbr_any->(qw(sosq porq rqsq)) ) {
|
|
391 | 392 |
$args{ordnumber} = undef; |
392 | 393 |
$args{quonumber} = undef; |
393 | 394 |
$args{reqdate} = DateTime->today_local->next_workday(); |
... | ... | |
432 | 433 |
$current_oe_item->sellprice($source_item->lastcost); |
433 | 434 |
$current_oe_item->discount(0); |
434 | 435 |
} |
435 |
if ( $is_abbr_any->(qw(poso)) ) { |
|
436 |
if ( $is_abbr_any->(qw(poso rqsq)) ) {
|
|
436 | 437 |
$current_oe_item->lastcost($source_item->sellprice); |
437 | 438 |
} |
438 | 439 |
$current_oe_item->{"converted_from_orderitems_id"} = $_->{id} if ref($item_parent) eq 'SL::DB::Order'; |
Auch abrufbar als: Unified diff
Auftrags-Controller: WF Preisanfrage -> Kunden-Angebot