From 47016a1df354fe4620a5f7e7bd8a3fc38d2e40df Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 12 Mar 2019 08:54:46 +0000 Subject: [PATCH] [FIX] portal: sent form without signing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the portal, when the client signature is asked (for a SO for example). Before this commit, the client could send the form without really signing the document. Now, a warning is shown if the form is not signed. opw-1943702 closes odoo/odoo#31768 Signed-off-by: Sébastien Theys Co-authored-by: Sébastien Theys --- addons/portal/static/src/js/portal_signature.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/portal/static/src/js/portal_signature.js b/addons/portal/static/src/js/portal_signature.js index 3c19b3b8f91..35c06d0c531 100644 --- a/addons/portal/static/src/js/portal_signature.js +++ b/addons/portal/static/src/js/portal_signature.js @@ -116,14 +116,21 @@ odoo.define('portal.signature_form', function (require){ base.ready().then(function () { $('.o_portal_signature_form').each(function () { + var hasBeenReset = false; var $elem = $(this); var form = new SignatureForm(null, $elem.data()); form.appendTo($elem); - }); - // Make the signature responsive when it is displayed in bootstrap modal. - // More precisely it is too small if this code is not here. - $('.o_portal_signature_form').parents('.modal').on('shown.bs.modal', function (ev) { - $('.o_portal_signature_form').trigger('resize'); + // Make the signature responsive when it is displayed in bootstrap modal. + // More precisely it is too small if this code is not here. + $elem.parents('.modal').on('shown.bs.modal', function (ev) { + $elem.trigger('resize'); + if (!hasBeenReset) { + // Reset it only the first time it is open to get correct + // size. After we want to keep its content on reopen. + hasBeenReset = true; + form.initSign(); + } + }); }); });