From 7903073794fdeafa04457b424106c533aff9dba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 20 May 2008 16:18:27 +0200 Subject: [PATCH 1/4] Add datetime in report context --- trytond/report/report.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/report/report.py b/trytond/report/report.py index 6f6e295437..3e9d800a2c 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -12,6 +12,7 @@ import zipfile import locale import time import os +import datetime MODULE_LIST = [] MODULE_CLASS_LIST = {} @@ -323,6 +324,7 @@ class Report(object): self.format_lang(value, digits=digits, date=date, localcontext=localcontext) ctx['time'] = time + ctx['datetime'] = datetime try: res = eval(node.nodeValue, ctx) except: From f5c529dcc16b291113d302626d37fa596b1b39dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 20 May 2008 16:54:32 +0200 Subject: [PATCH 2/4] Catch all Exception --- trytond/netsvc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trytond/netsvc.py b/trytond/netsvc.py index 7f5eee9467..e8b65182d0 100644 --- a/trytond/netsvc.py +++ b/trytond/netsvc.py @@ -178,7 +178,7 @@ class GenericXMLRPCRequestHandler: meth = getattr(service, method) res = meth(*params) return res - except Exception, exp: + except: tb_s = reduce(lambda x, y: x+y, traceback.format_exception( sys.exc_type, sys.exc_value, sys.exc_traceback)) for path in sys.path: @@ -187,7 +187,7 @@ class GenericXMLRPCRequestHandler: import pdb traceb = sys.exc_info()[2] pdb.post_mortem(traceb) - raise xmlrpclib.Fault(str(exp), tb_s) + raise xmlrpclib.Fault(str(sys.exc_value), tb_s) class SimpleXMLRPCRequestHandler(GenericXMLRPCRequestHandler, @@ -353,7 +353,7 @@ class TinySocketClientThread(threading.Thread): method = getattr(service, msg[1]) res = method(*msg[2:]) pysocket.send(res) - except Exception, exp: + except: tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) @@ -363,7 +363,7 @@ class TinySocketClientThread(threading.Thread): import pdb tback = sys.exc_info()[2] pdb.post_mortem(tback) - pysocket.send(str(exp), exception=True, traceback=tb_s) + pysocket.send(str(sys.exc_value), exception=True, traceback=tb_s) pysocket.disconnect() self.threads.remove(self) return True @@ -412,7 +412,7 @@ class TinySocketServerThread(threading.Thread): self.threads.append(c_thread) c_thread.start() self.socket.close() - except Exception, exp: + except: self.socket.close() return False From cab8fc8deb4c6f03797a8ed8c48cc74daf1cb8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 20 May 2008 17:37:02 +0200 Subject: [PATCH 3/4] Add window name boolean on act_window It allow to not use the action name as the window name but use the view string --- trytond/ir/action.py | 16 ++++++++++------ trytond/ir/action.xml | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/trytond/ir/action.py b/trytond/ir/action.py index fb8563ec88..e59d22d551 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -256,18 +256,19 @@ class ActionActWindow(OSV): ('tree','Tree'), ('form','Form'), ('board', 'Board'), - ], - string='Type of view') + ], string='Type of view') usage = fields.Char('Action Usage', size=32) act_window_views = fields.One2Many('ir.action.act_window.view', - 'act_window', 'Views') + 'act_window', 'Views') views = fields.Function('views_get_fnc', type='binary', - string='Views') + string='Views') limit = fields.Integer('Limit', - help='Default limit for the list view') + help='Default limit for the list view') auto_refresh = fields.Integer('Auto-Refresh', - help='Add an auto-refresh on the view') + help='Add an auto-refresh on the view') action = fields.Many2One('ir.action', 'Action', required=True) + window_name = fields.Boolean('Window Name', required=True, + help='Use the action name as window name') def default_type(self, cursor, user, context=None): return 'ir.action.act_window' @@ -284,6 +285,9 @@ class ActionActWindow(OSV): def default_auto_refresh(self, cursor, user, context=None): return 0 + def default_window_name(self, cursor, user, context=None): + return True + def views_get_fnc(self, cursor, user, ids, name, arg, context=None): res = {} for act in self.browse(cursor, user, ids, context=context): diff --git a/trytond/ir/action.xml b/trytond/ir/action.xml index fa715c50ad..cc86850160 100644 --- a/trytond/ir/action.xml +++ b/trytond/ir/action.xml @@ -163,9 +163,11 @@