diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 010585ee4a0..c4f0f91adcd 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -1,4 +1,4 @@
-@charset "utf-8";
+@charset "UTF-8";
@font-face {
font-family: "mnmliconsRegular";
src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot");
@@ -2290,7 +2290,7 @@
}
.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
font-size: 80%;
- color: darkGreen;
+ color: darkgreen;
vertical-align: top;
position: relative;
top: -4px;
@@ -3434,7 +3434,6 @@ div.ui-widget-overlay {
overflow: hidden !important;
}
}
-
.nav li > a {
padding: 3px 4px 2px 18px;
color: #4c4c4c;
@@ -3569,6 +3568,40 @@ h5 {
color: #eeeeee;
}
+.dropdown-menu.with-arrow {
+ background: white;
+ background: white !important;
+}
+
+.dropdown-menu.with-arrow:before {
+ position: absolute;
+ top: -12px;
+ left: 0px;
+ display: inline-block;
+ border-right: 12px solid transparent;
+ border-bottom: 12px solid #cccccc;
+ border-left: 12px solid transparent;
+ border-bottom-color: rgba(0, 0, 0, 0.2);
+ content: "";
+}
+
+.dropdown-menu.with-arrow:after {
+ position: absolute;
+ top: -11px;
+ left: 1px;
+ display: inline-block;
+ border-right: 11px solid transparent;
+ border-bottom: 11px solid white;
+ border-left: 11px solid transparent;
+ content: "";
+}
+
+.dropdown-menu.with-arrow li a {
+ color: black;
+}
+.dropdown-menu.with-arrow li a, .dropdown-menu.with-arrow li a:hover, .dropdown-menu.with-arrow li a:focus {
+ text-decoration: none;
+}
.ui-icon {
width: 18px;
height: 18px;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index e9a51370192..078fb28e137 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -2843,6 +2843,32 @@ h5
li
a,a:hover,a:focus
color: #eeeeee
+.dropdown-menu.with-arrow
+ background: #FFF
+ background: #FFF !important
+.dropdown-menu.with-arrow:before
+ position: absolute
+ top: -12px
+ left: 0px
+ display: inline-block
+ border-right: 12px solid transparent
+ border-bottom: 12px solid #ccc
+ border-left: 12px solid transparent
+ border-bottom-color: rgba(0, 0, 0, 0.2)
+ content: ''
+.dropdown-menu.with-arrow:after
+ position: absolute
+ top: -11px
+ left: 1px
+ display: inline-block
+ border-right: 11px solid transparent
+ border-bottom: 11px solid #ffffff
+ border-left: 11px solid transparent
+ content: ''
+.dropdown-menu.with-arrow li a
+ color: #000
+.dropdown-menu.with-arrow li a, .dropdown-menu.with-arrow li a:hover, .dropdown-menu.with-arrow li a:focus
+ text-decoration: none;
// End hack }}}
// Hack for ui icon {{{
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index f20e9053867..901a4bdcb72 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2331,6 +2331,83 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we
}
});
+instance.web.Legend = instance.web.Widget.extend({
+ init: function (parent, dataset, options) {
+ this._super(parent);
+ this.parent = parent;
+ this.dataset = dataset;
+ this.options = options;
+ },
+ prepare_data: function() {
+ var self =this;
+ var def = $.Deferred();
+ if (this.parent.name == 'kanban_state'){
+ var datas = [{ 'name': 'normal', 'legend_name': ' Normal', 'legend': '
' },
+ { 'name': 'blocked', 'legend_name': ' Blocked', 'legend': '
' },
+ { 'name': 'done', 'legend_name': ' Done', 'legend': '
' }]
+ return def.resolve(datas);
+ }
+ if (this.parent.name == 'priority'){
+ var data = [];
+ var selection = this.parent.field.selection || [];
+ for (var index in selection) {
+ value = {
+ 'name': selection[index][0],
+ 'legend_name': selection[index][1]
+ }
+ if (selection[index][0] == '0'){
+ value['legend']= '
';
+ value['legend_name'] = 'Set the Priority';
+ }else{
+ value['legend']= '
';
+ }
+ data.push(value)
+ }
+ return def.resolve(data);
+ }
+ },
+ render_value: function(record_id, data) {
+ var self = this;
+ var content;
+ self.record_id = record_id;
+ this.prepare_data().then(function (res){
+ data['res'] = res;
+ content = QWeb.render("Legend."+ self.parent.name, data);
+ });
+ if (data.view_mode === 'form')
+ this.parent.$el.html(content);
+ else
+ this.parent.$el = $(content);
+ if (!this.parent.get("effective_readonly")){
+ this.parent.$el.find('.oe_legend').click(self.do_action.bind(self));
+ }
+ },
+ do_action: function(e){
+ var self = this;
+ var li = $(e.target).closest( "li" );
+ if (li.length){
+ var value = li.data('value');
+ return self.dataset.call_button(self.options.action, [self.record_id, value, self.dataset.get_context()]).done(self.parent.reload_record.bind(self.parent));
+ }
+ }
+});
+
+instance.web.form.Legend = instance.web.form.FieldChar.extend({
+ init: function (field_manager, node) {
+ this._super(field_manager, node);
+ this.legend = new instance.web.Legend(this, this.view.dataset, py.eval(node.attrs.options));
+ },
+ reload_record: function(){
+ this.view.reload();
+ },
+ render_value: function() {
+ var self = this;
+ self.legend.render_value(this.view.datarecord.id, {
+ 'widget': self,
+ 'view_mode':'form'
+ });
+ },
+});
instance.web.form.FieldID = instance.web.form.FieldChar.extend({
process_modifiers: function () {
this._super();
@@ -5853,6 +5930,7 @@ instance.web.form.widgets = new instance.web.Registry({
'monetary': 'instance.web.form.FieldMonetary',
'many2many_checkboxes': 'instance.web.form.FieldMany2ManyCheckBoxes',
'x2many_counter': 'instance.web.form.X2ManyCounter',
+ 'legend':'instance.web.form.Legend'
});
/**
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index ae7a4f279b0..6fca2d3260e 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1031,6 +1031,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index 5aed681f5f6..07742057db5 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -1258,7 +1258,27 @@ instance.web_kanban.AbstractField = instance.web.Widget.extend(instance.web_kanb
},
});
+instance.web_kanban.Legend = instance.web_kanban.AbstractField.extend({
+ init: function(parent, field, $node) {
+ this._super.apply(this, arguments);
+ this.name = $node.attr('name')
+ this.parent = parent;
+ this.legend = new instance.web.Legend(this, parent.view.dataset, this.options);
+ },
+ reload_record: function(){
+ this.parent.do_reload();
+ },
+ renderElement: function() {
+ var self = this;
+ self.legend.render_value(self.parent.id, {
+ 'widget': self,
+ });
+ },
+});
+
+
instance.web_kanban.fields_registry = new instance.web.Registry({});
+instance.web_kanban.fields_registry.add('legend','instance.web_kanban.Legend');
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: