From 3b1627b7a461fb808ac4225ea1f4a7519980fe3c Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 7 Sep 2011 15:05:02 +0200 Subject: [fix] problem with xmo and concept of cleaning actions bzr revid: nicolas.vanhoren@openerp.com-20110907130502-r8a3146hmq8oojvy --- addons/web/controllers/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 3a67a44f710..844eaf9dfea 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -451,8 +451,6 @@ def load_actions_from_ir_values(req, key, key2, models, meta): def clean_action(req, action): action.setdefault('flags', {}) - if action['type'] != 'ir.actions.act_window': - return action context = req.session.eval_context(req.context) eval_ctx = req.session.evaluation_context(context) @@ -464,7 +462,9 @@ def clean_action(req, action): if isinstance(action.get('domain'), basestring): action['domain'] = eval( action['domain'], eval_ctx ) or [] - return fix_view_modes(action) + if action['type'] == 'ir.actions.act_window': + return fix_view_modes(action) + return action # I think generate_views,fix_view_modes should go into js ActionManager def generate_views(action): -- cgit v1.2.3 From b4694f6a91efb1dbd93ed72bbb53cde52a85cc91 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 7 Sep 2011 15:23:20 +0200 Subject: [fix] (x-files mode on) problem with some reports that are not reports (x-files mode off) bzr revid: nicolas.vanhoren@openerp.com-20110907132320-uf2e5a6crjg04r84 --- addons/web/controllers/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 844eaf9dfea..225e55c0591 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1060,8 +1060,11 @@ class Action(openerpweb.Controller): context = req.session.eval_context(req.context) action_type = Actions.read([action_id], ['type'], context) if action_type: - action = req.session.model(action_type[0]['type']).read([action_id], False, - context) + ctx = {} + if action_type[0]['type'] == 'ir.actions.report.xml': + ctx.update({'bin_size': True}) + ctx.update(context) + action = req.session.model(action_type[0]['type']).read([action_id], False, ctx) if action: value = clean_action(req, action[0]) return {'result': value} -- cgit v1.2.3 From ffa4549555f6697e22fc72c2fa9efa8cdb340eb2 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 7 Sep 2011 17:02:57 +0200 Subject: [IMP] cleanup toolbar actions bzr revid: xmo@openerp.com-20110907150257-ewan3jhboq0xe710 --- addons/web/controllers/main.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 225e55c0591..489445deb29 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -762,6 +762,8 @@ class View(openerpweb.Controller): fvg = Model.fields_view_get(view_id, view_type, context, toolbar, submenu) # todo fme?: check that we should pass the evaluated context here self.process_view(req.session, fvg, context, transform) + if toolbar and transform: + self.process_toolbar(req, fvg['toolbar']) return fvg def process_view(self, session, fvg, context, transform): @@ -793,6 +795,17 @@ class View(openerpweb.Controller): if field.get('context'): field["context"] = self.parse_context(field["context"], session) + def process_toolbar(self, req, toolbar): + """ + The toolbar is a mapping of section_key: [action_descriptor] + + We need to clean all those actions in order to ensure correct + round-tripping + """ + for section in toolbar.keys(): + toolbar[section] = [clean_action(req, action) + for action in toolbar[section]] + @openerpweb.jsonrequest def add_custom(self, req, view_id, arch): CustomView = req.session.model('ir.ui.view.custom') -- cgit v1.2.3 From a0a1ea0cfaeb107be1e2f041c33148d8c6133331 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 8 Sep 2011 09:03:09 +0200 Subject: [FIX] cleanup of toolbar actions during fields_view_get bzr revid: xmo@openerp.com-20110908070309-bbwmqxmwmmj06srj --- addons/web/controllers/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 489445deb29..e302f721fc7 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -802,9 +802,14 @@ class View(openerpweb.Controller): We need to clean all those actions in order to ensure correct round-tripping """ - for section in toolbar.keys(): - toolbar[section] = [clean_action(req, action) - for action in toolbar[section]] + for actions in toolbar.itervalues(): + for action in actions: + if 'context' in action: + action['context'] = self.parse_context( + action['context'], req.session) + if 'domain' in action: + action['domain'] = self.parse_domain( + action['domain'], req.session) @openerpweb.jsonrequest def add_custom(self, req, view_id, arch): -- cgit v1.2.3 From e13a97446a56aeb8745ff1563edbc0b7f73f9c70 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 8 Sep 2011 09:14:15 +0200 Subject: [FIX] reports: report_type may be missing from the action descriptor, don't rely on it being there bzr revid: xmo@openerp.com-20110908071415-9gdyvkpwq7i7fxob --- addons/web/controllers/main.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e302f721fc7..647c6155018 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1362,13 +1362,15 @@ class Reports(View): context = req.session.eval_context( openerpweb.nonliterals.CompoundContext( req.context or {}, action[ "context"])) + + report_data = {"id": context["active_id"], "model": context["active_model"]} + if 'report_type' in action: + report_data['report_type'] = action['report_type'] report_id = report_srv.report( req.session._db, req.session._uid, req.session._password, action["report_name"], context["active_ids"], - {"id": context["active_id"], - "model": context["active_model"], - "report_type": action["report_type"]}, - context) + report_data, context) + report_struct = None while True: report_struct = report_srv.report_get( @@ -1384,7 +1386,7 @@ class Reports(View): report_struct['format'], 'octet-stream') return req.make_response(report, headers=[ - ('Content-Disposition', 'attachment; filename="%s.%s"' % (action['report_name'], action['report_type'])), + ('Content-Disposition', 'attachment; filename="%s.%s"' % (action['report_name'], report_struct['format'])), ('Content-Type', report_mimetype), ('Content-Length', len(report))], cookies={'fileToken': int(token)}) -- cgit v1.2.3 From 17d1f78682a15504bf9342c7317f2f68e9608341 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 8 Sep 2011 11:53:27 +0200 Subject: [imp] updated datas in report bzr revid: nicolas.vanhoren@openerp.com-20110908095327-23inv0pjwljyktdl --- addons/web/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 647c6155018..ba86713db43 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1363,9 +1363,11 @@ class Reports(View): openerpweb.nonliterals.CompoundContext( req.context or {}, action[ "context"])) - report_data = {"id": context["active_id"], "model": context["active_model"]} + report_data = {} if 'report_type' in action: report_data['report_type'] = action['report_type'] + if 'datas' in action and 'form' in action['datas']: + report_data['form'] = action['datas']['form'] report_id = report_srv.report( req.session._db, req.session._uid, req.session._password, action["report_name"], context["active_ids"], -- cgit v1.2.3 From 4e0412f0c32947ef62860f848a8f252cd5139f33 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 8 Sep 2011 11:54:11 +0200 Subject: [imp] updated ids in report bzr revid: nicolas.vanhoren@openerp.com-20110908095411-eezf69hw64khlx91 --- addons/web/controllers/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index ba86713db43..5238185f091 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1368,9 +1368,10 @@ class Reports(View): report_data['report_type'] = action['report_type'] if 'datas' in action and 'form' in action['datas']: report_data['form'] = action['datas']['form'] + report_ids = context["active_ids"] report_id = report_srv.report( req.session._db, req.session._uid, req.session._password, - action["report_name"], context["active_ids"], + action["report_name"], report_ids, report_data, context) report_struct = None -- cgit v1.2.3 From cb009f218b7fc6bca057ac931f17fad3738090ee Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 8 Sep 2011 11:55:44 +0200 Subject: [imp] made ids in report overridable by report action bzr revid: nicolas.vanhoren@openerp.com-20110908095544-77pottqwvarnh2gq --- addons/web/controllers/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 5238185f091..922e3ec8e20 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1364,11 +1364,14 @@ class Reports(View): req.context or {}, action[ "context"])) report_data = {} + report_ids = context["active_ids"] if 'report_type' in action: report_data['report_type'] = action['report_type'] - if 'datas' in action and 'form' in action['datas']: - report_data['form'] = action['datas']['form'] - report_ids = context["active_ids"] + if 'datas' in action: + if 'form' in action['datas']: + report_data['form'] = action['datas']['form'] + if 'ids' in action['datas']: + report_ids = action['datas']['ids'] report_id = report_srv.report( req.session._db, req.session._uid, req.session._password, action["report_name"], report_ids, -- cgit v1.2.3 From e60032e11c335472d384921d62c288a84b1ca08a Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 8 Sep 2011 11:59:13 +0200 Subject: [imp] cosmetic change bzr revid: nicolas.vanhoren@openerp.com-20110908095913-pgpcd0flc57umgno --- addons/web/controllers/main.py | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 922e3ec8e20..415db15509d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1372,6 +1372,7 @@ class Reports(View): report_data['form'] = action['datas']['form'] if 'ids' in action['datas']: report_ids = action['datas']['ids'] + report_id = report_srv.report( req.session._db, req.session._uid, req.session._password, action["report_name"], report_ids, -- cgit v1.2.3 From 25237f7178894da666b53d52cd5d47f33523d458 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 9 Sep 2011 16:13:17 +0200 Subject: [IMP] move webrelease into addons/web bzr revid: al@openerp.com-20110909141317-uvo90sxlg8o5w9dx --- addons/web/controllers/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'addons/web/controllers/main.py') diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 415db15509d..c85072d625b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -12,17 +12,18 @@ import textwrap import xmlrpclib import time import zlib -import webrelease from xml.etree import ElementTree from cStringIO import StringIO +from babel.messages.pofile import read_po + import web.common.dispatch as openerpweb import web.common.ast import web.common.nonliterals +import web.common.release openerpweb.ast = web.common.ast openerpweb.nonliterals = web.common.nonliterals -from babel.messages.pofile import read_po # Should move to openerpweb.Xml2Json class Xml2Json: @@ -195,7 +196,7 @@ class WebClient(openerpweb.Controller): @openerpweb.jsonrequest def version_info(self, req): return { - "version": webrelease.version + "version": web.common.release.version } class Database(openerpweb.Controller): -- cgit v1.2.3