[MERGE] Merged with main web

bzr revid: tde@openerp.com-20120402072422-tsjaxjbfrngqnodp
bzr revid: tde@openerp.com-20120403071448-x3ng76yc17pcy266
This commit is contained in:
Thibault Delavallée 2012-04-03 09:14:48 +02:00
commit 8cefe9a5e1
4 changed files with 53 additions and 36 deletions

View File

@ -104,8 +104,7 @@ html_template = """<!DOCTYPE html>
<script type="text/javascript">
$(function() {
var s = new openerp.init(%(modules)s);
var wc = new s.web.WebClient();
wc.appendTo($(document.body));
%(init)s
});
</script>
</head>
@ -323,6 +322,7 @@ class WebClient(openerpweb.Controller):
'js': js,
'css': css,
'modules': simplejson.dumps(self.server_wide_modules(req)),
'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body));'
}
return r

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-14 15:27+0100\n"
"PO-Revision-Date: 2012-03-29 13:30+0000\n"
"PO-Revision-Date: 2012-04-02 13:15+0000\n"
"Last-Translator: Erwin <Unknown>\n"
"Language-Team: Dutch <nl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-03-30 04:48+0000\n"
"X-Generator: Launchpad (build 15032)\n"
"X-Launchpad-Export-Date: 2012-04-03 05:16+0000\n"
"X-Generator: Launchpad (build 15052)\n"
#. openerp-web
#: addons/web/static/src/js/chrome.js:172
@ -879,7 +879,7 @@ msgstr "OpenERP Enterprise Contract."
#. openerp-web
#: addons/web/static/src/xml/base.xml:257
msgid "Your report will be sent to the OpenERP Enterprise team."
msgstr "Uw rapport wordt verzonden naar het OpenERP Entreprice team."
msgstr "Uw rapport wordt verzonden naar het OpenERP Enterprise team."
#. openerp-web
#: addons/web/static/src/xml/base.xml:259

View File

@ -846,6 +846,8 @@ openerp.web.UserMenu = openerp.web.Widget.extend(/** @lends openerp.web.UserMen
// TODO: Show company if multicompany is in use
var topbar_name = _.str.sprintf("%s (%s)", res.name, openerp.connection.db, res.company_id[1]);
self.$element.find('.oe_topbar_name').text(topbar_name);
var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=avatar&id=%s', self.session.prefix, self.session.session_id, self.session.uid);
$avatar.attr('src', avatar_src);
return self.shortcut_load();
});
};
@ -987,7 +989,7 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
self.$element.toggleClass('clark-gable');
});
}
this.session.bind_session().then(function() {
this.session.session_bind().then(function() {
if (!self.session.session_is_valid()) {
self.show_login();
}
@ -1164,7 +1166,7 @@ openerp.web.embed = function (origin, dbname, login, key, action, options) {
var sc = document.getElementsByTagName('script');
currentScript = sc[sc.length-1];
}
openerp.connection.bind_session(origin).then(function () {
openerp.connection.session_bind(origin).then(function () {
openerp.connection.session_authenticate(dbname, login, key, true).then(function () {
var client = new openerp.web.EmbeddedClient(action, options);
client.insertAfter(currentScript);

View File

@ -383,7 +383,7 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
this.name = openerp._session_id;
this.qweb_mutex = new $.Mutex();
},
bind_session: function(origin) {
session_bind: function(origin) {
var window_origin = location.protocol+"//"+location.host, self=this;
this.origin = origin ? _.str.rtrim(origin,'/') : window_origin;
this.prefix = this.origin;
@ -557,52 +557,67 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
* FIXME: Huge testing hack, especially the evaluation context, rewrite + test for real before switching
*/
test_eval: function (source, expected) {
var match_template = '<ul>' +
'<li>Source: %(source)s</li>' +
'<li>Local: %(local)s</li>' +
'<li>Remote: %(remote)s</li>' +
'</ul>',
fail_template = '<ul>' +
'<li>Error: %(error)s</li>' +
'<li>Source: %(source)s</li>' +
'</ul>';
try {
var ctx = this.test_eval_contexts(source.contexts);
if (!_.isEqual(ctx, expected.context)) {
console.group('Local context does not match remote, nothing is broken but please report to R&D (xmo)');
console.warn('source', source.contexts);
console.warn('local', ctx);
console.warn('remote', expected.context);
console.groupEnd();
openerp.webclient.notification.warn('Context mismatch, report to xmo',
_.str.sprintf(match_template, {
source: JSON.stringify(source.contexts),
local: JSON.stringify(ctx),
remote: JSON.stringify(expected.context)
}), true);
}
} catch (e) {
console.group('Failed to evaluate contexts, nothing is broken but please report to R&D (xmo)');
console.error(e);
console.log('source', source.contexts);
console.groupEnd();
openerp.webclient.notification.warn('Context fail, report to xmo',
_.str.sprintf(fail_template, {
error: e.message,
source: source.contexts
}), true);
}
try {
var dom = this.test_eval_domains(source.domains, this.test_eval_get_context());
if (!_.isEqual(dom, expected.domain)) {
console.group('Local domain does not match remote, nothing is broken but please report to R&D (xmo)');
console.warn('source', source.domains);
console.warn('local', dom);
console.warn('remote', expected.domain);
console.groupEnd();
openerp.webclient.notification.warn('Domains mismatch, report to xmo',
_.str.sprintf(match_template, {
source: JSON.stringify(source.domains),
local: JSON.stringify(dom),
remote: JSON.stringify(expected.domain)
}), true);
}
} catch (e) {
console.group('Failed to evaluate domains, nothing is broken but please report to R&D (xmo)');
console.error(e);
console.log('source', source.domains);
console.groupEnd();
openerp.webclient.notification.warn('Domain fail, report to xmo',
_.str.sprintf(fail_template, {
error: e.message,
source: source.domains
}), true);
}
try {
var groups = this.test_eval_groupby(source.group_by_seq);
if (!_.isEqual(groups, expected.group_by)) {
console.group('Local groupby does not match remote, nothing is broken but please report to R&D (xmo)');
console.warn('source', source.group_by_seq);
console.warn('local', groups);
console.warn('remote', expected.group_by);
console.groupEnd();
openerp.webclient.notification.warn('GroupBy mismatch, report to xmo',
_.str.sprintf(match_template, {
source: JSON.stringify(source.group_by_seq),
local: JSON.stringify(groups),
remote: JSON.stringify(expected.group_by)
}), true);
}
} catch (e) {
console.group('Failed to evaluate groupby, nothing is broken but please report to R&D (xmo)');
console.error(e);
console.log('source', source.group_by_seq);
console.groupEnd();
openerp.webclient.notification.warn('GroupBy fail, report to xmo',
_.str.sprintf(fail_template, {
error: e.message,
source: source.group_by_seq
}), true);
}
},
test_eval_contexts: function (contexts) {