From 803162537bbed732fc833d555a873dee2ac2eedb Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Fri, 16 Mar 2018 16:23:21 -0700 Subject: [PATCH] [FIX] portal: show signing error messages returned by the server The funny self.$('#o_portal_sign_accept') line was some leftover debugging code. It doesn't actually match anything, because that element is not in self.$el. Before this change nothing happened when you clicked the button and an error occured. Now the `data.error` message (e.g. 'Invalid Order') is shown near the bottom of the dialog. --- addons/portal/static/src/js/portal_signature.js | 3 ++- addons/portal/static/src/scss/portal.scss | 4 ++++ addons/portal/static/src/xml/portal_signature.xml | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/portal/static/src/js/portal_signature.js b/addons/portal/static/src/js/portal_signature.js index b0c4690a76b..96e729f5869 100644 --- a/addons/portal/static/src/js/portal_signature.js +++ b/addons/portal/static/src/js/portal_signature.js @@ -80,8 +80,9 @@ odoo.define('portal.signature_form', function (require){ }, }).then(function (data) { self.$('.fa-spinner').remove(); - self.$('#o_portal_sign_accept').prepend('
PROUT' + data + '
'); if (data.error) { + self.$('.o_portal_sign_error_msg').remove(); + $confirm_btn.before(qweb.render('portal.portal_signature_error', {message: data.error})); $confirm_btn.attr('disabled', false); } else if (data.success) { diff --git a/addons/portal/static/src/scss/portal.scss b/addons/portal/static/src/scss/portal.scss index 9a53d163936..a8ea6995d14 100644 --- a/addons/portal/static/src/scss/portal.scss +++ b/addons/portal/static/src/scss/portal.scss @@ -394,6 +394,10 @@ img.o_we_custom_image { } } +.o_portal_signature_form .o_portal_sign_error_msg { + color: $brand-danger; +} + .label-optional { font-weight: normal; } diff --git a/addons/portal/static/src/xml/portal_signature.xml b/addons/portal/static/src/xml/portal_signature.xml index 50a83494912..801b88cb06a 100644 --- a/addons/portal/static/src/xml/portal_signature.xml +++ b/addons/portal/static/src/xml/portal_signature.xml @@ -27,4 +27,9 @@ Click here to see your document. + +
+ +
+