[MERGE] evalpocalypse-related fixes

bzr revid: xmo@openerp.com-20121129091202-tibeevirun95o1mi
This commit is contained in:
Xavier Morel 2012-11-29 10:12:02 +01:00
commit 106100eea0
10 changed files with 29 additions and 39 deletions

View File

@ -14,7 +14,7 @@ class ImportController(openerp.addons.web.http.Controller):
'file': file.read(),
'file_name': file.filename,
'file_type': file.content_type,
}, req.session.eval_context(req.context))
}, req.context)
return 'window.top.%s(%s)' % (
jsonp, simplejson.dumps({'result': written}))

View File

@ -2,7 +2,6 @@
from xml.etree import ElementTree
import openerp
from openerp.addons.web import nonliterals
from openerp.addons.web.controllers.main import load_actions_from_ir_values
class Board(openerp.addons.web.http.Controller):
@ -11,16 +10,8 @@ class Board(openerp.addons.web.http.Controller):
@openerp.addons.web.http.jsonrequest
def add_to_dashboard(self, req, menu_id, action_id, context_to_save, domain, view_mode, name=''):
# FIXME move this method to board.board model
to_eval = nonliterals.CompoundContext(context_to_save)
to_eval.session = req.session
ctx = dict((k, v) for k, v in to_eval.evaluate().iteritems()
if not k.startswith('search_default_'))
ctx['dashboard_merge_domains_contexts'] = False # TODO: replace this 6.1 workaround by attribute on <action/>
domain = nonliterals.CompoundDomain(domain)
domain.session = req.session
domain = domain.evaluate()
dashboard_action = load_actions_from_ir_values(req, 'action', 'tree_but_open', [('ir.ui.menu', menu_id)], False)
dashboard_action = load_actions_from_ir_values(
req, 'action', 'tree_but_open', [('ir.ui.menu', menu_id)], False)
if dashboard_action:
action = dashboard_action[0][2]
@ -36,7 +27,7 @@ class Board(openerp.addons.web.http.Controller):
'name': str(action_id),
'string': name,
'view_mode': view_mode,
'context': str(ctx),
'context': str(context_to_save),
'domain': str(domain)
})
column.insert(0, new_action)
@ -45,6 +36,6 @@ class Board(openerp.addons.web.http.Controller):
'user_id': req.session._uid,
'ref_id': view_id,
'arch': arch
}, req.session.eval_context(req.context))
}, req.context)
return False

View File

@ -375,11 +375,22 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
var domain = new instance.web.CompoundDomain(getParent.dataset.get_domain() || []);
_.each(data.contexts, context.add, context);
_.each(data.domains, domain.add, domain);
var c = instance.web.pyeval.eval('context', context);
for(var k in c) {
if (c.hasOwnProperty(k) && /^search_default_/.test(k)) {
delete c[k];
}
}
// TODO: replace this 6.1 workaround by attribute on <action/>
c.dashboard_merge_domains_contexts = false;
var d = instance.web.pyeval.eval('domain', domain);
this.rpc('/board/add_to_dashboard', {
menu_id: this.$el.find("select").val(),
action_id: view_parent.action.id,
context_to_save: context,
domain: domain,
context_to_save: c,
domain: d,
view_mode: view_parent.active_view,
name: this.$el.find("input").val()
}).done(function(r) {

View File

@ -23,10 +23,9 @@ class EDI(openerpweb.Controller):
@openerpweb.jsonrequest
def import_edi_url(self, req, url):
context = req.session.eval_context(req.context)
result = req.session.proxy('edi').import_edi_url(req.session._db, req.session._uid, req.session._password, url)
if len(result) == 1:
return {"action": webmain.clean_action(req, result[0][2], context)}
return {"action": webmain.clean_action(req, result[0][2])}
return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1632,7 +1632,7 @@ openerp.mail = function (session) {
*/
do_searchview_search: function (domains, contexts, groupbys) {
var self = this;
this.rpc('/web/session/eval_domain_and_context', {
session.web.pyeval.eval_domains_and_contexts({
domains: domains || [],
contexts: contexts || [],
group_by_seq: groupbys || []

View File

@ -12,7 +12,7 @@ openerp.share = function(session) {
}
if (view.fields_view.type == 'form') rec_name = view.datarecord.name;
else rec_name = '';
self.rpc('/web/session/eval_domain_and_context', {
session.web.pyeval.eval_domains_and_contexts({
domains: [domain],
contexts: [view.dataset.context]
}).done(function (result) {

View File

@ -17,6 +17,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,3 +0,0 @@
import main
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,11 +0,0 @@
import openerp
class Shortcuts(openerp.addons.web.http.Controller):
_cp_path = "/web/shortcuts"
@openerp.addons.web.http.jsonrequest
def list(self, req):
return req.session.model('ir.ui.view_sc').get_sc(
req.session._uid, "ir.ui.menu", req.session.eval_context(req.context))
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -33,7 +33,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
this.on('display', this, this.display);
this.on('remove', this, this.remove);
this.on('click', this, this.click);
this.dataset = new instance.web.DataSet(this, 'ir.ui.view_sc');
this.model = new instance.web.Model('ir.ui.view_sc');
},
start: function() {
var self = this;
@ -46,7 +46,11 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
load: function() {
var self = this;
this.$el.find('.oe_systray_shortcuts_items').empty();
return this.rpc('/web/shortcuts/list', {}).done(function(shortcuts) {
return this.model.call('get_sc', [
instance.session.uid,
'ir.ui.menu',
instance.web.pyeval.eval('context', {})
]).done(function(shortcuts) {
_.each(shortcuts, function(sc) {
self.trigger('display', sc);
});
@ -54,7 +58,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
},
add: function (sc) {
var self = this;
this.dataset.create(sc).then(function(out){
this.model.call('create', [sc]).then(function(out){
self.trigger('load');
});
},
@ -69,7 +73,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
var $shortcut = this.$el.find('.oe_systray_shortcuts_items li a[data-id=' + menu_id + ']');
var shortcut_id = $shortcut.data('shortcut-id');
$shortcut.remove();
this.dataset.unlink([shortcut_id]);
this.model.call('unlink', [shortcut_id]);
},
click: function($link) {
var self = this,