[MERGE] Sync with saas-2

bzr revid: tde@openerp.com-20131021104729-8c39qu7pr431cb51
bzr revid: tde@openerp.com-20131023113825-u1uqcu07bt6i17rk
This commit is contained in:
Thibault Delavallée 2013-10-23 13:38:25 +02:00
commit b7a7cf5fb9
9 changed files with 30 additions and 15 deletions

View File

@ -529,12 +529,14 @@ class Home(http.Controller):
def index(self, s_action=None, db=None, debug=False, **kw):
debug = debug != False
lst = http.db_list(True)
try:
lst = http.db_list()
except openerp.exceptions.AccessDenied:
lst = []
if db not in lst:
db = None
guessed_db = http.db_monodb(request.httprequest)
if guessed_db is None and len(lst) > 0:
guessed_db = lst[0]
def redirect(db):
query = dict(urlparse.parse_qsl(request.httprequest.query_string, keep_blank_values=True))
@ -542,8 +544,11 @@ class Home(http.Controller):
redirect = request.httprequest.path + '?' + urllib.urlencode(query)
return redirect_with_hash(redirect)
if db is None and guessed_db is not None:
return redirect(guessed_db)
if guessed_db is None and db is None and lst:
return redirect(lst[0])
if guessed_db is None and lst:
guessed_db = lst[0]
if db is not None and db != guessed_db:
request.session.logout()

View File

@ -189,6 +189,8 @@ class WebRequest(object):
def auth_method_user():
request.uid = request.session.uid
if not request.uid:
raise SessionExpiredException("Session expired")
def auth_method_admin():
if not request.db:

View File

@ -1453,7 +1453,7 @@
display: table-row;
height: inherit;
}
.openerp .oe_view_manager .oe_view_manager_view_kanban {
.openerp .oe_view_manager .oe_view_manager_view_kanban:not(:empty) {
height: inherit;
}
.openerp .oe_view_manager table.oe_view_manager_header {

View File

@ -1169,7 +1169,7 @@ $sheet-padding: 16px
.oe_view_manager_body
display: table-row
height: inherit
.oe_view_manager_view_kanban
.oe_view_manager_view_kanban:not(:empty)
height: inherit
table.oe_view_manager_header

View File

@ -1547,7 +1547,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
context: context
}).then(function (results) {
if (_.isEmpty(results)) { return null; }
return [{label: _.escape(self.attrs.string)}].concat(
return [{label: self.attrs.string}].concat(
_(results).map(function (result) {
return {
label: _.escape(result[1]),
@ -1733,7 +1733,10 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
var $name = this.$('input:first');
var private_filter = !this.$('#oe_searchview_custom_public').prop('checked');
var set_as_default = this.$('#oe_searchview_custom_default').prop('checked');
if (_.isEmpty($name.val())){
this.do_warn(_t("Error"), _t("Filter name is required."));
return false;
}
var search = this.view.build_search_data();
instance.web.pyeval.eval_domains_and_contexts({
domains: search.domains,

View File

@ -3664,7 +3664,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
_.extend(view.options, {
addable: null,
selectable: self.multi_selection,
sortable: false,
sortable: true,
import_enabled: false,
deletable: true
});

View File

@ -508,10 +508,15 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
var reloaded = $.Deferred();
this.$el.find('.oe_list_content').append(
this.groups.render(function () {
if ((self.dataset.index === null || self.dataset.index === undefined) && self.records.length ||
self.dataset.index >= self.records.length) {
// Keep '=='. This is not a mistake, this is a wanted behaviour to match null & undefined
if (self.dataset.index == null) {
if (self.records.length) {
self.dataset.index = 0;
}
} else if (self.dataset.index >= self.records.length) {
self.dataset.index = 0;
}
self.compute_aggregates();
reloaded.resolve();
}));

View File

@ -1664,8 +1664,8 @@
<ul class="oe_searchview_custom_list"/>
<div class="oe_searchview_custom">
<h4>Save current filter</h4>
<form>
<p><input id="oe_searchview_custom_input" placeholder="Filter name"/></p>
<form class="oe_form">
<p class="oe_form_required"><input id="oe_searchview_custom_input" placeholder="Filter name"/></p>
<p>
<input id="oe_searchview_custom_public" type="checkbox"/>
<label for="oe_searchview_custom_public">Share with all users</label>

View File

@ -1293,7 +1293,7 @@ openerp.testing.section('search.filters.saved', {
return view.appendTo($fix)
.then(function () {
$fix.find('.oe_searchview_custom input#oe_searchview_custom_input')
.text("filter name")
.val("filter name")
.end()
.find('.oe_searchview_custom button').click();
return done.promise();