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('