[MERGE] forward port of branch saas-2 up to revid 3897 dle@openerp.com-20140115121441-bskbyxxbc09ubavh
bzr revid: chs@openerp.com-20140115221349-3lw7b0kpo3f2d04l
This commit is contained in:
commit
0e870fc7a7
|
@ -109,13 +109,11 @@ def serialize_exception(f):
|
|||
return wrap
|
||||
|
||||
def redirect_with_hash(url, code=303):
|
||||
if request.httprequest.user_agent.browser in ('msie', 'safari'):
|
||||
# Most IE and Safari versions decided not to preserve location.hash upon
|
||||
# redirect. And even if IE10 pretends to support it, it still fails
|
||||
# inexplicably in case of multiple redirects (and we do have some).
|
||||
# See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
|
||||
return "<html><head><script>window.location = '%s' + location.hash;</script></head></html>" % url
|
||||
return werkzeug.utils.redirect(url, code)
|
||||
# Most IE and Safari versions decided not to preserve location.hash upon
|
||||
# redirect. And even if IE10 pretends to support it, it still fails
|
||||
# inexplicably in case of multiple redirects (and we do have some).
|
||||
# See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
|
||||
return "<html><head><script>window.location = '%s' + location.hash;</script></head></html>" % url
|
||||
|
||||
def module_topological_sort(modules):
|
||||
""" Return a list of module names sorted so that their dependencies of the
|
||||
|
|
|
@ -659,6 +659,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;
|
||||
}
|
||||
|
@ -2890,6 +2894,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;
|
||||
}
|
||||
|
|
|
@ -595,6 +595,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
|
||||
|
@ -2304,6 +2307,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
|
||||
// }}}
|
||||
|
|
|
@ -868,7 +868,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");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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') {
|
||||
|
@ -1318,7 +1318,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();
|
||||
},
|
||||
/**
|
||||
|
@ -1489,7 +1490,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
|
||||
|
@ -2131,6 +2133,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) {
|
||||
|
@ -2357,5 +2360,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:
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue