diff options
| author | Rémy Voet (ryv) <ryv@odoo.com> | 2020-02-03 16:07:15 +0000 |
|---|---|---|
| committer | Rémy Voet (ryv) <ryv@odoo.com> | 2020-02-14 16:23:03 +0000 |
| commit | 3a935af85aa8c0185b58866ab1c1ba5d9dc470ba (patch) | |
| tree | fb860653a6e7eab024ea1828bbaca4d6393ea0cf /addons/stock/static | |
| parent | 67402bc5ecfb1dd077742137d8d8f222e1d75ff9 (diff) | |
[IMP] stock,mrp: change icon of json popover
The icon of the json popover become a warning icon
when there is a issue. Also, create a
field show_json_popover in mrp_production
to avoid using d-none to put in invisible the popover.
task-2178494
closes odoo/odoo#45420
X-original-commit: 270e8d34b2adec07e8ae3b8952514184d2a00b59
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/stock/static')
| -rw-r--r-- | addons/stock/static/src/js/popover_widget.js | 7 | ||||
| -rw-r--r-- | addons/stock/static/src/js/stock_rescheduling_popover.js | 3 | ||||
| -rw-r--r-- | addons/stock/static/src/xml/popover_widget.xml | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/addons/stock/static/src/js/popover_widget.js b/addons/stock/static/src/js/popover_widget.js index 9aafd9bc057..58c54000e08 100644 --- a/addons/stock/static/src/js/popover_widget.js +++ b/addons/stock/static/src/js/popover_widget.js @@ -7,9 +7,10 @@ var QWeb = core.qweb; var fieldRegistry = require('web.field_registry'); /** - * Widget Popover for JSON field, by default render a simple html message + * Widget Popover for JSON field (char), by default render a simple html message * { * 'msg': '<CONTENT OF THE POPOVER>', + * 'icon': '<FONT AWESOME CLASS>' (optionnal), * 'color': '<COLOR CLASS OF ICON>' (optionnal), * 'title': '<TITLE OF POPOVER>' (optionnal), * 'popoverTemplate': '<TEMPLATE OF THE TEMPLATE>' (optionnal) @@ -22,6 +23,8 @@ var PopoverWidgetField = AbstractField.extend({ trigger: 'hover focus', placement: 'top', html: true, + color: 'text-primary', + icon: 'fa-info-circle', _render: function () { var value = JSON.parse(this.value); @@ -30,7 +33,7 @@ var PopoverWidgetField = AbstractField.extend({ return; } this.$el.css('max-width', '17px'); - this.$el.html(QWeb.render(this.buttonTemplape, value)); + this.$el.html(QWeb.render(this.buttonTemplape, _.defaults(value, {color: this.color, icon: this.icon}))); this.$el.find('a').prop('special_click', true); this.$popover = $(QWeb.render(value.popoverTemplate || this.popoverTemplate, value)); this.$el.find('a').popover({ diff --git a/addons/stock/static/src/js/stock_rescheduling_popover.js b/addons/stock/static/src/js/stock_rescheduling_popover.js index e30b88bace7..8c6ef56938a 100644 --- a/addons/stock/static/src/js/stock_rescheduling_popover.js +++ b/addons/stock/static/src/js/stock_rescheduling_popover.js @@ -9,8 +9,9 @@ var _t = core._t; var PopoverStockPicking = PopoverWidgetField.extend({ title: _t('Planning Issue'), - color: 'text-warning', trigger: 'focus', + color: 'text-danger', + icon: 'fa-exclamation-triangle', _render: function () { this._super(); diff --git a/addons/stock/static/src/xml/popover_widget.xml b/addons/stock/static/src/xml/popover_widget.xml index 37cffd522df..d9cf2b4fe8d 100644 --- a/addons/stock/static/src/xml/popover_widget.xml +++ b/addons/stock/static/src/xml/popover_widget.xml @@ -2,7 +2,7 @@ <templates id="template" xml:space="preserve"> <t t-name="stock.popoverButton"> - <a tabindex="0" t-attf-class="p-1 fa fa-info-circle #{ color || 'text-primary'}"/> + <a tabindex="0" t-attf-class="p-1 fa #{ icon || 'fa-info-circle'} #{ color || 'text-primary'}"/> </t> <div t-name="stock.popoverContent"> |
