summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorDhawal Limbuwala <dli@odoo.com>2017-05-18 12:29:55 +0530
committerYannick Tivisse <yti@odoo.com>2017-10-19 10:10:06 +0200
commit3ad9ee70554ff0f334b39656ef2510531e0dbc8d (patch)
tree82ecc4896c3054953f0a4d90ae91a801b4bb9d8d /addons/web/static/src/js
parent39335d4569943278e410901ef53572f617cc9397 (diff)
[IMP] web: Improve alert banner to update translations
Purpose ======= Simplify / reduce the warning message when we update a record in multi-languages Specification ============= 1/ Make the translation banner little bit lighter in design 2/ Make it still visible when coming back from breadcrumb
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_controller.js12
-rw-r--r--addons/web/static/src/js/views/form/form_controller.js3
-rw-r--r--addons/web/static/src/js/views/form/form_renderer.js4
3 files changed, 15 insertions, 4 deletions
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 c899530de07..44275de7a43 100644
--- a/addons/web/static/src/js/views/basic/basic_controller.js
+++ b/addons/web/static/src/js/views/basic/basic_controller.js
@@ -581,6 +581,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
*/
_onTranslate: function (event) {
event.stopPropagation();
+ var self = this;
var record = this.model.get(event.data.id, {raw: true});
this._rpc({
route: '/web/dataset/call_button',
@@ -589,7 +590,16 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
method: 'translate_fields',
args: [record.model, record.res_id, event.data.fieldName, record.getContext()],
}
- }).then(this.do_action.bind(this));
+ }).then(function (result) {
+ self.do_action(result, {
+ on_reverse_breadcrumb: function () {
+ if (self.renderer.alertFields.length) {
+ self.renderer.displayTranslationAlert();
+ }
+ return false
+ },
+ })
+ });
},
});
diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js
index a6248c827a2..af220733802 100644
--- a/addons/web/static/src/js/views/form/form_controller.js
+++ b/addons/web/static/src/js/views/form/form_controller.js
@@ -205,7 +205,8 @@ var FormController = BasicController.extend({
}
}
if (alertFields.length) {
- self.renderer.displayTranslationAlert(alertFields);
+ self.renderer.alertFields = alertFields;
+ self.renderer.displayTranslationAlert();
}
}
return changedFields;
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js
index ab5e4beb6b5..b9711d1d392 100644
--- a/addons/web/static/src/js/views/form/form_renderer.js
+++ b/addons/web/static/src/js/views/form/form_renderer.js
@@ -82,11 +82,11 @@ var FormRenderer = BasicRenderer.extend({
*
* @param {Object[]} alertFields field list
*/
- displayTranslationAlert: function (alertFields) {
+ displayTranslationAlert: function () {
this.$('.o_notification_box').remove();
var $notification = $(qweb.render('notification-box', {type: 'info'}))
.append(qweb.render('translation-alert', {
- fields: alertFields,
+ fields: this.alertFields,
lang: _t.database.parameters.name
}));
if (this.$('.o_form_statusbar').length) {