[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.
This commit is contained in:
Joren Van Onder
2018-06-28 18:47:35 +02:00
committed by Romain Derie
parent 11e966da6a
commit 803162537b
3 changed files with 11 additions and 1 deletions
@@ -80,8 +80,9 @@ odoo.define('portal.signature_form', function (require){
},
}).then(function (data) {
self.$('.fa-spinner').remove();
self.$('#o_portal_sign_accept').prepend('<div>PROUT' + data + '</div>');
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) {
@@ -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;
}
@@ -27,4 +27,9 @@
<a t-att-href="widget.redirect_url">Click here to see your document.</a>
</div>
</t>
<t t-name="portal.portal_signature_error">
<div class="o_portal_sign_error_msg">
<t t-esc="message"/>
</div>
</t>
</templates>