summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2014-01-16 19:15:19 +0100
committerFabien Meghazi <fme@openerp.com>2014-01-16 19:15:19 +0100
commitc0dda700f19ca3452db7dfb9eef1517299f8e8f0 (patch)
treef71da9acdc2d0f6c7af6b9559df87a5329f99c03 /addons/web/static/src
parent4b663489a6a922e579e00fabbb0e3129dcf9ecc5 (diff)
parent153df3aeacfce1a184bf3930376435bd691d19a3 (diff)
[MERGE] upstream
bzr revid: fme@openerp.com-20140116181519-xtzhzm7u98u6xz18
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css258
-rw-r--r--addons/web/static/src/css/base.sass209
-rw-r--r--addons/web/static/src/js/chrome.js2
-rw-r--r--addons/web/static/src/js/data.js9
-rw-r--r--addons/web/static/src/js/formats.js1
-rw-r--r--addons/web/static/src/js/search.js9
-rw-r--r--addons/web/static/src/js/view_form.js77
-rw-r--r--addons/web/static/src/js/view_list.js22
-rw-r--r--addons/web/static/src/js/view_list_editable.js29
-rw-r--r--addons/web/static/src/js/views.js1
10 files changed, 340 insertions, 277 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 400245a7570..ea57a7b8bdb 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -658,6 +658,10 @@
display: block;
color: gray;
}
+.openerp .ui-tabs .oe_notebook.ui-tabs-nav li.ui-tabs-active {
+ border-bottom: none;
+ padding-bottom: 1px;
+}
.openerp .oe_notebook > li.ui-tabs-active > a {
color: #4c4c4c;
}
@@ -2746,6 +2750,9 @@
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master {
width: 100% !important;
}
+.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_reference {
+ display: table;
+}
.openerp .oe_list_group_name {
white-space: nowrap;
}
@@ -3035,6 +3042,123 @@
float: right;
color: #333333;
}
+.openerp .navbar {
+ min-height: 32px;
+ margin-bottom: 0px;
+ border: none;
+ z-index: 1;
+ background-color: #414141;
+ background-color: #454343;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#646060), to(#262626));
+ background-image: -webkit-linear-gradient(top, #646060, #262626);
+ background-image: -moz-linear-gradient(top, #646060, #262626);
+ background-image: -ms-linear-gradient(top, #646060, #262626);
+ background-image: -o-linear-gradient(top, #646060, #262626);
+ background-image: linear-gradient(to bottom, #646060, #262626);
+}
+.openerp .navbar-default .navbar-nav li a:hover, .openerp .navbar-default .navbar-nav li a:focus {
+ background: rgba(0, 0, 0, 0.3);
+}
+.openerp .navbar-default .navbar-nav .open > a, .openerp .navbar-default .navbar-nav a:hover, .openerp .navbar-default .navbar-nav a:focus {
+ background: rgba(0, 0, 0, 0.3) !important;
+}
+.openerp .navbar-default .navbar-nav .dropdown > a .caret {
+ border-top-color: #777777 !important;
+ border-bottom-color: #777777 !important;
+}
+.openerp .navbar-nav li a {
+ padding: 4px 32px 4px 12px;
+}
+.openerp .oe_navbar .dropdown-menu {
+ font-size: 13px;
+ padding: 4px 0;
+ background: #333333 !important;
+ background: rgba(37, 37, 37, 0.9) !important;
+ border-color: #999999;
+ border-color: rgba(0, 0, 0, 0.2);
+ background-color: #414141;
+ text-shadow: none;
+ background-color: #454343;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#646060), to(#262626));
+ background-image: -webkit-linear-gradient(top, #646060, #262626);
+ background-image: -moz-linear-gradient(top, #646060, #262626);
+ background-image: -ms-linear-gradient(top, #646060, #262626);
+ background-image: -o-linear-gradient(top, #646060, #262626);
+ background-image: linear-gradient(to bottom, #646060, #262626);
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+.openerp .oe_navbar .dropdown-menu li a, .openerp .oe_navbar .dropdown-menu li a:hover, .openerp .oe_navbar .dropdown-menu li a:focus {
+ color: #eeeeee;
+}
+.openerp .oe_view_manager_new .oe_form_nosheet {
+ margin-top: 8px;
+}
+.openerp .oe_view_manager_new .oe_form_nosheet .oe_form_label {
+ font-weight: normal;
+}
+.openerp .nav li > a {
+ padding: 3px 4px 2px 18px;
+ color: #4c4c4c;
+}
+.openerp .nav nav-pills.nav-stacked > li > ul {
+ padding-left: 16px;
+}
+.openerp .nav-pills > li.active > a, .openerp a.list-group-item.active > a {
+ background-color: #7c7bad;
+ color: white;
+ border-radius: 0;
+}
+.openerp .nav-pills > li.active a:hover, .openerp .nav-pills > li.active a:focus, .openerp a.list-group-item.active a:hover, .openerp a.list-group-item.active a:focus {
+ background-color: #7c7bad;
+}
+.openerp .nav-pills > li.active .badge, .openerp a.list-group-item.active .badge {
+ background-color: white;
+ color: #7c7bad;
+ text-shadow: none;
+}
+.openerp .badge {
+ font-weight: normal;
+ font-size: 11px;
+ background-color: #7c7bad;
+}
+.openerp button, .openerp body {
+ line-height: normal;
+}
+.openerp h1, .openerp h2 {
+ font-weight: bold;
+}
+.openerp h3 {
+ font-size: 1.17em;
+ font-weight: bold;
+}
+.openerp p {
+ display: block;
+ -webkit-margin-before: 1em;
+ -webkit-margin-after: 1em;
+ -webkit-margin-start: 0px;
+ -webkit-margin-end: 0px;
+}
+.openerp pre {
+ background-color: white;
+ border: none;
+ padding: 10px 0 3px 0;
+}
+.openerp .jqstooltip {
+ height: auto !important;
+ width: auto !important;
+}
+.openerp h5 {
+ font-weight: bold;
+ font-size: smaller;
+}
+.openerp .oe_form .oe_subtype label, .openerp .oe_subtype label {
+ font-weight: normal;
+}
+.openerp .oe_msg_subtype_check {
+ margin: 3px 3px 0 !important;
+}
@-moz-document url-prefix() {
.openerp .oe_searchview .oe_searchview_search {
@@ -3317,140 +3441,6 @@ body.oe_single_form .oe_single_form_container {
overflow: hidden !important;
}
}
-.nav li > a {
- padding: 3px 4px 2px 18px;
- color: #4c4c4c;
-}
-.nav nav-pills.nav-stacked > li > ul {
- padding-left: 16px;
-}
-
-.nav-pills > li.active > a, a.list-group-item.active > a {
- background-color: #7c7bad;
- color: white;
- border-radius: 0;
-}
-.nav-pills > li.active a:hover, .nav-pills > li.active a:focus, a.list-group-item.active a:hover, a.list-group-item.active a:focus {
- background-color: #7c7bad;
-}
-.nav-pills > li.active .badge, a.list-group-item.active .badge {
- background-color: white;
- color: #7c7bad;
- text-shadow: none;
-}
-
-.badge {
- font-weight: normal;
- font-size: 11px;
- background-color: #7c7bad;
-}
-
-button, body {
- line-height: normal;
-}
-
-h1, h2 {
- font-weight: bold;
-}
-
-h3 {
- font-size: 1.17em;
- font-weight: bold;
-}
-
-p {
- display: block;
- -webkit-margin-before: 1em;
- -webkit-margin-after: 1em;
- -webkit-margin-start: 0px;
- -webkit-margin-end: 0px;
-}
-
-pre {
- background-color: white;
- border: none;
- padding: 10px 0 3px 0;
-}
-
-.jqstooltip {
- height: auto !important;
- width: auto !important;
-}
-
-h5 {
- font-weight: bold;
- font-size: smaller;
-}
-
-.oe_form .oe_subtype label, .oe_subtype label {
- font-weight: normal;
-}
-
-.oe_msg_subtype_check {
- margin: 3px 3px 0 !important;
-}
-
-.oe_view_manager_new .oe_form_nosheet {
- margin-top: 8px;
-}
-.oe_view_manager_new .oe_form_nosheet .oe_form_label {
- font-weight: normal;
-}
-
-.navbar {
- min-height: 32px;
- margin-bottom: 0px;
- border: none;
- z-index: 1;
- background-color: #414141;
- background-color: #454343;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#646060), to(#262626));
- background-image: -webkit-linear-gradient(top, #646060, #262626);
- background-image: -moz-linear-gradient(top, #646060, #262626);
- background-image: -ms-linear-gradient(top, #646060, #262626);
- background-image: -o-linear-gradient(top, #646060, #262626);
- background-image: linear-gradient(to bottom, #646060, #262626);
-}
-
-.navbar-default .navbar-nav li a:hover, .navbar-default .navbar-nav li a:focus {
- background: rgba(0, 0, 0, 0.3);
-}
-.navbar-default .navbar-nav .open > a, .navbar-default .navbar-nav a:hover, .navbar-default .navbar-nav a:focus {
- background: rgba(0, 0, 0, 0.3) !important;
-}
-.navbar-default .navbar-nav .dropdown > a .caret {
- border-top-color: #777777 !important;
- border-bottom-color: #777777 !important;
-}
-
-.navbar-nav li a {
- padding: 4px 32px 4px 12px;
-}
-
-.oe_navbar .dropdown-menu {
- font-size: 13px;
- padding: 4px 0;
- background: #333333 !important;
- background: rgba(37, 37, 37, 0.9) !important;
- border-color: #999999;
- border-color: rgba(0, 0, 0, 0.2);
- background-color: #414141;
- text-shadow: none;
- background-color: #454343;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#646060), to(#262626));
- background-image: -webkit-linear-gradient(top, #646060, #262626);
- background-image: -moz-linear-gradient(top, #646060, #262626);
- background-image: -ms-linear-gradient(top, #646060, #262626);
- background-image: -o-linear-gradient(top, #646060, #262626);
- background-image: linear-gradient(to bottom, #646060, #262626);
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
-}
-.oe_navbar .dropdown-menu li a, .oe_navbar .dropdown-menu li a:hover, .oe_navbar .dropdown-menu li a:focus {
- color: #eeeeee;
-}
-
.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 89b00cd7917..b280c8209a4 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -594,6 +594,9 @@ $sheet-padding: 16px
text-decoration: none
background-color: #eee
border-color: #eee #eee #ddd
+ .ui-tabs .oe_notebook.ui-tabs-nav li.ui-tabs-active
+ border-bottom: none
+ padding-bottom: 1px
.oe_notebook > li.ui-state-active > a, .oe_notebook > li.ui-state-active > a:hover
background-color: #ffffff
border: 1px solid #ddd
@@ -2204,6 +2207,8 @@ $sheet-padding: 16px
&.oe_form_field_datetime,&.oe_form_field_date
input.oe_datepicker_master
width: 100% !important
+ &.oe_form_field_reference
+ display: table
.oe_list_group_name
white-space: nowrap
// }}}
@@ -2430,6 +2435,106 @@ $sheet-padding: 16px
float: right
color: #333
// }}}
+ // Bootstrap HACKS {{{
+ .navbar
+ min-height: 32px
+ margin-bottom: 0px
+ border: none
+ z-index: 1
+ background-color: #414141
+ @include vertical-gradient(#646060, #262626)
+ .navbar-default
+ .navbar-nav
+ li
+ a:hover,a:focus
+ background: rgba(0, 0, 0, 0.3)
+ .open > a,a:hover,a:focus
+ background: rgba(0, 0, 0, 0.3) !important
+ .dropdown > a .caret
+ border-top-color: #777 !important
+ border-bottom-color: #777 !important
+ .navbar-nav
+ li
+ a
+ padding: 4px 32px 4px 12px
+ .oe_navbar .dropdown-menu
+ font-size: 13px
+ padding: 4px 0
+ background: #333333 !important
+ background: rgba(37, 37, 37, 0.9) !important
+ border-color: #999999
+ border-color: rgba(0, 0, 0, 0.2)
+ background-color: #414141
+ text-shadow: none
+ @include vertical-gradient(#646060, #262626)
+ @include radius(3px)
+ li
+ a,a:hover,a:focus
+ color: #eeeeee
+
+ // Minimized unused white space and label weight for wizard popup
+ .oe_view_manager_new .oe_form_nosheet
+ margin-top: 8px
+ .oe_form_label
+ font-weight: normal
+
+ // Customize bootstrap3 for leftbar
+ .nav
+ li > a
+ padding: 3px 4px 2px 18px
+ color: #4c4c4c
+ nav-pills.nav-stacked > li > ul
+ padding-left: 16px
+ .nav-pills > li.active,a.list-group-item.active
+ > a
+ background-color: #7c7bad
+ color: white
+ border-radius: 0
+ a:hover,a:focus
+ background-color: #7c7bad
+ .badge
+ background-color: white
+ color: #7c7bad
+ text-shadow: none
+ .badge
+ font-weight: normal
+ font-size: 11px
+ background-color: #7c7bad
+
+ // Customize for global tags
+ button, body
+ line-height: normal
+ h1,h2
+ font-weight: bold
+ h3
+ font-size: 1.17em
+ font-weight: bold
+ p
+ display: block
+ -webkit-margin-before: 1em
+ -webkit-margin-after: 1em
+ -webkit-margin-start: 0px
+ -webkit-margin-end: 0px
+ pre
+ background-color: #FFFFFF
+ border: none
+ padding: 10px 0 3px 0
+
+ // Customize for kanban tooltip
+ .jqstooltip
+ height: auto !important
+ width: auto !important
+
+ // Customize for chatter
+ h5
+ font-weight: bold
+ font-size: smaller
+ .oe_form .oe_subtype label, .oe_subtype label
+ font-weight: normal
+ .oe_msg_subtype_check
+ margin: 3px 3px 0 !important
+ // }}}
+
@-moz-document url-prefix()
.openerp
.oe_searchview .oe_searchview_search
@@ -2672,110 +2777,6 @@ body.oe_single_form
overflow: hidden !important
// }}}
-// Customize bootstrap3 for leftbar
-.nav
- li > a
- padding: 3px 4px 2px 18px
- color: #4c4c4c
- nav-pills.nav-stacked > li > ul
- padding-left: 16px
-.nav-pills > li.active,a.list-group-item.active
- > a
- background-color: #7c7bad
- color: white
- border-radius: 0
- a:hover,a:focus
- background-color: #7c7bad
- .badge
- background-color: white
- color: #7c7bad
- text-shadow: none
-.badge
- font-weight: normal
- font-size: 11px
- background-color: #7c7bad
-// End of customize
-
-// Customize for global tags
-button, body
- line-height: normal
-h1,h2
- font-weight: bold
-h3
- font-size: 1.17em
- font-weight: bold
-p
- display: block
- -webkit-margin-before: 1em
- -webkit-margin-after: 1em
- -webkit-margin-start: 0px
- -webkit-margin-end: 0px
-pre
- background-color: #FFFFFF
- border: none
- padding: 10px 0 3px 0
-// End of customize
-
-// Customize for kanban tooltip
-.jqstooltip
- height: auto !important
- width: auto !important
-// End of kanban tooltip
-
-// Customize for chatter
-h5
- font-weight: bold
- font-size: smaller
-.oe_form .oe_subtype label, .oe_subtype label
- font-weight: normal
-.oe_msg_subtype_check
- margin: 3px 3px 0 !important
-// End of customize
-
-// Minimized unused white space and label weight for wizard popup
-.oe_view_manager_new .oe_form_nosheet
- margin-top: 8px
- .oe_form_label
- font-weight: normal
-// End of customize
-
-// navbar hack {{{
-.navbar
- min-height: 32px
- margin-bottom: 0px
- border: none
- z-index: 1
- background-color: #414141
- @include vertical-gradient(#646060, #262626)
-.navbar-default
- .navbar-nav
- li
- a:hover,a:focus
- background: rgba(0, 0, 0, 0.3)
- .open > a,a:hover,a:focus
- background: rgba(0, 0, 0, 0.3) !important
- .dropdown > a .caret
- border-top-color: #777 !important
- border-bottom-color: #777 !important
-.navbar-nav
- li
- a
- padding: 4px 32px 4px 12px
-.oe_navbar .dropdown-menu
- font-size: 13px
- padding: 4px 0
- background: #333333 !important
- background: rgba(37, 37, 37, 0.9) !important
- border-color: #999999
- border-color: rgba(0, 0, 0, 0.2)
- background-color: #414141
- text-shadow: none
- @include vertical-gradient(#646060, #262626)
- @include radius(3px)
- li
- a,a:hover,a:focus
- color: #eeeeee
-// End hack }}}
// Hack for ui icon {{{
.ui-icon
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 6aa39304f2e..afa761d7025 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -705,7 +705,7 @@ instance.web.client_actions.add("history_back", "instance.web.HistoryBack");
*/
instance.web.Home = function(parent, action) {
var url = '/' + (window.location.search || '');
- instance.web.redirect(url, action.params && action.params.wait);
+ instance.web.redirect(url, action && action.params && action.params.wait);
};
instance.web.client_actions.add("home", "instance.web.Home");
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 984ded1fd5e..10ca5d74bd9 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -939,6 +939,15 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
* @param {Object} id record to remove from the BDS's cache
*/
evict_record: function (id) {
+ // Don't evict records which haven't yet been saved: there is no more
+ // recent data on the server (and there potentially isn't any data),
+ // and this breaks the assumptions of other methods (that the data
+ // for new and altered records is both in the cache and in the to_write
+ // or to_create collection)
+ if (_(this.to_create.concat(this.to_write)).find(function (record) {
+ return record.id === id; })) {
+ return;
+ }
for(var i=0, len=this.cache.length; i<len; ++i) {
var record = this.cache[i];
// if record we call the button upon is in the cache
diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js
index f8394068c7c..17df1f3e6d1 100644
--- a/addons/web/static/src/js/formats.js
+++ b/addons/web/static/src/js/formats.js
@@ -147,6 +147,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) {
console.warn('Field', descriptor, 'had an empty string as value, treating as false...');
return value_if_empty === undefined ? '' : value_if_empty;
case false:
+ case undefined:
case Infinity:
case -Infinity:
return value_if_empty === undefined ? '' : value_if_empty;
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index 45170e08a96..9a9e61200ad 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -1870,9 +1870,14 @@ instance.web.search.Advanced = instance.web.search.Input.extend({
new instance.web.Model(this.view.model).call('fields_get', {
context: this.view.dataset.context
}).done(function(data) {
- self.fields = _.extend({
+ self.fields = {
id: { string: 'ID', type: 'id' }
- }, data);
+ };
+ _.each(data, function(field_def, field_name) {
+ if (field_def.selectable !== false && field_name != 'id') {
+ self.fields[field_name] = field_def;
+ }
+ });
})).done(function () {
self.append_proposition();
});
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 732b6091338..f08ac89a8ad 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2624,6 +2624,11 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
e.stopPropagation();
}
},
+ 'keypress': function (e) {
+ if (e.which === $.ui.keyCode.ENTER) {
+ e.stopPropagation();
+ }
+ },
'change textarea': 'store_dom_value',
},
initialize_content: function() {
@@ -3450,6 +3455,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
if (! no_recurse) {
var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
this.alive(dataset.name_get([self.get("value")])).done(function(data) {
+ if (!data[0]) {
+ self.do_warn(_t("Render"), _t("No value found for the field "+self.field.string+" for value "+self.get("value")));
+ return;
+ }
self.display_value["" + self.get("value")] = data[0][1];
self.render_value(true);
}).fail( function (data, event) {
@@ -4045,7 +4054,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
GroupsType: instance.web.form.One2ManyGroups,
ListType: instance.web.form.One2ManyList
}));
- this.on('edit:before', this, this.proxy('_before_edit'));
this.on('edit:after', this, this.proxy('_after_edit'));
this.on('save:before cancel:before', this, this.proxy('_before_unedit'));
@@ -4058,7 +4066,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
var ret = this._super();
this.$el
.off('mousedown.handleButtons')
- .on('mousedown.handleButtons', 'table button', this.proxy('_button_down'));
+ .on('mousedown.handleButtons', 'table button, div a.oe_m2o_cm_button', this.proxy('_button_down'));
return ret;
},
changed_records: function () {
@@ -4166,11 +4174,10 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
});
},
- _before_edit: function () {
+ _after_edit: function () {
this.__ignore_blur = false;
this.editor.form.on('blurred', this, this._on_form_blur);
- },
- _after_edit: function () {
+
// The form's blur thing may be jiggered during the edition setup,
// potentially leading to the o2m instasaving the row. Cancel any
// blurring triggered the edition startup here
@@ -4203,7 +4210,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
}
this.cancel_edition();
},
- keyup_ENTER: function () {
+ keypress_ENTER: function () {
// blurring caused by hitting the [Return] key, should skip the
// autosave-on-blur and let the handler for [Return] do its thing (save
// the current row *anyway*, then create a new one/edit the next one)
@@ -4218,6 +4225,12 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
} finally {
window.confirm = confirm;
}
+ },
+ reload_record: function (record) {
+ // Evict record.id from cache to ensure it will be reloaded correctly
+ this.dataset.evict_record(record.get('id'));
+
+ return this._super(record);
}
});
instance.web.form.One2ManyGroups = instance.web.ListView.Groups.extend({
@@ -4261,6 +4274,7 @@ var lazy_build_o2m_kanban_view = function() {
instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, {
template: "FieldMany2ManyTags",
+ tag_template: "FieldMany2ManyTag",
init: function() {
this._super.apply(this, arguments);
instance.web.form.CompletionFieldMixin.init.call(this);
@@ -4268,13 +4282,9 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
this._display_orderer = new instance.web.DropMisordered();
this._drop_shown = false;
},
- initialize_content: function() {
- if (this.get("effective_readonly"))
- return;
+ initialize_texttext: function(){
var self = this;
- var ignore_blur = false;
- self.$text = this.$("textarea");
- self.$text.textext({
+ return {
plugins : 'tags arrow autocomplete',
autocomplete: {
render: function(suggestion) {
@@ -4325,7 +4335,15 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
},
},
},
- }).bind('getSuggestions', function(e, data) {
+ }
+ },
+ initialize_content: function() {
+ if (this.get("effective_readonly"))
+ return;
+ var self = this;
+ var ignore_blur = false;
+ self.$text = this.$("textarea");
+ self.$text.textext(self.initialize_texttext()).bind('getSuggestions', function(e, data) {
var _this = this;
var str = !!data ? data.query || '' : '';
self.get_search_result(str).done(function(result) {
@@ -4373,6 +4391,24 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
get_search_blacklist: function() {
return this.get("value");
},
+ map_tag: function(data){
+ return _.map(data, function(el) {return {name: el[1], id:el[0]};})
+ },
+ get_render_data: function(ids){
+ var self = this;
+ var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
+ return dataset.name_get(ids);
+ },
+ render_tag: function(data) {
+ var self = this;
+ if (! self.get("effective_readonly")) {
+ self.tags.containerElement().children().remove();
+ self.$('textarea').css("padding-left", "3px");
+ self.tags.addTags(self.map_tag(data));
+ } else {
+ self.$el.html(QWeb.render(self.tag_template, {elements: data}));
+ }
+ },
render_value: function() {
var self = this;
var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
@@ -4385,17 +4421,12 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
indexed[el[0]] = el;
});
data = _.map(values, function(el) { return indexed[el]; });
- if (! self.get("effective_readonly")) {
- self.tags.containerElement().children().remove();
- self.$('textarea').css("padding-left", "3px");
- self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};}));
- } else {
- self.$el.html(QWeb.render("FieldMany2ManyTag", {elements: data}));
- }
- };
+ self.render_tag(data);
+ }
if (! values || values.length > 0) {
- this._display_orderer.add(dataset.name_get(values)).done(handle_names);
- } else {
+ this._display_orderer.add(self.get_render_data(values)).done(handle_names);
+ }
+ else{
handle_names([]);
}
},
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index ab1192f7f52..8e3923dcaf2 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -1056,7 +1056,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
id = parseInt(ref_match[2], 10);
new instance.web.DataSet(this.view, model).name_get([id]).done(function(names) {
if (!names.length) { return; }
- record.set(column.id, names[0][1]);
+ record.set(column.id + '__display', names[0][1]);
});
}
} else if (column.type === 'many2one') {
@@ -1314,7 +1314,8 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
}
},
close: function () {
- this.$row.children().last().empty();
+ this.$row.children().last().find('button').remove();
+ this.$row.children().last().find('span').remove();
this.records.reset();
},
/**
@@ -1485,7 +1486,8 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
} else {
if (dataset.size() == records.length) {
// only one page
- self.$row.find('td.oe_list_group_pagination').empty();
+ self.$row.find('td.oe_list_group_pagination').find('button').remove();
+ self.$row.find('td.oe_list_group_pagination').find('span').remove();
} else {
var pages = Math.ceil(dataset.size() / limit);
self.$row
@@ -2127,6 +2129,7 @@ instance.web.list.columns = new instance.web.Registry({
'field.handle': 'instance.web.list.Handle',
'button': 'instance.web.list.Button',
'field.many2onebutton': 'instance.web.list.Many2OneButton',
+ 'field.reference': 'instance.web.list.Reference',
'field.many2many': 'instance.web.list.Many2Many'
});
instance.web.list.columns.for_ = function (id, field, node) {
@@ -2353,5 +2356,18 @@ instance.web.list.Many2Many = instance.web.list.Column.extend({
return this._super(row_data, options);
}
});
+instance.web.list.Reference = instance.web.list.Column.extend({
+ _format: function (row_data, options) {
+ if (!_.isEmpty(row_data[this.id].value)) {
+ // If value, use __display version for printing
+ if (!!row_data[this.id + '__display']) {
+ row_data[this.id] = row_data[this.id + '__display'];
+ } else {
+ row_data[this.id] = {'value': ''};
+ }
+ }
+ return this._super(row_data, options);
+ }
+});
})();
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index 0f529b7554a..fc9af47dfe6 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -53,8 +53,10 @@
});
this.on('edit:after', this, function () {
self.$el.add(self.$buttons).addClass('oe_editing');
+ self.$('.ui-sortable').sortable('disable');
});
this.on('save:after cancel:after', this, function () {
+ self.$('.ui-sortable').sortable('enable');
self.$el.add(self.$buttons).removeClass('oe_editing');
});
},
@@ -275,7 +277,7 @@
if (!this.editor.is_editing()) { return; }
for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {
var item = this.fields_for_resize[i];
- if (!item.field.get('invisible')) {
+ if (!item.field.get('effective_invisible')) {
this.resize_field(item.field, item.cell);
}
}
@@ -441,20 +443,26 @@
setup_events: function () {
var self = this;
_.each(this.editor.form.fields, function(field, field_name) {
- var setting = false;
var set_invisible = function() {
- if (!setting && field.get("effective_readonly")) {
- setting = true;
- field.set({invisible: true});
- setting = false;
- }
+ field.set({'force_invisible': field.get('effective_readonly')});
};
field.on("change:effective_readonly", self, set_invisible);
- field.on("change:invisible", self, set_invisible);
set_invisible();
+ field.on('change:effective_invisible', self, function () {
+ if (field.get('effective_invisible')) { return; }
+ var item = _(self.fields_for_resize).find(function (item) {
+ return item.field === field;
+ });
+ if (item) {
+ setTimeout(function() {
+ self.resize_field(item.field, item.cell);
+ }, 0);
+ }
+
+ });
});
- this.editor.$el.on('keyup keydown', function (e) {
+ this.editor.$el.on('keyup keypress keydown', function (e) {
if (!self.editor.is_editing()) { return true; }
var key = _($.ui.keyCode).chain()
.map(function (v, k) { return {name: k, code: v}; })
@@ -480,6 +488,7 @@
next_record = next_record || 'succ';
var self = this;
return this.save_edition().then(function (saveInfo) {
+ if (!saveInfo) { return null; }
if (saveInfo.created) {
return self.start_edition();
}
@@ -488,7 +497,7 @@
return self.start_edition(record, options);
});
},
- keyup_ENTER: function () {
+ keypress_ENTER: function () {
return this._next();
},
keydown_ESCAPE: function (e) {
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 25a424394bb..82a2095bace 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -331,6 +331,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
action_menu_id: null,
additional_context: {},
});
+
if (action === false) {
action = { type: 'ir.actions.act_window_close' };
} else if (_.isString(action) && instance.web.client_actions.contains(action)) {