[FIX] mail: handle server error in the front-end part

Issue

    - Install Time Off
    - Marc Demo > Create leave request
    - Admin > Validate the leave request
    - Marc Demo > Add an attachment

    Nothing happens

Cause

    There is a access right issue that is not handled in the
    JS.

Solution

    Handle it by doing a do_warn.

OPW-2171791

closes odoo/odoo#43484

X-original-commit: 6a98c75ebfca694e1e68fa09eca95e47472bed92
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
This commit is contained in:
Jason Van Malder
2020-01-17 12:37:47 +00:00
parent 69f0f765bd
commit 071e03f178
2 changed files with 13 additions and 2 deletions
+7
View File
@@ -6113,6 +6113,13 @@ msgstr ""
msgid "You are in channel <b>#%s</b>."
msgstr ""
#. module: mail
#. openerp-web
#: code:addons/mail/static/src/js/attachment_box.js:0
#, python-format
msgid "You are not allowed to upload an attachment here."
msgstr ""
#. module: mail
#. openerp-web
#: code:addons/mail/static/src/js/discuss.js:0
+6 -2
View File
@@ -127,8 +127,12 @@ var AttachmentBox = Widget.extend({
/**
* @private
*/
_onUploaded: function() {
this.trigger_up('reload_attachment_box');
_onUploaded: function(ev, response) {
if (response.error) {
this.do_warn(_t("Error"), _t("You are not allowed to upload an attachment here."));
} else {
this.trigger_up('reload_attachment_box');
}
},
});