From: Bernd Bleßmann Date: Fri, 5 Jun 2020 15:09:13 +0000 (+0200) Subject: Auftrags-Controller: Währung bei Kunden-/Lieferantenwechsel setzen X-Git-Tag: release-3.5.6.1~99 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f8b23396dfa8e2c064c025f2b2786366ba3908af;p=kivitendo-erp.git Auftrags-Controller: Währung bei Kunden-/Lieferantenwechsel setzen --- 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);