diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f009b80301e..f3a6aa1d6bf 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -948,9 +948,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) { var discount = parseFloat($('option:selected', this).attr('data-discount')); if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} + var tva_tx = parseFloat($('option:selected', this).data('tvatx')); + console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); jQuery("#price_ht").val(up); + $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); + if (jQuery("#qty").val() < qty) { jQuery("#qty").val(qty);