From 72589ebeb899e839f353eac75d3788be4b32ff39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 8 Nov 2021 04:24:04 +0100 Subject: [PATCH] Order: Workflow Beistelllieferschein erstellen --- SL/Controller/DeliveryOrder.pm | 10 ++++++++++ SL/Controller/Order.pm | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index 653342549..3878e5a64 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -78,6 +78,16 @@ sub action_add { ); } +sub action_add_from_order { + my ($self) = @_; + # this interfers with init_order + $self->{converted_from_oe_id} = delete $::form->{id}; + + # TODO copy data and remember to link them on save + + $self->action_add; +} + # edit an existing order sub action_edit { my ($self) = @_; diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index b4328a1e2..524d9045b 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -677,6 +677,16 @@ sub action_save_and_delivery_order { ); } +sub action_save_and_supplier_delivery_order { + my ($self) = @_; + + $self->save_and_redirect_to( + controller => 'controller.pl', + action => 'DeliveryOrder/add_from_order', + type => 'supplier_delivery_order', + ); +} + # save the order and redirect to the frontend subroutine for a new # invoice sub action_save_and_invoice { @@ -2065,6 +2075,16 @@ sub setup_edit_action_bar { ], only_if => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type())) ], + action => [ + t8('Save and Supplier Delivery Order'), + call => [ 'kivi.Order.save', 'save_and_supplier_delivery_order', $::instance_conf->get_order_warn_duplicate_parts, + $::instance_conf->get_order_warn_no_deliverydate, + ], + checks => [ 'kivi.Order.check_save_active_periodic_invoices', + @req_trans_cost_art, @req_cusordnumber, + ], + only_if => (any { $self->type eq $_ } (sales_order_type())) + ], action => [ t8('Save and Invoice'), call => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ], -- 2.20.1