From f8b23396dfa8e2c064c025f2b2786366ba3908af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 5 Jun 2020 17:09:13 +0200 Subject: [PATCH] =?utf8?q?Auftrags-Controller:=20W=C3=A4hrung=20bei=20Kund?= =?utf8?q?en-/Lieferantenwechsel=20setzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Order.pm | 6 ++++-- js/kivi.Order.js | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 17b88fde6..f06f06e03 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -689,11 +689,13 @@ sub action_customer_vendor_changed { ->replaceWith('#business_info_row', $self->build_business_info_row) ->val( '#order_taxzone_id', $self->order->taxzone_id) ->val( '#order_taxincluded', $self->order->taxincluded) + ->val( '#order_currency_id', $self->order->currency_id) ->val( '#order_payment_id', $self->order->payment_id) ->val( '#order_delivery_term_id', $self->order->delivery_term_id) ->val( '#order_intnotes', $self->order->intnotes) ->val( '#language_id', $self->order->$cv_method->language_id) - ->focus( '#order_' . $self->cv . '_id'); + ->focus( '#order_' . $self->cv . '_id') + ->run('kivi.Order.update_exchangerate'); $self->js_redisplay_amounts_and_taxes; $self->js_redisplay_cvpartnumbers; @@ -1507,7 +1509,7 @@ sub new_item { sub setup_order_from_cv { my ($order) = @_; - $order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id)); + $order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id currency_id)); $order->intnotes($order->customervendor->notes); diff --git a/js/kivi.Order.js b/js/kivi.Order.js index 4d7971d18..74bd343e4 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -175,6 +175,11 @@ namespace('kivi.Order', function(ns) { }; ns.update_exchangerate = function(event) { + if (!ns.check_cv()) { + $('#order_currency_id').val($('#old_currency_id').val()); + return; + } + var rate_input = $('#order_exchangerate_as_null_number'); rate_input.prop('disabled', true); -- 2.20.1