From e111336ba6d809ece05bb9c08e1085e2283a70c0 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Mon, 7 Dec 2009 11:56:45 +0100 Subject: [PATCH 01/17] [IMP] Check if the config file exists (only if -c used, and not -s argument in the same time) bzr revid: christophe.chauvet@syleam.fr-20091207105645-9m8qclwrzfbo5cbh --- bin/tools/config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/tools/config.py b/bin/tools/config.py index 2dd6b1131bf..4c6de0bba3c 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -202,6 +202,10 @@ class configmanager(object): die(opt.translate_out and (not opt.db_name), "the i18n-export option cannot be used without the database (-d) option") + # Check if the config file exists (only if -c used, and not -s argument) + die(not opt.save and opt.config and not os.path.exists(opt.config), + "The config file define with (-c) doesn't exists, use (-s) if you want to create it") + # place/search the config file on Win32 near the server installation # (../etc from the server) # if the server is run by an unprivileged user, he has to specify location of a config file where he has the rights to write, From f41e52413326d19db5c7f263b860229f08166913 Mon Sep 17 00:00:00 2001 From: "Cristian Salamea (GnuThink)" <> Date: Sun, 13 Dec 2009 16:16:01 -0200 Subject: [PATCH 02/17] [REF] get rid of the mx.Datetime C dependency, meaning better portability, especially to alternative Python interpreters, better maintainability; implements this blueprint: https://blueprints.launchpad.net/openobject-server/+spec/get-rid-of-mx-datetime-dependency; largely the work of Cristian Salamea (GnuThink) bzr revid: rvalyi@gmail.com-20091213181601-4k4mhtgnv2qynrjo --- bin/addons/base/ir/ir_cron.py | 19 ++++++++++--------- bin/addons/base/res/res_currency.py | 3 --- bin/openerp-server.py | 4 ---- bin/report/printscreen/ps_list.py | 8 ++++---- bin/report/report_sxw.py | 10 +++++----- bin/tools/convert.py | 4 ++-- bin/tools/translate.py | 5 +++-- setup.py | 2 +- 8 files changed, 25 insertions(+), 30 deletions(-) diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py index 3966a816f4f..c30abbfffe9 100644 --- a/bin/addons/base/ir/ir_cron.py +++ b/bin/addons/base/ir/ir_cron.py @@ -20,8 +20,9 @@ # ############################################################################## -from mx import DateTime import time +import datetime +from dateutil.relativedelta import * import netsvc import tools import pooler @@ -31,12 +32,12 @@ def str2tuple(s): return eval('tuple(%s)' % (s or '')) _intervalTypes = { - 'work_days': lambda interval: DateTime.RelativeDateTime(days=interval), - 'days': lambda interval: DateTime.RelativeDateTime(days=interval), - 'hours': lambda interval: DateTime.RelativeDateTime(hours=interval), - 'weeks': lambda interval: DateTime.RelativeDateTime(days=7*interval), - 'months': lambda interval: DateTime.RelativeDateTime(months=interval), - 'minutes': lambda interval: DateTime.RelativeDateTime(minutes=interval), + 'work_days': lambda interval: relativedelta(days=interval), + 'days': lambda interval: relativedelta(days=interval), + 'hours': lambda interval: relativedelta(hours=interval), + 'weeks': lambda interval: relativedelta(days=7*interval), + 'months': lambda interval: relativedelta(months=interval), + 'minutes': lambda interval: relativedelta(minutes=interval), } class ir_cron(osv.osv, netsvc.Agent): @@ -100,10 +101,10 @@ class ir_cron(osv.osv, netsvc.Agent): cr = db.cursor() try: if not pool._init: - now = DateTime.now() + now = datetime.datetime.now() cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority') for job in cr.dictfetchall(): - nextcall = DateTime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') + nextcall = datetime.datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') numbercall = job['numbercall'] ok = False diff --git a/bin/addons/base/res/res_currency.py b/bin/addons/base/res/res_currency.py index 0cd80c141c6..f15566f9075 100644 --- a/bin/addons/base/res/res_currency.py +++ b/bin/addons/base/res/res_currency.py @@ -26,9 +26,6 @@ import ir from tools.misc import currency from tools.translate import _ -import mx.DateTime -from mx.DateTime import RelativeDateTime, now, DateTime, localtime - class res_currency(osv.osv): def _current_rate(self, cr, uid, ids, name, arg, context={}): res={} diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 33b5fef9aeb..f4f8e1e2371 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -79,10 +79,6 @@ for name, value in [('addons_path', tools.config['addons_path']), import time -if sys.platform == 'win32': - import mx.DateTime - mx.DateTime.strptime = lambda x, y: mx.DateTime.mktime(time.strptime(x, y)) - #---------------------------------------------------------- # init net service #---------------------------------------------------------- diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index 2d3ee002633..1496077a2c5 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -29,7 +29,7 @@ import libxslt import locale import time, os -import mx.DateTime +import datetime class report_printscreen_list(report_int): def __init__(self, name): @@ -178,19 +178,19 @@ class report_printscreen_list(report_int): if fields[f]['type'] == 'date' and line[f]: format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')) - d1= mx.DateTime.strptime(line[f],'%Y-%m-%d') + d1 = datetime.datetime.strptime(line[f],'%y-%m-%d') new_d1 = d1.strftime(format) line[f] = new_d1 if fields[f]['type'] == 'time' and line[f]: format = str(locale.nl_langinfo(locale.T_FMT)) - d1= mx.DateTime.strptime(line[f],'%H:%M:%S') + d1 = datetime.datetime.strptime(line[f], '%H:%M:%S') new_d1 = d1.strftime(format) line[f] = new_d1 if fields[f]['type'] == 'datetime' and line[f]: format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))+' '+str(locale.nl_langinfo(locale.T_FMT)) - d1= mx.DateTime.strptime(line[f],'%Y-%m-%d %H:%M:%S') + d1 = datetime.datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S') new_d1 = d1.strftime(format) line[f] = new_d1 diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index f1df81e60bc..987ec9c4b58 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -25,7 +25,7 @@ import cStringIO import base64 import copy import locale -import mx.DateTime +import datetime import os import re import time @@ -109,7 +109,7 @@ class _date_format(str, _format): def __str__(self): if self.val: if hasattr(self,'name') and (self.name): - date = mx.DateTime.strptime(self.name,DT_FORMAT) + date = datetime.datetime.strptime(self.name, DT_FORMAT) return date.strftime(self.lang_obj.date_format) return self.val @@ -121,7 +121,7 @@ class _dttime_format(str, _format): def __str__(self): if self.val: if hasattr(self,'name') and self.name: - datetime = mx.DateTime.strptime(self.name,DHM_FORMAT) + datetime = datetime.strptime(self.name, DHM_FORMAT) return datetime.strftime(self.lang_obj.date_format+ " " + self.lang_obj.time_format) return self.val @@ -262,11 +262,11 @@ class rml_parse(object): if not isinstance(value, time.struct_time): try: - date = mx.DateTime.strptime(str(value),parse_format) + date = datetime.datetime(str(value), parse_format) except:# sometimes it takes converted values into value, so we dont need conversion. return str(value) else: - date = mx.DateTime.DateTime(*(value.timetuple()[:6])) + date = datetime.datetime(*value.timetuple()[:6]) return date.strftime(date_format) return self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 36eb1751c93..73b4d453b76 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -87,10 +87,10 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None): a_eval = node.get('eval','') if len(a_eval): import time - from mx import DateTime + import datetime idref2 = idref.copy() idref2['time'] = time - idref2['DateTime'] = DateTime + idref2['DateTime'] = datetime import release idref2['version'] = release.major_version idref2['ref'] = lambda x: self.id_get(cr, False, x) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 83e90325e70..2b1c7a81946 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -20,6 +20,8 @@ ############################################################################## import os +import datetime + from os.path import join import fnmatch import csv, re @@ -29,7 +31,6 @@ import ir import netsvc from tools.misc import UpdateableStr import inspect -import mx.DateTime as mxdt import tempfile import tarfile import codecs @@ -279,7 +280,7 @@ class TinyPoFile(object): 'version': release.version, 'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""), 'bugmail': release.support_email, - 'now': mxdt.ISO.strUTC(mxdt.ISO.DateTime.utc()), + 'now': datetime.datetime.now().isoformat(' '), } ) diff --git a/setup.py b/setup.py index 1c088b3f8f2..ef8eb4bd72b 100755 --- a/setup.py +++ b/setup.py @@ -184,7 +184,7 @@ options = { "dist_dir": 'dist', "packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree", "lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath", - "encodings","mx.DateTime","wizard","pychart","PIL", "pyparsing", + "encodings","wizard","pychart","PIL", "pyparsing", "pydot","asyncore","asynchat", "reportlab", "vobject", "HTMLParser", "select"], "excludes" : ["Tkconstants","Tkinter","tcl"], From 15b965fb6f19abed1edebdf07a59c2efa0ac2fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 14 Dec 2009 01:10:18 -0200 Subject: [PATCH 03/17] [FIX] correct datetime replacement for mxdt.ISO.strUTC(mxdt.ISO.DateTime.utc()) bzr revid: rvalyi@gmail.com-20091214031018-xxl8l8r9s02jvxva --- bin/tools/translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 2b1c7a81946..99218a91f70 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -280,7 +280,7 @@ class TinyPoFile(object): 'version': release.version, 'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""), 'bugmail': release.support_email, - 'now': datetime.datetime.now().isoformat(' '), + 'now': datetime.datetime.now().isoformat(' ')[0:-7] + '+0000', } ) From 6e2d1e6b710ec3f518f21310e8cb69ff8745e6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 14 Dec 2009 10:23:55 -0200 Subject: [PATCH 04/17] [REF] avoid import * bzr revid: rvalyi@gmail.com-20091214122355-eta5tkktvouxiv6i --- bin/addons/base/ir/ir_cron.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py index c30abbfffe9..f841bdbb759 100644 --- a/bin/addons/base/ir/ir_cron.py +++ b/bin/addons/base/ir/ir_cron.py @@ -22,7 +22,7 @@ import time import datetime -from dateutil.relativedelta import * +from dateutil.relativedelta import relativedelta import netsvc import tools import pooler From 1cbec3a6429f49189ec25ef6dcef9407a16cba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 14 Dec 2009 13:21:04 -0200 Subject: [PATCH 05/17] [REF] changed coding style from datetime.datime.foo to datetime.foo, changing the import accordingly bzr revid: rvalyi@gmail.com-20091214152104-evcck2uv66bbulnf --- bin/addons/base/ir/ir_cron.py | 6 +++--- bin/report/printscreen/ps_list.py | 8 ++++---- bin/report/report_sxw.py | 6 +++--- bin/tools/convert.py | 2 +- bin/tools/translate.py | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py index f841bdbb759..dcf76945904 100644 --- a/bin/addons/base/ir/ir_cron.py +++ b/bin/addons/base/ir/ir_cron.py @@ -21,7 +21,7 @@ ############################################################################## import time -import datetime +from datetime import datetime from dateutil.relativedelta import relativedelta import netsvc import tools @@ -101,10 +101,10 @@ class ir_cron(osv.osv, netsvc.Agent): cr = db.cursor() try: if not pool._init: - now = datetime.datetime.now() + now = datetime.now() cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority') for job in cr.dictfetchall(): - nextcall = datetime.datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') + nextcall = datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') numbercall = job['numbercall'] ok = False diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index 1496077a2c5..a131848cfac 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -29,7 +29,7 @@ import libxslt import locale import time, os -import datetime +from datetime import datetime class report_printscreen_list(report_int): def __init__(self, name): @@ -178,19 +178,19 @@ class report_printscreen_list(report_int): if fields[f]['type'] == 'date' and line[f]: format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')) - d1 = datetime.datetime.strptime(line[f],'%y-%m-%d') + d1 = datetime.strptime(line[f],'%y-%m-%d') new_d1 = d1.strftime(format) line[f] = new_d1 if fields[f]['type'] == 'time' and line[f]: format = str(locale.nl_langinfo(locale.T_FMT)) - d1 = datetime.datetime.strptime(line[f], '%H:%M:%S') + d1 = datetime.strptime(line[f], '%H:%M:%S') new_d1 = d1.strftime(format) line[f] = new_d1 if fields[f]['type'] == 'datetime' and line[f]: format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))+' '+str(locale.nl_langinfo(locale.T_FMT)) - d1 = datetime.datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S') + d1 = datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S') new_d1 = d1.strftime(format) line[f] = new_d1 diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 987ec9c4b58..fafbf4a9172 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -25,7 +25,7 @@ import cStringIO import base64 import copy import locale -import datetime +from datetime import datetime import os import re import time @@ -109,7 +109,7 @@ class _date_format(str, _format): def __str__(self): if self.val: if hasattr(self,'name') and (self.name): - date = datetime.datetime.strptime(self.name, DT_FORMAT) + date = datetime.strptime(self.name, DT_FORMAT) return date.strftime(self.lang_obj.date_format) return self.val @@ -266,7 +266,7 @@ class rml_parse(object): except:# sometimes it takes converted values into value, so we dont need conversion. return str(value) else: - date = datetime.datetime(*value.timetuple()[:6]) + date = datetime(*value.timetuple()[:6]) return date.strftime(date_format) return self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 73b4d453b76..b6ed68f2f11 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -87,7 +87,7 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None): a_eval = node.get('eval','') if len(a_eval): import time - import datetime + from datetime import datetime idref2 = idref.copy() idref2['time'] = time idref2['DateTime'] = datetime diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 99218a91f70..c4dc1bb0617 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -20,7 +20,7 @@ ############################################################################## import os -import datetime +from datetime import datetime from os.path import join import fnmatch @@ -280,7 +280,7 @@ class TinyPoFile(object): 'version': release.version, 'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""), 'bugmail': release.support_email, - 'now': datetime.datetime.now().isoformat(' ')[0:-7] + '+0000', + 'now': datetime.now().isoformat(' ')[0:-7] + '+0000', } ) From d9fbe66f337167bd30ef454b5d6499813cd8d6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 14 Dec 2009 13:21:52 -0200 Subject: [PATCH 06/17] [FIX] added datutil pure Python lib dependency bzr revid: rvalyi@gmail.com-20091214152152-3mfngzhagcpl47u6 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ef8eb4bd72b..3d9bbd8154d 100755 --- a/setup.py +++ b/setup.py @@ -184,7 +184,7 @@ options = { "dist_dir": 'dist', "packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree", "lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath", - "encodings","wizard","pychart","PIL", "pyparsing", + "encodings","dateutil","wizard","pychart","PIL", "pyparsing", "pydot","asyncore","asynchat", "reportlab", "vobject", "HTMLParser", "select"], "excludes" : ["Tkconstants","Tkinter","tcl"], From b53e15b5768674bbd4f0b16c62d1f8ac2153c7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Fri, 25 Dec 2009 16:03:29 -0200 Subject: [PATCH 07/17] [FIX] translate; Launchpad export: time is now UTC and we use a clean strftime rather than a hacky split/concat, output is exactly the same as mx.Datetime bzr revid: rvalyi@gmail.com-20091225180329-a22s8o5lr5qw4qr2 --- bin/tools/translate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 3d5bd754f1a..b62dc61f1c6 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -21,6 +21,7 @@ import os from datetime import datetime +from dateutil.tz import tzutc from os.path import join import fnmatch @@ -280,7 +281,7 @@ class TinyPoFile(object): 'version': release.version, 'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""), 'bugmail': release.support_email, - 'now': datetime.now().isoformat(' ')[0:-7] + '+0000', + 'now': datetime.now(tzutc()).strftime('%Y-%m-%d %H:%M:%S%z'), } ) From 855d0fc82fda483ab6433fc25f3b05ed2f78f682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 1 Feb 2010 10:59:01 -0200 Subject: [PATCH 08/17] [FIX] replaced last mx package reference in setup.py by dateutil reference bzr revid: rvalyi@gmail.com-20100201125901-1xgcilmb3rrildeo --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 18899806fcd..553cfd126ce 100755 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ py_short_version = '%s.%s' % sys.version_info[:2] required_modules = [ ('lxml', 'lxml module: pythonic libxml2 and libxslt bindings'), ('mako', 'Mako template engine'), - ('mx', "egenix's mx library for its extended DateTime module"), + ('dateutil', "Labix powerful extensions to the standard datetime module"), ('psycopg2', 'PostgreSQL module'), ('pychart', 'pychart module'), ('pydot', 'pydot module'), From fe3562a57bd6b2379d4f4cdb48d72535432a2039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 1 Feb 2010 10:59:44 -0200 Subject: [PATCH 09/17] [REF] use datetime.utcnow() rather than having to import: from dateutil.tz import tzutc bzr revid: rvalyi@gmail.com-20100201125944-lpr1ijeg2zmkadmv --- bin/tools/translate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index b62dc61f1c6..da718f0d9d1 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -21,7 +21,6 @@ import os from datetime import datetime -from dateutil.tz import tzutc from os.path import join import fnmatch @@ -281,7 +280,7 @@ class TinyPoFile(object): 'version': release.version, 'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""), 'bugmail': release.support_email, - 'now': datetime.now(tzutc()).strftime('%Y-%m-%d %H:%M:%S%z'), + 'now': datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S%z')+"+0000", } ) From 286479e7ef2bbd40ba97f25243bc6fec257b7d97 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Mon, 1 Feb 2010 18:43:27 +0530 Subject: [PATCH 10/17] [IMP] caldav: xml file of calendar data bzr revid: hmo@tinyerp.com-20100201131327-oxpgu1y65fqik1cz --- addons/base_calendar/base_calendar_data.xml | 5 +- addons/caldav/caldav.py | 3 +- addons/caldav/caldav_data.xml | 376 --------------- addons/crm/crm_meeting_data.xml | 299 +++++++++++- .../project_calendar_data.xml | 428 +++++++++++++++++- 5 files changed, 708 insertions(+), 403 deletions(-) diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index 0e7250071c8..b15cd72874e 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -1,10 +1,7 @@ - + - - OpenERP - diff --git a/addons/caldav/caldav.py b/addons/caldav/caldav.py index 5741f645b1e..5598236dd48 100644 --- a/addons/caldav/caldav.py +++ b/addons/caldav/caldav.py @@ -483,7 +483,8 @@ rule or repeating pattern for anexception to a recurrence set"), 'caldav_alarm_id': fields.many2one('calendar.alarm', 'Alarm'), 'recurrent_uid': fields.integer('Recurrent ID'), 'recurrent_id': fields.datetime('Recurrent ID date'), - } + 'user_id': fields.many2one('res.users', 'Responsible'), + } _defaults = { 'class': lambda *a: 'public', diff --git a/addons/caldav/caldav_data.xml b/addons/caldav/caldav_data.xml index 295b05ba540..c8b20ac134b 100644 --- a/addons/caldav/caldav_data.xml +++ b/addons/caldav/caldav_data.xml @@ -129,381 +129,5 @@ - - - vevent - - - - - - vtodo - - - - - - valarm - - - - - - attendee - - - - - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - - - - - field - - - diff --git a/addons/crm/crm_meeting_data.xml b/addons/crm/crm_meeting_data.xml index 789708c6a35..09566903d1c 100644 --- a/addons/crm/crm_meeting_data.xml +++ b/addons/crm/crm_meeting_data.xml @@ -25,33 +25,101 @@ Case Meeting crm.meeting - + + - + + + + meeting + + + vevent + [('user_id','=', uid)] + + + + valarm + + + + attendee + + + + + + + + + + + field + - + + + + + field + - + field - + + + + + + field + - + + + + + field + + + + + + + field + + + field - + - + + + + + + field + + + + + + + field + + + @@ -59,5 +127,220 @@ field + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + diff --git a/addons/project_calendar/project_calendar_data.xml b/addons/project_calendar/project_calendar_data.xml index e4c333ca6e2..63b5e99333a 100644 --- a/addons/project_calendar/project_calendar_data.xml +++ b/addons/project_calendar/project_calendar_data.xml @@ -1,13 +1,17 @@ - - - vtodo - - + + meeting_todo + + vtodo + + + [('user_id','=', uid)] + + @@ -15,34 +19,430 @@ {'needs-action': 'draft', 'completed': 'done', 'in-process': 'open', 'cancelled': 'cancelled'} field - - + + + + + + field + + + field - - + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + field - - + + + + + + field + + + field - - + + + + + + field + + + + + + + field + + + hours + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + vevent + + + [('user_id','=', uid)] + + + + valarm + + + + + + attendee + + + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + field + + + + + + + field + + + + + + + {'tentative': 'draft', 'confirmed': 'open', 'cancelled': 'cancel'} + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + - \ No newline at end of file + From 489aea8520945e1b2925b6b1eb172a664f46a05f Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Mon, 1 Feb 2010 19:01:10 +0530 Subject: [PATCH 11/17] [IMP]:Survey:Ref.YSA * Improved the code and changes in view,fix bug in report and response wizard. bzr revid: apa@tinyerp.com-20100201133110-de1jvtbom7t06iks --- .../survey/report/survey_analysis_report.py | 2 + .../survey/report/survey_browse_response.py | 12 +++--- addons/survey/survey.py | 22 ++++++---- addons/survey/survey_view.xml | 41 ++++++++++--------- 4 files changed, 43 insertions(+), 34 deletions(-) diff --git a/addons/survey/report/survey_analysis_report.py b/addons/survey/report/survey_analysis_report.py index 79871a63084..069488034d8 100755 --- a/addons/survey/report/survey_analysis_report.py +++ b/addons/survey/report/survey_analysis_report.py @@ -257,6 +257,8 @@ class survey_analysis(report_rml): sqc.question_id = sr.question_id and sra.answer_id = %d and sqc.title ='%s'\ group by sra.answer_id,sqc.rating_weight" % (ans.id,matrix_ans[mat_col])) col_weight = cr.fetchone() + if not col_weight : + col_weight= (0,0) res_count = col_weight[0] if tot_res: rating_weight_sum += col_weight[1] * tot_res diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py index 26ac0e54103..6e26f21e5b3 100644 --- a/addons/survey/report/survey_browse_response.py +++ b/addons/survey/report/survey_browse_response.py @@ -268,7 +268,7 @@ class survey_browse_response(report_rml): """ elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','rating_scale','matrix_of_drop_down_menus']: if len(answer) and answer[0].state == "done": - if que.comment_column: + if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column: pass cols_widhts = [] cols_widhts.append(200) @@ -278,7 +278,7 @@ class survey_browse_response(report_rml): tmp=0.0 sum = 0.0 i = 0 - if que.comment_column: + if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column: for col in cols_widhts: if i==0: cols_widhts[i] = cols_widhts[i]/2.0 @@ -292,7 +292,7 @@ class survey_browse_response(report_rml): if col.title not in matrix_ans: matrix_ans.append(col.title) len_matrix = len(matrix_ans) - if que.comment_column: + if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column: matrix_ans.append(que.column_name) rml+="""""" for mat_col in matrix_ans: @@ -342,14 +342,14 @@ class survey_browse_response(report_rml): """ rml+= """""" + value + """""" - if que.comment_column: + if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column: if comment_value=='False': comment_value = '' rml+= """"""+ to_xml(tools.ustr(comment_value)) + """""" rml+=""" """ - if que.comment_field_type: + if que.is_comment_require: rml+=""" - """ + to_xml(tools.ustr(answer[0].comment)) + """""" + """ + to_xml(tools.ustr(answer[0].comment or '')) + """""" else: rml +=""" No Response diff --git a/addons/survey/survey.py b/addons/survey/survey.py index c6a4a1daf2b..632f4c768ef 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -331,9 +331,9 @@ class survey_question(osv.osv): raise osv.except_osv(_('Error !'),_("Maximum Required Answer is greater than Minimum Required Answer")) if question['type'] == 'matrix_of_drop_down_menus' and vals.has_key('column_heading_ids'): for col in vals['column_heading_ids']: - if col[2].has_key('menu_choice') and not col[2]['menu_choice']: + if col[2] and col[2].has_key('menu_choice') and not col[2]['menu_choice']: raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading")) - elif col[2].has_key('menu_choice') and col[2]['menu_choice'].strip() == '': + elif col[2] and col[2].has_key('menu_choice') and col[2]['menu_choice'].strip() == '': raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading (white spaces not allowed)")) return super(survey_question, self).write(cr, uid, ids, vals, context=context) @@ -740,24 +740,28 @@ class survey_question_wiz(osv.osv_memory): fields[tools.ustr(que) + "_commentcolumn_"+tools.ustr(row['id']) + "_field"] = {'type':'char', 'size' : 255, 'string':tools.ustr(que_rec['column_name']), 'views':{}} etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_commentcolumn_"+tools.ustr(row['id'])+ "_field"}) elif que_rec['type'] == 'matrix_of_choices_only_multi_ans': - xml_group = etree.SubElement(xml_group, 'group', {'col': '2', 'colspan': '2'}) + xml_group = etree.SubElement(xml_group, 'group', {'col': str(len(que_rec['column_heading_ids']) + 1), 'colspan': '4'}) + etree.SubElement(xml_group, 'separator', {'string': '.','colspan': '1'}) + for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): + etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col['title']),'colspan': '1'}) for row in ans_ids: etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(row['answer'])) +' :-', 'align': '0.0'}) - etree.SubElement(xml_group, 'newline') for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): - etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['title'])}) + etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['title']), 'nolabel':"1"}) fields[tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['title'])] = {'type':'boolean', 'string': col['title']} elif que_rec['type'] == 'matrix_of_drop_down_menus': - xml_group = etree.SubElement(xml_group, 'group', {'col': '2', 'colspan': '2'}) + xml_group = etree.SubElement(xml_group, 'group', {'col': str(len(que_rec['column_heading_ids']) + 1), 'colspan': '4'}) + etree.SubElement(xml_group, 'separator', {'string': '.','colspan': '1'}) + for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): + etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col['title']),'colspan': '1'}) for row in ans_ids: etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(row['answer']))+' :-', 'align': '0.0'}) - etree.SubElement(xml_group, 'newline') for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): selection = [] if col['menu_choice']: for item in col['menu_choice'].split('\n'): if item and not item.strip() == '': selection.append((item ,item)) - etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['title'])}) + etree.SubElement(xml_group, 'field', {'name': tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['title']),'nolabel':'1'}) fields[tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['title'])] = {'type':'selection', 'string': col['title'], 'selection':selection} elif que_rec['type'] == 'multiple_textboxes': xml_group = etree.SubElement(xml_group, 'group', {'col': '1', 'colspan': '4'}) @@ -1238,7 +1242,7 @@ class survey_question_wiz(osv.osv_memory): numeric_sum += int(val) elif val and len(key.split('_')) == 3: resp_obj.write(cr, uid, update, {'state': 'done'}) - if type(val) == type(''): + if type(val) == type('') or type(val) == type(u''): ans_create_id = res_ans_obj.create(cr, uid, {'response_id':update, 'answer_id':ans_id_len[1], 'answer' : ans_id_len[2], 'value_choice' : val}) sur_name_read['store_ans'][update].update({key:val}) else: diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 70b41b589fe..5085ed4986d 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -30,7 +30,7 @@