Revision 4b1666b7
Von Felix Eichler vor mehr als 4 Jahren hinzugefügt
js/kivi.Order.js | ||
---|---|---|
174 | 174 |
$(event.target).val(kivi.format_amount(kivi.parse_amount($(event.target).val()), -2)); |
175 | 175 |
}; |
176 | 176 |
|
177 |
ns.update_exchangerate = function(event) { |
|
178 |
var rate_input = $('#order_exchangerate_as_number'); |
|
179 |
rate_input.attr('name', ''); |
|
180 |
|
|
181 |
var data = $('#order_form').serializeArray(); |
|
182 |
data.push({ name: 'action', value: 'Order/update_exchangerate' }); |
|
183 |
|
|
184 |
$.ajax({ |
|
185 |
url: 'controller.pl', |
|
186 |
data: data, |
|
187 |
method: 'POST', |
|
188 |
dataType: 'json', |
|
189 |
success: function(data){ |
|
190 |
if (data.currency_name) { |
|
191 |
$('#currency_name').text(data.currency_name); |
|
192 |
var rate_text = $('#exchangerate_text'); |
|
193 |
if (data.exchangerate) { |
|
194 |
rate_text.text(data.exchangerate); |
|
195 |
rate_input.hide(); |
|
196 |
} else { |
|
197 |
rate_text.text(''); |
|
198 |
rate_input.show().attr('name', rate_input.data('name')).val(0); |
|
199 |
} |
|
200 |
$('#exchangerate_settings').show(); |
|
201 |
} else { |
|
202 |
$('#exchangerate_settings').hide(); |
|
203 |
} |
|
204 |
if ($('#order_currency_id').val() != $('#old_currency_id').val() || data.exchangerate != $('#old_exchangerate').val()) { |
|
205 |
kivi.display_flash('warning', kivi.t8('You have changed the currency. Please update prices.')); |
|
206 |
} |
|
207 |
$('#old_currency_id').val($('#order_currency_id').val()); |
|
208 |
$('#old_exchangerate').val(data.exchangerate); |
|
209 |
} |
|
210 |
}); |
|
211 |
}; |
|
212 |
|
|
177 | 213 |
ns.recalc_amounts_and_taxes = function() { |
178 | 214 |
var data = $('#order_form').serializeArray(); |
179 | 215 |
data.push({ name: 'action', value: 'Order/recalc_amounts_and_taxes' }); |
... | ... | |
792 | 828 |
$('#order_vendor_id').change(kivi.Order.reload_cv_dependent_selections); |
793 | 829 |
} |
794 | 830 |
|
831 |
$('#order_currency_id').change(kivi.Order.update_exchangerate); |
|
832 |
$('#order_transdate').change(kivi.Order.update_exchangerate); |
|
833 |
|
|
795 | 834 |
if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) { |
796 | 835 |
$('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) }); |
797 | 836 |
} else { |
Auch abrufbar als: Unified diff
Auftragsschnellerfassung: Währung und Wechselkurs definierbar
impl. #9491
(cherry picked from commit 6cdc5a4a33df4530ce4e141151e83138320e27a2)
(cherry pick von odyn)