From 92f6fae1e8c4861460ae364ac7dc243b429a9cb6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 10 Feb 2021 10:39:27 +0100 Subject: [PATCH] =?utf8?q?Order-Controller:=20Workflow=20Lieferantenauftra?= =?utf8?q?g=20=E2=86=92=20Preisanfrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Order.pm | 18 +++++++++++++----- SL/DB/Order.pm | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index c17180324..a79e3653c 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -600,7 +600,12 @@ sub action_save_and_invoice { # workflow from sales order to sales quotation sub action_sales_quotation { - $_[0]->workflow_sales_quotation(); + $_[0]->workflow_sales_or_request_for_quotation(); +} + +# workflow from sales order to sales quotation +sub action_request_for_quotation { + $_[0]->workflow_sales_or_request_for_quotation(); } # workflow from sales quotation to sales order @@ -1585,7 +1590,7 @@ sub save { return $errors; } -sub workflow_sales_quotation { +sub workflow_sales_or_request_for_quotation { my ($self) = @_; # always save @@ -1596,7 +1601,7 @@ sub workflow_sales_quotation { return $self->js->render(); } - my $destination_type = sales_quotation_type(); + my $destination_type = $::form->{type} eq sales_order_type() ? sales_quotation_type() : request_quotation_type(); $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type)); $self->{converted_from_oe_id} = delete $::form->{id}; @@ -1791,6 +1796,11 @@ sub setup_edit_action_bar { submit => [ '#order_form', { action => "Order/sales_quotation" } ], only_if => (any { $self->type eq $_ } (sales_order_type())), ], + action => [ + t8('Save and RFQ'), + submit => [ '#order_form', { action => "Order/request_for_quotation" } ], + only_if => (any { $self->type eq $_ } (purchase_order_type())), + ], action => [ t8('Save and Sales Order'), submit => [ '#order_form', { action => "Order/sales_order" } ], @@ -2203,8 +2213,6 @@ java script functions =item * credit limit -=item * more workflows (rfq) - =item * price sources: little symbols showing better price / better discount =item * select units in input row? diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index 415896919..dc4bbebd8 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -311,6 +311,7 @@ sub new_from { { from => 'sales_order', to => 'purchase_order', abbr => 'sopo' }, { from => 'purchase_order', to => 'sales_order', abbr => 'poso' }, { from => 'sales_order', to => 'sales_quotation', abbr => 'sosq' }, + { from => 'purchase_order', to => 'request_quotation', abbr => 'porq' }, ); my $from_to = (grep { $_->{from} eq $source->type && $_->{to} eq $destination_type} @from_tos)[0]; croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") if !$from_to; @@ -355,7 +356,7 @@ sub new_from { if ( $is_abbr_any->(qw(soso)) ) { $args{periodic_invoices_config} = $source->periodic_invoices_config->clone_and_reset if $source->periodic_invoices_config; } - if ( $is_abbr_any->(qw(sosq)) ) { + if ( $is_abbr_any->(qw(sosq porq)) ) { $args{ordnumber} = undef; $args{quonumber} = undef; $args{reqdate} = DateTime->today_local->next_workday(); -- 2.20.1