From c4786fccfd23360a02e442c48ae2fb9f1e70aa4c Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Fri, 12 Jun 2020 09:01:44 +0000 Subject: [PATCH] [IMP] *: update notifications to optional title closes odoo/odoo#52826 Related: odoo/enterprise#11084 Signed-off-by: Aaron Bohy (aab) --- addons/barcodes/static/src/js/barcode_form_view.js | 10 ++++------ addons/base_import/static/src/js/import_action.js | 5 ++++- .../static/src/js/res_config_invite_users.js | 10 ++++++++-- addons/hr/static/src/js/many2one_avatar_employee.js | 3 +-- .../hr/static/tests/many2one_avatar_employee_tests.js | 8 ++++---- addons/hr_expense/static/src/js/upload_mixin.js | 2 +- addons/im_livechat/static/src/js/im_livechat.js | 6 ++---- addons/mail/static/src/js/attachment_box.js | 2 +- addons/mail/static/src/js/composers/basic_composer.js | 2 +- addons/mail/static/src/js/discuss.js | 4 ++-- addons/mail/static/src/js/many2one_avatar_user.js | 3 +-- .../src/js/services/mail_notification_manager.js | 4 ++-- addons/mail/static/src/js/thread_field.js | 2 +- addons/mail/static/tests/many2one_avatar_user_tests.js | 4 ++-- addons/odoo_referral/static/src/js/systray.js | 2 +- addons/portal/static/src/js/portal_composer.js | 2 +- .../product/static/src/js/product_pricelist_report.js | 9 ++++++--- .../static/tests/product_pricelist_report_test.js | 6 +++--- addons/sale/static/src/js/sale.js | 2 +- .../src/js/inventory_validate_button_controller.js | 2 +- addons/web/static/src/js/chrome/action_manager.js | 2 +- .../src/js/control_panel/custom_favorite_item.js | 2 -- addons/web/static/src/js/fields/basic_fields.js | 8 ++++---- addons/web/static/src/js/fields/relational_fields.js | 2 +- addons/web/static/src/js/fields/signature.js | 2 +- .../web/static/src/js/views/basic/basic_controller.js | 2 +- .../src/js/views/calendar/calendar_quick_create.js | 2 +- .../static/src/js/views/file_upload_progress_bar.js | 2 +- addons/web/static/src/js/views/kanban/kanban_record.js | 2 +- addons/web/static/src/js/views/list/list_controller.js | 6 +++--- addons/web/static/src/js/views/list/list_renderer.js | 2 +- addons/web/static/src/js/widgets/attach_document.js | 4 ++-- addons/web/static/src/js/widgets/domain_selector.js | 7 ++----- .../web/static/src/js/widgets/model_field_selector.js | 9 ++++++--- .../static/tests/control_panel/favorite_menu_tests.js | 3 +-- addons/web/static/tests/fields/basic_fields_tests.js | 5 ++++- addons/web/static/tests/views/form_tests.js | 2 +- .../web_editor/static/src/js/editor/snippets.editor.js | 3 +-- addons/web_editor/static/tests/field_html_tests.js | 2 +- addons/website/static/src/js/content/website_root.js | 1 - .../website/static/src/js/editor/snippets.options.js | 3 +-- .../website_slides/static/src/js/slides_course_quiz.js | 1 - .../static/src/js/slides_course_quiz_question_form.js | 1 - 43 files changed, 81 insertions(+), 80 deletions(-) diff --git a/addons/barcodes/static/src/js/barcode_form_view.js b/addons/barcodes/static/src/js/barcode_form_view.js index 5e24923f20c..b42c3334f40 100644 --- a/addons/barcodes/static/src/js/barcode_form_view.js +++ b/addons/barcodes/static/src/js/barcode_form_view.js @@ -60,8 +60,7 @@ FormController.include({ */ _barcodeAddX2MQuantity: function (barcode, activeBarcode) { if (this.mode === 'readonly') { - this.do_warn(_t('Error: Document not editable'), - _t('To modify this document, please enable edit mode.')); + this.do_warn(false, _t('Enable edit mode to modify this document')); return Promise.reject(); } @@ -134,7 +133,7 @@ FormController.include({ const state = this.model.get(this.handle, { raw: true }); const pagingInfo = this._getPagingInfo(state); if (!pagingInfo) { - return this.do_warn(_t('Error: Pager not available')); + return this.do_warn(false, _t('Pager unavailable')); } const currentMinimum = updater(pagingInfo.currentMinimum, state); const limit = pagingInfo.limit; @@ -331,7 +330,7 @@ FormController.include({ } } if (prefixed && !hasCommand) { - self.do_warn(_t('Error: Barcode command is undefined'), barcode); + self.do_warn(_t('Undefined barcode command'), barcode); } return self.alive(Promise.all(defs)).then(function () { if (!prefixed) { @@ -367,8 +366,7 @@ FormController.include({ } if (!_.compact(_.pluck(barcodeInfos, 'candidate')).length) { - return this.do_warn(_t('Error: No last scanned barcode'), - _t('To set the quantity please scan a barcode first.')); + return this.do_warn(false, _t('Scan a barcode to set the quantity')); } for (var k in this.activeBarcode) { diff --git a/addons/base_import/static/src/js/import_action.js b/addons/base_import/static/src/js/import_action.js index 9893aee821b..85f37b46f65 100644 --- a/addons/base_import/static/src/js/import_action.js +++ b/addons/base_import/static/src/js/import_action.js @@ -738,7 +738,10 @@ var DataImport = AbstractAction.extend({ return prom; }, onimported: function (event, from, to, results) { - this.do_notify(_t("Import completed"), _.str.sprintf(_t("%d records were successfully imported"), results.ids.length)); + this.do_notify(false, _.str.sprintf( + _t("%d records successfully imported"), + results.ids.length + )); this.exit(); }, exit: function () { diff --git a/addons/base_setup/static/src/js/res_config_invite_users.js b/addons/base_setup/static/src/js/res_config_invite_users.js index 9315e732e50..9da1350d4f4 100644 --- a/addons/base_setup/static/src/js/res_config_invite_users.js +++ b/addons/base_setup/static/src/js/res_config_invite_users.js @@ -79,7 +79,10 @@ odoo.define('base_setup.ResConfigInviteUsers', function (require) { // filter out invalid email addresses var invalidEmails = _.reject(emails, this._validateEmail); if (invalidEmails.length) { - this.do_warn(_.str.sprintf(_t('The following email addresses are invalid: %s.'), invalidEmails.join(', '))); + this.do_warn(false, _.str.sprintf( + _t('Invalid email addresses: %s.'), + invalidEmails.join(', ') + )); } emails = _.difference(emails, invalidEmails); @@ -90,7 +93,10 @@ odoo.define('base_setup.ResConfigInviteUsers', function (require) { }); var existingEmails = _.intersection(emails, this.emails.concat(pendingEmails)); if (existingEmails.length) { - this.do_warn(_.str.sprintf(_t('The following email addresses already exist: %s.'), existingEmails.join(', '))); + this.do_warn(false, _.str.sprintf( + _t('Email addresses already existing: %s.'), + existingEmails.join(', ') + )); } emails = _.difference(emails, existingEmails); } diff --git a/addons/hr/static/src/js/many2one_avatar_employee.js b/addons/hr/static/src/js/many2one_avatar_employee.js index f8a05028eb3..5be29801ea9 100644 --- a/addons/hr/static/src/js/many2one_avatar_employee.js +++ b/addons/hr/static/src/js/many2one_avatar_employee.js @@ -43,8 +43,7 @@ odoo.define('hr.Many2OneAvatarEmployee', function (require) { // this is not ourself, so if we get here it means that the // employee is not associated with any user this.displayNotification({ - title: _t('No user to chat with'), - message: _t('You can only chat with employees that have a dedicated user.'), + message: _t('You can only chat with employees that have a dedicated user'), type: 'info', }); } else { diff --git a/addons/hr/static/tests/many2one_avatar_employee_tests.js b/addons/hr/static/tests/many2one_avatar_employee_tests.js index de3580eaedb..3130611d1dc 100644 --- a/addons/hr/static/tests/many2one_avatar_employee_tests.js +++ b/addons/hr/static/tests/many2one_avatar_employee_tests.js @@ -156,7 +156,7 @@ QUnit.module('hr', {}, function () { throw new Error('should not call mail_service'); } if (ev.data.service === 'notification') { - assert.step(`display notification "${ev.data.args[0].title}"`); + assert.step(`display notification "${ev.data.args[0].message}"`); } }, true); @@ -167,7 +167,7 @@ QUnit.module('hr', {}, function () { assert.verifySteps([ 'read foo 1', 'read hr.employee 11', - 'display notification "No user to chat with"', + 'display notification "You can only chat with employees that have a dedicated user"', ]); form.destroy(); @@ -198,7 +198,7 @@ QUnit.module('hr', {}, function () { throw new Error('should not call mail_service'); } if (ev.data.service === 'notification') { - assert.step(`display notification "${ev.data.args[0].title}"`); + assert.step(`display notification "${ev.data.args[0].message}"`); } }, true); @@ -209,7 +209,7 @@ QUnit.module('hr', {}, function () { assert.verifySteps([ 'read foo 1', 'read hr.employee 11', - 'display notification "Cannot chat with yourself"', + 'display notification "You cannot chat with yourself"', ]); form.destroy(); diff --git a/addons/hr_expense/static/src/js/upload_mixin.js b/addons/hr_expense/static/src/js/upload_mixin.js index 4f6660c8039..f5fbd74c13b 100644 --- a/addons/hr_expense/static/src/js/upload_mixin.js +++ b/addons/hr_expense/static/src/js/upload_mixin.js @@ -42,7 +42,7 @@ var DocumentUploadMixin = { return filtered; }, []); if (!attachent_ids.length) { - return self.do_notify(_t("Error"), _t("An error occurred during the upload")); + return self.do_notify(false, _t("An error occurred during the upload")); } var myContext = this.initialState.context myContext['isMobile'] = config.device.isMobile diff --git a/addons/im_livechat/static/src/js/im_livechat.js b/addons/im_livechat/static/src/js/im_livechat.js index 134679e933d..0296417bb10 100644 --- a/addons/im_livechat/static/src/js/im_livechat.js +++ b/addons/im_livechat/static/src/js/im_livechat.js @@ -240,8 +240,7 @@ var LivechatButton = Widget.extend({ def.then(function (livechatData) { if (!livechatData || !livechatData.operator_pid) { self.displayNotification({ - title: _t("Collaborators offline"), - message: _t("None of our collaborators seem to be available, please try again later."), + message: _t("No available collaborator, please try again later."), sticky: true }); } else { @@ -335,8 +334,7 @@ var LivechatButton = Widget.extend({ .then(function (messageId) { if (!messageId) { self.displayNotification({ - title: _t("Session Expired"), - message: _t("You took to long to send a message. Please refresh the page and try again."), + message: _t("Session expired... Please refresh and try again."), sticky: true }); self._closeChat(); diff --git a/addons/mail/static/src/js/attachment_box.js b/addons/mail/static/src/js/attachment_box.js index f0bf5801108..507bb38ce49 100644 --- a/addons/mail/static/src/js/attachment_box.js +++ b/addons/mail/static/src/js/attachment_box.js @@ -129,7 +129,7 @@ var AttachmentBox = Widget.extend({ */ _onUploaded: function(ev, response) { if (response.error) { - this.do_warn(_t("Error"), _t("You are not allowed to upload an attachment here.")); + this.do_warn(false, _t("Attachment upload not authorized here")); } else { this.trigger_up('reload_attachment_box'); } diff --git a/addons/mail/static/src/js/composers/basic_composer.js b/addons/mail/static/src/js/composers/basic_composer.js index a38586f0da7..ffde77eac9a 100644 --- a/addons/mail/static/src/js/composers/basic_composer.js +++ b/addons/mail/static/src/js/composers/basic_composer.js @@ -265,7 +265,7 @@ var BasicComposer = Widget.extend({ */ _doCheckAttachmentUpload: function () { if (_.find(this.get('attachment_ids'), function (file) { return file.upload; })) { - this.do_warn(_t("Uploading error"), _t("Please, wait while the file is uploading.")); + this.do_warn(false, _t("Please wait while the file is uploading...")); return false; } return true; diff --git a/addons/mail/static/src/js/discuss.js b/addons/mail/static/src/js/discuss.js index 29a02738f66..5e17ce86d67 100644 --- a/addons/mail/static/src/js/discuss.js +++ b/addons/mail/static/src/js/discuss.js @@ -96,10 +96,10 @@ var PartnerInviteDialog = Dialog.extend({ var names = _.escape(_.pluck(data, 'text').join(', ')); var notification = _.str.sprintf( - _t("You added %s to the conversation."), + _t("You added %s to the conversation"), names ); - self.do_notify(_t("New people"), notification); + self.do_notify(false, notification); // Update list of members with the invited user, so that // we can mention this user in this channel right away. var channel = self.call('mail_service', 'getChannel', self._channelID); diff --git a/addons/mail/static/src/js/many2one_avatar_user.js b/addons/mail/static/src/js/many2one_avatar_user.js index fe768b089c1..ba92fdc3d5c 100644 --- a/addons/mail/static/src/js/many2one_avatar_user.js +++ b/addons/mail/static/src/js/many2one_avatar_user.js @@ -63,8 +63,7 @@ odoo.define('mail.Many2OneAvatarUser', function (require) { */ _displayWarning() { this.displayNotification({ - title: _t('Cannot chat with yourself'), - message: _t('Click on the avatar of other users to chat with them.'), + message: _t('You cannot chat with yourself'), type: 'info', }); }, diff --git a/addons/mail/static/src/js/services/mail_notification_manager.js b/addons/mail/static/src/js/services/mail_notification_manager.js index ef91155c9db..c7c5a03e6bf 100644 --- a/addons/mail/static/src/js/services/mail_notification_manager.js +++ b/addons/mail/static/src/js/services/mail_notification_manager.js @@ -250,7 +250,7 @@ MailManager.include({ channelData.info !== 'creation' ) { this.do_notify( - _t("Invitation"), + false, _t("You have been invited to: ") + channelData.name); } } @@ -530,7 +530,7 @@ MailManager.include({ } this._removeChannel(channel); this._mailBus.trigger('unsubscribe_from_channel', data.id); - this.do_notify(_t("Unsubscribed"), message); + this.do_notify(false, message); } }, /** diff --git a/addons/mail/static/src/js/thread_field.js b/addons/mail/static/src/js/thread_field.js index 2d809def129..a34582c1dde 100644 --- a/addons/mail/static/src/js/thread_field.js +++ b/addons/mail/static/src/js/thread_field.js @@ -95,7 +95,7 @@ var ThreadField = AbstractField.extend({ self.trigger_up('reload_mail_fields', { followers: true }); } }).guardedCatch(function () { - self.do_notify(_t("Sending Error"), _t("Your message has not been sent.")); + self.do_notify(false, _t("Message not sent")); return Promise.reject(); }); }, diff --git a/addons/mail/static/tests/many2one_avatar_user_tests.js b/addons/mail/static/tests/many2one_avatar_user_tests.js index 2864fcc1868..ef6803f68fd 100644 --- a/addons/mail/static/tests/many2one_avatar_user_tests.js +++ b/addons/mail/static/tests/many2one_avatar_user_tests.js @@ -136,7 +136,7 @@ QUnit.module('mail', {}, function () { throw new Error('should not call mail_service'); } if (ev.data.service === 'notification') { - assert.step(`display notification "${ev.data.args[0].title}"`); + assert.step(`display notification "${ev.data.args[0].message}"`); } }, true); @@ -146,7 +146,7 @@ QUnit.module('mail', {}, function () { assert.verifySteps([ 'read foo 4', - 'display notification "Cannot chat with yourself"', + 'display notification "You cannot chat with yourself"', ]); form.destroy(); diff --git a/addons/odoo_referral/static/src/js/systray.js b/addons/odoo_referral/static/src/js/systray.js index 4b29fd36e61..689a5a93a33 100644 --- a/addons/odoo_referral/static/src/js/systray.js +++ b/addons/odoo_referral/static/src/js/systray.js @@ -51,7 +51,7 @@ odoo.define('systray.systray_odoo_referral', function (require) { var message = _t('A popup window has been blocked. You ' + 'may need to change your browser settings to allow ' + 'popup windows for this page.'); - self.do_warn(_t('Warning'), message, true); + self.do_warn(false, message, true); } }); }, diff --git a/addons/portal/static/src/js/portal_composer.js b/addons/portal/static/src/js/portal_composer.js index 4e9f3d0e378..64454ae4ca8 100644 --- a/addons/portal/static/src/js/portal_composer.js +++ b/addons/portal/static/src/js/portal_composer.js @@ -124,7 +124,7 @@ var PortalComposer = publicWidget.Widget.extend({ resolve(); }).guardedCatch(function (error) { self.displayNotification({ - message: _.str.sprintf(_t("The file %s could not be saved."), + message: _.str.sprintf(_t("Could not save file %s"), _.escape(file.name)), type: 'warning', sticky: true, diff --git a/addons/product/static/src/js/product_pricelist_report.js b/addons/product/static/src/js/product_pricelist_report.js index fa19e0c8a3a..c040a190e84 100644 --- a/addons/product/static/src/js/product_pricelist_report.js +++ b/addons/product/static/src/js/product_pricelist_report.js @@ -35,7 +35,10 @@ var QtyTagWidget = Widget.extend({ */ _onClickAddQty: function () { if (this.quantities.length >= this.MAX_QTY) { - this.do_notify(_t("Quantity cannot be displayed"), _.str.sprintf(_t("Maximum %d quantities can be displayed simultaneously. Remove a selected quantity to add others."), this.MAX_QTY)); + this.do_notify(false, _.str.sprintf( + _t("At most %d quantities can be displayed simultaneously. Remove a selected quantity to add others."), + this.MAX_QTY + )); return; } const qty = parseInt(this.$('.o_product_qty').val()); @@ -48,12 +51,12 @@ var QtyTagWidget = Widget.extend({ this.renderElement(); } else { this.displayNotification({ - title: _.str.sprintf(_t("Quantity already present (%d)."), qty), + message: _.str.sprintf(_t("Quantity already present (%d)."), qty), type: 'info' }); } } else { - this.do_notify(_t("Please enter a positive whole number.")); + this.do_notify(false, _t("Please enter a positive whole number")); } }, /** diff --git a/addons/product/static/tests/product_pricelist_report_test.js b/addons/product/static/tests/product_pricelist_report_test.js index 7ecf91d7cdc..b9eac3cf5f3 100644 --- a/addons/product/static/tests/product_pricelist_report_test.js +++ b/addons/product/static/tests/product_pricelist_report_test.js @@ -94,7 +94,7 @@ QUnit.module('Product Pricelist', { // existing quantity can not be added. await testUtils.dom.click(actionManager.$('.o_add_qty')); let notificationElement = document.body.querySelector('.o_notification_manager .o_notification.bg-info'); - assert.strictEqual(notificationElement.querySelector('.o_notification_title').textContent, + assert.strictEqual(notificationElement.querySelector('.o_notification_content').textContent, "Quantity already present (1).", "Existing Quantity can not be added"); // adding few more quantities to check. @@ -111,7 +111,7 @@ QUnit.module('Product Pricelist', { notificationElement = document.body.querySelector('.o_notification_manager .o_notification.bg-warning'); assert.strictEqual(notificationElement.querySelector('.o_notification_content').textContent, - "Maximum 5 quantities can be displayed simultaneously. Remove a selected quantity to add others.", + "At most 5 quantities can be displayed simultaneously. Remove a selected quantity to add others.", "Can not add more then 5 quantities"); // removing all the quantities should work @@ -143,4 +143,4 @@ QUnit.module('Product Pricelist', { } ); -}); \ No newline at end of file +}); diff --git a/addons/sale/static/src/js/sale.js b/addons/sale/static/src/js/sale.js index b81e6ea91c7..556c9fd2f6c 100644 --- a/addons/sale/static/src/js/sale.js +++ b/addons/sale/static/src/js/sale.js @@ -45,7 +45,7 @@ KanbanRecord.include({ var self = this; var value = Number(this.$target_input.val()); if (isNaN(value)) { - this.do_warn(_t("Wrong value entered!"), _t("Only Integer Value should be valid.")); + this.do_warn(false, _t("Please enter an integer value")); } else { this.trigger_up('kanban_record_update', { invoiced_target: value, diff --git a/addons/stock/static/src/js/inventory_validate_button_controller.js b/addons/stock/static/src/js/inventory_validate_button_controller.js index 9b930c1e174..cd554bd12e5 100644 --- a/addons/stock/static/src/js/inventory_validate_button_controller.js +++ b/addons/stock/static/src/js/inventory_validate_button_controller.js @@ -69,7 +69,7 @@ var InventoryValidationController = ListController.extend({ } // ... but in any other cases, we go back on the inventory form. self.do_notify( - _t("Success"), + false, _t("The inventory has been validated")); self.trigger_up('history_back'); }; diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js index 7c6193be6cb..aee954342fa 100644 --- a/addons/web/static/src/js/chrome/action_manager.js +++ b/addons/web/static/src/js/chrome/action_manager.js @@ -536,7 +536,7 @@ var ActionManager = Widget.extend({ var message = _t('A popup window has been blocked. You ' + 'may need to change your browser settings to allow ' + 'popup windows for this page.'); - this.do_warn(_t('Warning'), message, true); + this.do_warn(false, message, true); } } diff --git a/addons/web/static/src/js/control_panel/custom_favorite_item.js b/addons/web/static/src/js/control_panel/custom_favorite_item.js index 75eefe9cc2f..b7b3a34ef81 100644 --- a/addons/web/static/src/js/control_panel/custom_favorite_item.js +++ b/addons/web/static/src/js/control_panel/custom_favorite_item.js @@ -60,7 +60,6 @@ odoo.define('web.CustomFavoriteItem', function (require) { _saveFavorite() { if (!this.state.description.length) { this.env.services.notification.notify({ - title: this.env._t("Error"), message: this.env._t("A name for your favorite filter is required."), type: 'danger', }); @@ -69,7 +68,6 @@ odoo.define('web.CustomFavoriteItem', function (require) { const favorites = this.model.getFiltersOfType('favorite'); if (favorites.some(f => f.description === this.state.description)) { this.env.services.notification.notify({ - title: this.env._t("Error"), message: this.env._t("Filter with same name already exists."), type: 'danger', }); diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 9c04679a0d2..553a79cad20 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1680,7 +1680,7 @@ var AbstractFieldBinary = AbstractField.extend({ }, on_file_uploaded: function (size, name) { if (size === false) { - this.do_warn(_t("File Upload"), _t("There was a problem while uploading your file")); + this.do_warn(false, _t("There was a problem while uploading your file")); // TODO: use crashmanager console.warn("Error while uploading file : ", name); } else { @@ -1823,7 +1823,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ $img.one('error', function () { $img.attr('src', self.placeholder); - self.do_warn(_t("Image"), _t("Could not display the selected image.")); + self.do_warn(false, _t("Could not display the selected image")); }); return this._super.apply(this, arguments); @@ -1963,7 +1963,7 @@ var FieldBinaryFile = AbstractFieldBinary.extend({ }, on_save_as: function (ev) { if (!this.value) { - this.do_warn(_t("Save As..."), _t("The field is empty, there's nothing to save !")); + this.do_warn(false, _t("The field is empty, there's nothing to save.")); ev.stopPropagation(); } else if (this.res_id) { framework.blockUI(); @@ -2643,7 +2643,7 @@ var FieldProgressBar = AbstractField.extend({ // Cover all numbers with parseFloat parsedValue = field_utils.parse.float($input.val()); } catch (error) { - this.do_warn(_t("Wrong value entered!"), _t("Only Integer or Float Value should be valid.")); + this.do_warn(false, _t("Please enter a numerical value")); } if (parsedValue !== undefined) { diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 660d6e43a7f..5c557dca239 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1793,7 +1793,7 @@ var One2ManyKanbanRecord = KanbanRecord.extend({ if ($button.attr('warn')) { $button.on('click', function (e) { e.stopPropagation(); - self.do_warn(_t('Warning'), _t('Please click on the "save" button first.')); + self.do_warn(false, _t('Please click on the "save" button first')); }); } else { $button.attr('disabled', 'disabled'); diff --git a/addons/web/static/src/js/fields/signature.js b/addons/web/static/src/js/fields/signature.js index 98911f76155..de70f72c3e9 100644 --- a/addons/web/static/src/js/fields/signature.js +++ b/addons/web/static/src/js/fields/signature.js @@ -110,7 +110,7 @@ var FieldBinarySignature = AbstractFieldBinary.extend({ $img.on('error', function () { self._clearFile(); $img.attr('src', self.placeholder); - self.do_warn(_t("Image"), _t("Could not display the selected image.")); + self.do_warn(false, _t("Could not display the selected image")); }); }, diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 6434554d376..99da98f4301 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -526,7 +526,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { }); warnings.unshift(''); - this.do_warn(_t("The following fields are invalid:"), warnings.join('')); + this.do_warn(_t("Invalid fields:"), warnings.join('')); }, /** * Hook method, called when record(s) has been deleted. diff --git a/addons/web/static/src/js/views/calendar/calendar_quick_create.js b/addons/web/static/src/js/views/calendar/calendar_quick_create.js index e89881d0e93..0f6f8bd6873 100644 --- a/addons/web/static/src/js/views/calendar/calendar_quick_create.js +++ b/addons/web/static/src/js/views/calendar/calendar_quick_create.js @@ -80,7 +80,7 @@ var QuickCreate = Dialog.extend({ if (!val) { this.$('label, input').addClass('o_field_invalid'); var warnings = _.str.sprintf('', _t("Summary")); - this.do_warn(_t("The following field is invalid:"), warnings); + this.do_warn(_t("Invalid fields:"), warnings); } dataCalendar.title = val; return (val)? this.trigger_up('quickCreate', {data: dataCalendar, options: this.options}) : false; diff --git a/addons/web/static/src/js/views/file_upload_progress_bar.js b/addons/web/static/src/js/views/file_upload_progress_bar.js index 7eea38dd8f6..6c938e2de74 100644 --- a/addons/web/static/src/js/views/file_upload_progress_bar.js +++ b/addons/web/static/src/js/views/file_upload_progress_bar.js @@ -31,7 +31,7 @@ const ProgressBar = Widget.extend({ * @return {Promise} */ start() { - this.xhr.onabort = () => this.do_notify(_t("Upload canceled")); + this.xhr.onabort = () => this.do_notify(false, _t("Upload cancelled")); return this._super(...arguments); }, diff --git a/addons/web/static/src/js/views/kanban/kanban_record.js b/addons/web/static/src/js/views/kanban/kanban_record.js index 52ff0365518..f6216171f12 100644 --- a/addons/web/static/src/js/views/kanban/kanban_record.js +++ b/addons/web/static/src/js/views/kanban/kanban_record.js @@ -706,7 +706,7 @@ var KanbanRecord = Widget.extend({ } break; default: - this.do_warn("Kanban: no action for type : " + type); + this.do_warn(false, _t("Kanban: no action for type: ") + type); } }, /** diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index 800a09f32be..709deced4df 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -287,10 +287,10 @@ var ListController = BasicController.extend({ }); if (resIds.length === session.active_ids_limit) { const msg = _.str.sprintf( - _t("Of the %d records selected, only the first %d have been deleted."), - state.count, resIds.length + _t("Only the first %d records have been deleted (out of %d selected)"), + resIds.length, state.count ); - this.do_notify(_t('Warning'), msg); + this.do_notify(false, msg); } this.reload(); }; diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 5fb716e48dc..c2c57250022 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -586,7 +586,7 @@ var ListRenderer = BasicRenderer.extend({ if (node.attrs.options.warn) { $button.on("click", function (e) { e.stopPropagation(); - self.do_warn(_t("Warning"), _t('Please click on the "save" button first.')); + self.do_warn(false, _t('Please click on the "save" button first')); }); } else { $button.prop('disabled', true); diff --git a/addons/web/static/src/js/widgets/attach_document.js b/addons/web/static/src/js/widgets/attach_document.js index a4a72a62765..8ad48882ac2 100644 --- a/addons/web/static/src/js/widgets/attach_document.js +++ b/addons/web/static/src/js/widgets/attach_document.js @@ -62,7 +62,7 @@ var AttachDocument = Widget.extend({ }); warnings.unshift(''); - this.do_warn(_t("The following fields are invalid:"), warnings.join('')); + this.do_warn(_t("Invalid fields:"), warnings.join('')); }, //-------------------------------------------------------------------------- @@ -87,7 +87,7 @@ var AttachDocument = Widget.extend({ // but due to this security restriction give warning to save record first. // https://stackoverflow.com/questions/29728705/trigger-click-on-input-file-on-asynchronous-ajax-done/29873845#29873845 if (!this.res_id) { - return this.do_warn(_t('Warning : You have to save first before attaching a file.')); + return this.do_warn(false, _t('Please save before attaching a file')); } this.$('input.o_input_file').trigger('click'); }, diff --git a/addons/web/static/src/js/widgets/domain_selector.js b/addons/web/static/src/js/widgets/domain_selector.js index 755ee32979e..9fe71ce163f 100644 --- a/addons/web/static/src/js/widgets/domain_selector.js +++ b/addons/web/static/src/js/widgets/domain_selector.js @@ -535,10 +535,7 @@ var DomainSelector = DomainTree.extend({ // Warn the user if the domain is not valid after rendering if (!this._isValid) { - this.do_warn( - _t("Domain error"), - _t("The domain you entered is not properly formed") - ); + this.do_warn(false, _t("Domain not supported")); } }, /** @@ -583,7 +580,7 @@ var DomainSelector = DomainTree.extend({ try { domain = Domain.prototype.stringToArray($(e.currentTarget).val()); } catch (err) { // If there is a syntax error, just ignore the change - this.do_warn(_t("Syntax error"), _t("The domain you entered is not properly formed")); + this.do_warn(_t("Syntax error"), _t("Domain not properly formed")); return; } this._redraw(domain).then((function () { diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/js/widgets/model_field_selector.js index 8f560be6d39..1856bccfade 100644 --- a/addons/web/static/src/js/widgets/model_field_selector.js +++ b/addons/web/static/src/js/widgets/model_field_selector.js @@ -433,8 +433,8 @@ var ModelFieldSelector = Widget.extend({ if (!this.valid) { this.do_warn( - _t("Invalid field chain"), - _t("The field chain is not valid. Did you maybe use a non-existing field name or followed a non-relational field?") + false, + _t("Invalid field chain. You may have used a non-existing field name or followed a non-relational field.") ); } }, @@ -495,7 +495,10 @@ var ModelFieldSelector = Widget.extend({ var userChainStr = this.$input.val(); var userChain = userChainStr.split("."); if (!this.options.followRelations && userChain.length > 1) { - this.do_warn(_t("Relation not allowed"), _t("You cannot follow relations for this field chain construction")); + this.do_warn( + _t("Relation not allowed"), + _t("You cannot follow relations for this field chain construction") + ); userChain = [userChain[0]]; } this.setChain(userChain).then((function () { diff --git a/addons/web/static/tests/control_panel/favorite_menu_tests.js b/addons/web/static/tests/control_panel/favorite_menu_tests.js index 905b3758859..9c404d0eb17 100644 --- a/addons/web/static/tests/control_panel/favorite_menu_tests.js +++ b/addons/web/static/tests/control_panel/favorite_menu_tests.js @@ -453,7 +453,6 @@ odoo.define('web.favorite_menu_tests', function (require) { notification: { notify: function (params) { assert.deepEqual(params, { - title: "Error", message: "Filter with same name already exists.", type: "danger" }); @@ -578,4 +577,4 @@ odoo.define('web.favorite_menu_tests', function (require) { form.destroy(); }); }); -}); \ No newline at end of file +}); diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index ec4b1b3f552..7af27167e4c 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -7236,7 +7236,10 @@ QUnit.module('basic_fields', { call_service: function (ev) { if (ev.data.service === 'notification') { assert.strictEqual(ev.data.method, 'notify'); - assert.strictEqual(ev.data.args[0].title, 'Wrong value entered!'); + assert.strictEqual( + ev.data.args[0].message, + "Please enter a numerical value" + ); } } }, diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 3472c76aae8..33bc3de7347 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -3095,7 +3095,7 @@ QUnit.module('Views', { if (params.type !== 'danger') { return; } - assert.strictEqual(params.title, 'The following fields are invalid:', + assert.strictEqual(params.title, 'Invalid fields:', "should have a warning with correct title"); assert.strictEqual(params.message, '', "should have a warning with correct message"); diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index eda2b4b3fc3..7ad57374a1c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2037,8 +2037,7 @@ var SnippetsMenu = Widget.extend({ reason.event.preventDefault(); this.close(); self.displayNotification({ - title: _t("Something went wrong."), - message: _.str.sprintf(_t("The module %s could not be installed."), name), + message: _.str.sprintf(_t("Could not install module %s"), name), type: 'danger', sticky: true, }); diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js index eb62efa8a48..59d2ce65718 100644 --- a/addons/web_editor/static/tests/field_html_tests.js +++ b/addons/web_editor/static/tests/field_html_tests.js @@ -151,7 +151,7 @@ QUnit.module('web_editor', {}, function () { "className": undefined, "message": "", "sticky": undefined, - "title": "The following fields are invalid:", + "title": "Invalid fields:", "type": "danger" }); } diff --git a/addons/website/static/src/js/content/website_root.js b/addons/website/static/src/js/content/website_root.js index af176cec1c0..dedf5c94359 100644 --- a/addons/website/static/src/js/content/website_root.js +++ b/addons/website/static/src/js/content/website_root.js @@ -219,7 +219,6 @@ var WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, { if (result) { self.displayNotification({ type: 'success', - title: _t("Congratulations"), message: $data.data('description') ? _.str.sprintf(_t("You've published your %s."), $data.data('description')) : _t("Published with success."), diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 18599dfa955..d1d3365c67b 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -1625,8 +1625,7 @@ options.registry.anchor = options.Class.extend({ const anchor = decodeURIComponent(this._getAnchorLink()); this.displayNotification({ type: 'success', - title: _t("Copied !"), - message: _.str.sprintf(_t("The anchor has been copied to your clipboard.
Link: %s"), anchor), + message: _.str.sprintf(_t("Anchor copied to clipboard
Link: %s"), anchor), buttons: [{text: _t("Edit"), click: () => this.openAnchorDialog(), primary: true}], }); }); diff --git a/addons/website_slides/static/src/js/slides_course_quiz.js b/addons/website_slides/static/src/js/slides_course_quiz.js index d07e68f2344..57bedab2cfa 100644 --- a/addons/website_slides/static/src/js/slides_course_quiz.js +++ b/addons/website_slides/static/src/js/slides_course_quiz.js @@ -127,7 +127,6 @@ odoo.define('website_slides.quiz', function (require) { this.displayNotification({ type: 'warning', - title: _t('Quiz validation error'), message: message, sticky: true }); diff --git a/addons/website_slides/static/src/js/slides_course_quiz_question_form.js b/addons/website_slides/static/src/js/slides_course_quiz_question_form.js index cfa54ebd7dc..b2a6df8e009 100644 --- a/addons/website_slides/static/src/js/slides_course_quiz_question_form.js +++ b/addons/website_slides/static/src/js/slides_course_quiz_question_form.js @@ -177,7 +177,6 @@ var QuestionFormWidget = publicWidget.Widget.extend({ } else { this.displayNotification({ type: 'warning', - title: _t('Unable to create question'), message: _t('Please fill up the question'), sticky: true });