[FIX] avoid adding session_id and token fields in form if they are already there...
authorXavier Morel <xmo@openerp.com>
Mon, 20 Feb 2012 11:57:04 +0000 (12:57 +0100)
committerXavier Morel <xmo@openerp.com>
Mon, 20 Feb 2012 11:57:04 +0000 (12:57 +0100)
lp bug: https://launchpad.net/bugs/936704 fixed

bzr revid: xmo@openerp.com-20120220115704-zxo024voy3dxa7qe

addons/web/static/src/js/core.js

index c4e37a8..106d2b8 100644 (file)
@@ -884,9 +884,12 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
         _(_.extend({}, options.data || {},
                    {session_id: this.session_id, token: token}))
             .each(function (value, key) {
-                $('<input type="hidden" name="' + key + '">')
-                    .val(value)
-                    .appendTo($form_data);
+                var $input = $form.find('[name=' + key +']');
+                if (!$input.length) {
+                    $input = $('<input type="hidden" name="' + key + '">')
+                        .appendTo($form_data);
+                }
+                $input.val(value)
             });
 
         $form