From 278e90cf0a7d7f2d7dce5965bc89728cee2489ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Aug 2015 13:06:53 +0200 Subject: [PATCH] Fix same pb than #3297 with vat edit --- htdocs/core/tpl/objectline_edit.tpl.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index ec427addef9..605b03d9c72 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -239,7 +239,15 @@ if (! empty($conf->margin->enabled)) ?> jQuery(document).ready(function() { - /* Add rule to clear margin when we change price_ht or buying_price, so when we change sell or buy price, margin will be recalculated after submitting form */ + /* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */ + jQuery("#tva_tx").click(function() { /* somtimes field is a text, sometimes a combo */ + jQuery("input[name='np_marginRate']:first").val(''); + jQuery("input[name='np_markRate']:first").val(''); + }); + jQuery("#tva_tx").keyup(function() { /* somtimes field is a text, sometimes a combo */ + jQuery("input[name='np_marginRate']:first").val(''); + jQuery("input[name='np_markRate']:first").val(''); + }); jQuery("#price_ht").keyup(function() { jQuery("input[name='np_marginRate']:first").val(''); jQuery("input[name='np_markRate']:first").val('');