Revision 0956f2d4
Von Felix Eichler vor mehr als 4 Jahren hinzugefügt
js/kivi.Order.js | ||
---|---|---|
175 | 175 |
}; |
176 | 176 |
|
177 | 177 |
ns.update_exchangerate = function(event) { |
178 |
var rate_input = $('#order_exchangerate_as_number'); |
|
179 |
rate_input.attr('name', '');
|
|
178 |
var rate_input = $('#order_exchangerate_as_null_number');
|
|
179 |
rate_input.prop('disabled', true);
|
|
180 | 180 |
|
181 | 181 |
var data = $('#order_form').serializeArray(); |
182 | 182 |
data.push({ name: 'action', value: 'Order/update_exchangerate' }); |
... | ... | |
187 | 187 |
method: 'POST', |
188 | 188 |
dataType: 'json', |
189 | 189 |
success: function(data){ |
190 |
if (data.currency_name) {
|
|
190 |
if (!data.is_standard) {
|
|
191 | 191 |
$('#currency_name').text(data.currency_name); |
192 | 192 |
var rate_text = $('#exchangerate_text'); |
193 | 193 |
if (data.exchangerate) { |
... | ... | |
195 | 195 |
rate_input.hide(); |
196 | 196 |
} else { |
197 | 197 |
rate_text.text(''); |
198 |
rate_input.show().attr('name', rate_input.data('name')).val(0); |
|
198 |
rate_input.prop('disabled', false); |
|
199 |
rate_input.show().val(0); |
|
199 | 200 |
} |
200 | 201 |
$('#exchangerate_settings').show(); |
201 | 202 |
} else { |
202 | 203 |
$('#exchangerate_settings').hide(); |
203 | 204 |
} |
204 |
if ($('#order_currency_id').val() != $('#old_currency_id').val() || data.exchangerate != $('#old_exchangerate').val()) { |
|
205 |
console.log(data.is_standard); |
|
206 |
console.log(data.exchangerate); |
|
207 |
console.log($('#old_exchangerate').val()); |
|
208 |
if ($('#order_currency_id').val() != $('#old_currency_id').val() || |
|
209 |
!data.is_standard && data.exchangerate != $('#old_exchangerate').val()) { |
|
205 | 210 |
kivi.display_flash('warning', kivi.t8('You have changed the currency or exchange rate. Please update prices.')); |
206 | 211 |
} |
207 | 212 |
$('#old_currency_id').val($('#order_currency_id').val()); |
... | ... | |
211 | 216 |
}; |
212 | 217 |
|
213 | 218 |
ns.exchangerate_changed = function(event) { |
214 |
if (kivi.parse_amount($('#order_exchangerate_as_number').val()) != kivi.parse_amount($('#old_exchangerate').val())) { |
|
219 |
if (kivi.parse_amount($('#order_exchangerate_as_null_number').val()) != kivi.parse_amount($('#old_exchangerate').val())) {
|
|
215 | 220 |
kivi.display_flash('warning', kivi.t8('You have changed the currency or exchange rate. Please update prices.')); |
216 |
$('#old_exchangerate').val($('#order_exchangerate_as_number').val()); |
|
221 |
$('#old_exchangerate').val($('#order_exchangerate_as_null_number').val());
|
|
217 | 222 |
} |
218 | 223 |
}; |
219 | 224 |
|
... | ... | |
837 | 842 |
|
838 | 843 |
$('#order_currency_id').change(kivi.Order.update_exchangerate); |
839 | 844 |
$('#order_transdate_as_date').change(kivi.Order.update_exchangerate); |
840 |
$('#order_exchangerate_as_number').change(kivi.Order.exchangerate_changed); |
|
845 |
$('#order_exchangerate_as_null_number').change(kivi.Order.exchangerate_changed);
|
|
841 | 846 |
|
842 | 847 |
if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) { |
843 | 848 |
$('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) }); |
Auch abrufbar als: Unified diff
Auftragsschnellerfassung: Korrekturen für Währung/Wechselkurs
- Feld auf disabled setzen wenn nicht gebraucht
- _as_null_number damit undef nicht zu 0 wird
- Übersetzte Fehlermeldungen
ticket #9491
(cherry picked from commit c581e4685a217bdd5b73380b1f808037a473dd9f)
(cherry pick von odyn)