summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorDarshan Kalola (OpenERP) <dka@tinyerp.com>2014-03-31 15:02:50 +0530
committerDarshan Kalola (OpenERP) <dka@tinyerp.com>2014-03-31 15:02:50 +0530
commitad99e8cfaebd2d686d48f6d7928ebefaa852d547 (patch)
tree28f6b719c4c250b7397c6a39db260d8e91f5c023 /addons/web/static/src
parent48388c9ad4d338050b065bdc0904a2a09ec225af (diff)
parentfc760dd0d03a07bf0c5833d93b3bcd7566a12e66 (diff)
[MERGE]sync with trunk.
bzr revid: dka@tinyerp.com-20140331093250-wq0tgglwqvlgyw53
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css9
-rw-r--r--addons/web/static/src/css/base.sass7
-rw-r--r--addons/web/static/src/js/chrome.js9
-rw-r--r--addons/web/static/src/js/data.js29
-rw-r--r--addons/web/static/src/js/data_export.js11
-rw-r--r--addons/web/static/src/js/search.js7
-rw-r--r--addons/web/static/src/js/view_form.js9
-rw-r--r--addons/web/static/src/js/view_list.js15
-rw-r--r--addons/web/static/src/xml/base.xml15
9 files changed, 74 insertions, 37 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index e43a2fb654e..6a20442ed41 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");
@@ -2339,10 +2339,9 @@
}
.openerp .oe_form .oe_form_embedded_html {
position: relative;
- width: 600px;
- margin-left: 130px;
- margin-top: 32px;
- margin-bottom: 32px;
+ width: 100%;
+ margin: auto;
+ overflow: auto;
text-align: justify;
}
.openerp .oe_form .oe_form_field_html .oe_input_icon {
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index b19db9e4ebd..38a47eed1c5 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -1893,10 +1893,9 @@ $sheet-padding: 16px
overflow: hidden
.oe_form_embedded_html
position: relative
- width: 600px
- margin-left: 130px
- margin-top: 32px
- margin-bottom: 32px
+ width: 100%
+ margin: auto
+ overflow: auto
text-align: justify
.oe_form_field_html .oe_input_icon
float: right
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 9b87d416206..8e5df84e2c3 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -1337,12 +1337,13 @@ instance.web.WebClient = instance.web.Client.extend({
if (_.isEmpty(state) || state.action == "login") {
self.menu.has_been_loaded.done(function() {
new instance.web.Model("res.users").call("read", [self.session.uid, ["action_id"]]).done(function(data) {
- var first_menu_id = self.menu.$el.find("a:first").data("menu");
- if(first_menu_id)
- self.menu.menu_click(first_menu_id);
-
if(data.action_id) {
self.action_manager.do_action(data.action_id[0]);
+ self.menu.open_action(data.action_id[0]);
+ } else {
+ var first_menu_id = self.menu.$el.find("a:first").data("menu");
+ if(first_menu_id)
+ self.menu.menu_click(first_menu_id);
}
});
});
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index cc595c30688..517afa7f5c2 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -221,11 +221,12 @@ instance.web.QueryGroup = instance.web.Class.extend({
{__context: {group_by: []}, __domain: []},
read_group_group);
+ var raw_field = grouping_field && grouping_field.split(':')[0];
var aggregates = {};
_(fixed_group).each(function (value, key) {
if (key.indexOf('__') === 0
- || key === grouping_field
- || key === grouping_field + '_count') {
+ || key === raw_field
+ || key === raw_field + '_count') {
return;
}
aggregates[key] = value || 0;
@@ -234,7 +235,6 @@ instance.web.QueryGroup = instance.web.Class.extend({
this.model = new instance.web.Model(
model, fixed_group.__context, fixed_group.__domain);
- var raw_field = grouping_field && grouping_field.split(':')[0];
var group_size = fixed_group[raw_field + '_count'] || fixed_group.__count || 0;
var leaf_group = fixed_group.__context.group_by.length === 0;
@@ -448,7 +448,8 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
* Read records.
*
* @param {Array} ids identifiers of the records to read
- * @param {Array} fields fields to read and return, by default all fields are returned
+ * @param {Array} [fields] fields to read and return, by default all fields are returned
+ * @param {Object} [options]
* @returns {$.Deferred}
*/
read_ids: function (ids, fields, options) {
@@ -456,10 +457,20 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
return $.Deferred().resolve([]);
options = options || {};
- // TODO: reorder results to match ids list
return this._model.call('read',
- [ids, fields || false],
- {context: this.get_context(options.context)});
+ [ids, fields || false],
+ {context: this.get_context(options.context)})
+ .then(function (records) {
+ if (records.length <= 1) { return records; }
+ var indexes = {};
+ for (var i = 0; i < ids.length; i++) {
+ indexes[ids[i]] = i;
+ }
+ records.sort(function (a, b) {
+ return indexes[a.id] - indexes[b.id];
+ });
+ return records;
+ });
},
/**
* Read a slice of the records represented by this DataSet, based on its
@@ -904,6 +915,10 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
sign = -1;
field = field.slice(1);
}
+ //m2o should be searched based on value[1] not based whole value(i.e. [id, value])
+ if(_.isArray(a[field]) && a[field].length == 2 && _.isString(a[field][1])){
+ return sign * compare(a[field][1], b[field][1]);
+ }
return sign * compare(a[field], b[field]);
}, 0);
});
diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js
index 2725e18ea6e..252a5a378cc 100644
--- a/addons/web/static/src/js/data_export.js
+++ b/addons/web/static/src/js/data_export.js
@@ -119,6 +119,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
if (select_exp.val()) {
self.exports.unlink([parseInt(select_exp.val(), 10)]);
select_exp.remove();
+ self.$el.find("#fields_list option").remove();
if (self.$el.find('#saved_export_list option').length <= 1) {
self.$el.find('#ExistsExportList').hide();
}
@@ -166,18 +167,16 @@ instance.web.DataExport = instance.web.Dialog.extend({
export_fields: _(fields).map(function (field) {
return [0, 0, {name: field}];
})
- }, function (export_list_id) {
- if (!export_list_id.result) {
+ }).then(function (export_list_id) {
+ if (!export_list_id) {
return;
}
- self.$el.find("#saved_export_list").append(
- new Option(value, export_list_id.result));
- if (self.$el.find("#saved_export_list").is(":hidden")) {
+ if (!self.$el.find("#saved_export_list").length || self.$el.find("#saved_export_list").is(":hidden")) {
self.show_exports_list();
}
+ self.$el.find("#saved_export_list").append( new Option(value, export_list_id) );
});
this.on_show_save_list();
- this.$el.find("#fields_list option").remove();
},
on_click: function(id, record) {
var self = this;
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index b667d135bdd..7c04ad40149 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -355,7 +355,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
}
},
'autocompleteopen': function () {
- this.$el.autocomplete('widget').css('z-index', 1004);
+ this.$el.autocomplete('widget').css('z-index', 9999);
},
},
/**
@@ -677,6 +677,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
* @returns instance.web.search.Field
*/
make_field: function (item, field, parent) {
+ // M2O combined with selection widget is pointless and broken in search views,
+ // but has been used in the past for unsupported hacks -> ignore it
+ if (field.type === "many2one" && item.attrs.widget === "selection"){
+ item.attrs.widget = undefined;
+ }
var obj = instance.web.search.fields.get_any( [item.attrs.widget, field.type]);
if(obj) {
return new (obj) (item, field, parent || this);
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index f1fc377fa94..3dc148bc7c1 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2835,9 +2835,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan
var def;
if (this.field.type === "many2one") {
var model = new openerp.Model(openerp.session, this.field.relation);
- def = model.call("search", [this.get("domain")], {"context": this.build_context()}).then(function(record_ids) {
- return model.call("name_get", [record_ids] , {"context": self.build_context()});
- });
+ def = model.call("name_search", ['', this.get("domain")], {"context": this.build_context()});
} else {
var values = _.reject(this.field.selection, function (v) { return v[0] === false && v[1] === ''; });
def = $.when(values);
@@ -3127,7 +3125,8 @@ instance.web.form.CompletionFieldMixin = {
if (self.options.quick_create === undefined || self.options.quick_create) {
new instance.web.DataSet(this, this.field.relation, self.build_context())
.name_create(name).done(function(data) {
- self.add_id(data[0]);
+ if (!self.get('effective_readonly'))
+ self.add_id(data[0]);
}).fail(function(error, event) {
event.preventDefault();
slow_create();
@@ -5007,7 +5006,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
this.searchview.on('search_data', self, function(domains, contexts, groupbys) {
if (self.initial_ids) {
self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]),
- contexts, groupbys);
+ contexts.concat(self.context), groupbys);
self.initial_ids = undefined;
} else {
self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys);
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index e01ab29f914..7426c70838c 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -408,6 +408,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
if (total) {
var range_start = this.page * limit + 1;
var range_stop = range_start - 1 + limit;
+ if (this.records.length) {
+ range_stop = range_start - 1 + this.records.length;
+ }
if (range_stop > total) {
range_stop = total;
}
@@ -602,7 +605,17 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
_(ids).each(function (id) {
self.records.remove(self.records.get(id));
});
- self.configure_pager(self.dataset);
+ if (self.records.length === 0 && self.dataset.size() > 0) {
+ //Trigger previous manually to navigate to previous page,
+ //If all records are deleted on current page.
+ self.$pager.find('ul li:first a').trigger('click');
+ } else if (self.dataset.size() == self.limit()) {
+ //Reload listview to update current page with next page records
+ //because pager going to be hidden if dataset.size == limit
+ self.reload();
+ } else {
+ self.configure_pager(self.dataset);
+ }
self.compute_aggregates();
});
},
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 80b82c1f40b..7ba06b69095 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -231,17 +231,24 @@
</div>
<table align="center" class="db_option_table">
<tr>
- <td><label for="restore_db">File:</label></td>
- <td><input type="file" name="db_file" class="required" autofocus="autofocus"/></td>
+ <td><label for="restore_pwd">Master Password:</label></td>
+ <td><input type="password" name="restore_pwd" class="required" autofocus="autofocus"/></td>
</tr>
<tr>
- <td><label for="restore_pwd">Master Password:</label></td>
- <td><input type="password" name="restore_pwd" class="required"/></td>
+ <td><label for="restore_db">File:</label></td>
+ <td><input type="file" name="db_file" class="required"/></td>
</tr>
<tr>
<td><label for="new_db">New database name:</label></td>
<td><input type="text" name="new_db" class="required"/></td>
</tr>
+ <tr>
+ <td><label for="mode">Mode:</label></td>
+ <td><select name="mode" class="required">
+ <option value="restore">Backup Restore</option>
+ <option value="copy">Copy of an existing database</option>
+ </select></td>
+ </tr>
</table>
</form>
<form id="db_change_password" name="change_pwd_form" style="display: none;">