From 6e9c1764ad386f88ce4d57ac9935106a3fcedde7 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:08:26 +0200 Subject: [PATCH 1/3] propage tva rate on tva field --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++++ 1 file changed, 4 insertions(+) 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); From a3fc71981f92ff55c234652fd35333a84297576d Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:09:46 +0200 Subject: [PATCH 2/3] send tva rate --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc404f98cbc..2df4f491105 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3508,7 +3508,7 @@ class Form $opt .= ' disabled'; } if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { - $opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"'; + $opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"'; } $opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; $opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"'; From 18890e2cbb059913c1cfd4b978d1319b8d88e3ed Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 20 May 2022 17:11:36 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f3a6aa1d6bf..48abc6316f4 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -953,7 +953,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { 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); + $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); if (jQuery("#qty").val() < qty) {