made getVATRates synchronous to avoid concurrency problems
This commit is contained in:
parent
b3ff58e864
commit
22d31817de
@ -242,7 +242,6 @@ $(document).ready(function() {
|
|||||||
$('#service_duration_area').hide();
|
$('#service_duration_area').hide();
|
||||||
|
|
||||||
$('#idprod').change(function() {
|
$('#idprod').change(function() {
|
||||||
|
|
||||||
if ($(this).val() > 0) {
|
if ($(this).val() > 0) {
|
||||||
|
|
||||||
// Update vat rate combobox
|
// Update vat rate combobox
|
||||||
@ -260,11 +259,11 @@ $(document).ready(function() {
|
|||||||
if (typeof data != 'undefined') {
|
if (typeof data != 'undefined') {
|
||||||
$('#product_ref').val(data.ref);
|
$('#product_ref').val(data.ref);
|
||||||
$('#product_label').val(data.label);
|
$('#product_label').val(data.label);
|
||||||
|
$('#origin_tva_tx_cache').val(data.tva_tx);
|
||||||
$('#price_base_type').val(data.pricebasetype).trigger('change');
|
$('#price_base_type').val(data.pricebasetype).trigger('change');
|
||||||
$('#price_ht').val(data.price_ht).trigger('change');
|
$('#price_ht').val(data.price_ht).trigger('change');
|
||||||
$('#origin_price_ht_cache').val(data.price_ht);
|
$('#origin_price_ht_cache').val(data.price_ht);
|
||||||
//$('#origin_price_ttc_cache').val(data.price_ttc);
|
//$('#origin_price_ttc_cache').val(data.price_ttc);
|
||||||
$('#origin_tva_tx_cache').val(data.tva_tx);
|
|
||||||
$('#select_type').val(data.type).attr('disabled','disabled').trigger('change');
|
$('#select_type').val(data.type).attr('disabled','disabled').trigger('change');
|
||||||
//$('#price_base_type_area').show();
|
//$('#price_base_type_area').show();
|
||||||
$('#qty').val(data.qty);
|
$('#qty').val(data.qty);
|
||||||
@ -283,9 +282,6 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('#price_ttc').val('');
|
$('#price_ttc').val('');
|
||||||
|
|
||||||
// Restore vat rate combobox
|
|
||||||
getVATRates('getSellerVATRates', 'tva_tx');
|
|
||||||
|
|
||||||
// For compatibility with combobox
|
// For compatibility with combobox
|
||||||
<?php if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { ?>
|
<?php if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { ?>
|
||||||
$('#select_type').val('').removeAttr('disabled').trigger('change');
|
$('#select_type').val('').removeAttr('disabled').trigger('change');
|
||||||
@ -461,16 +457,23 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
function getVATRates(action, htmlname, idprod) {
|
function getVATRates(action, htmlname, idprod) {
|
||||||
var productid = (idprod?idprod:0);
|
var productid = (idprod?idprod:0);
|
||||||
$.post('<?php echo DOL_URL_ROOT; ?>/core/ajax/vatrates.php', {
|
$.ajax({
|
||||||
'action': action,
|
type: "POST",
|
||||||
'id': <?php echo $buyer->id; ?>,
|
url: '<?php echo DOL_URL_ROOT;?>/core/ajax/vatrates.php',
|
||||||
'productid': productid,
|
data: {
|
||||||
'htmlname': htmlname },
|
'action': action,
|
||||||
function(data) {
|
'id': <?php echo $buyer->id; ?>,
|
||||||
if (typeof data != 'undefined' && data.error == null) {
|
'productid': productid,
|
||||||
$("#" + htmlname).html(data.value).trigger('change');
|
'htmlname': htmlname
|
||||||
}
|
},
|
||||||
}, 'json');
|
success: function(data){
|
||||||
|
if (typeof data != 'undefined' && data.error == null) {
|
||||||
|
$("#" + htmlname).html(data.value).trigger('change');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
async: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if decription is not empty for free line
|
// Check if decription is not empty for free line
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user