diff --git a/CHANGELOG b/CHANGELOG index e7cb59ece6..72c3b15b42 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,9 @@ * Remove use of python code in workflow XML +* Use SQL sequence on PostgreSQL for ir.sequence +* Allow to specify more than one interface +* Use unoconv for report format conversion +* Allow to use any Opendocument as report template +* Drop NetRPC and activate JSON-RPC by default * Remove ir.action.wizard_size * Rename expand and fill attributes into yexpand and yfill * Add xalign and yalign as field attributes diff --git a/COPYRIGHT b/COPYRIGHT index 6c994d4a71..231a7a99bc 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -2,6 +2,7 @@ Copyright (C) 2004-2008 Tiny SPRL. Copyright (C) 2007-2011 Cédric Krier. Copyright (C) 2007-2011 Bertrand Chenal. Copyright (C) 2008-2011 B2CK SPRL. +Copyright (C) 2011 Openlabs Technologies & Consulting (P) Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/doc/topics/install.rst b/doc/topics/install.rst index ed496ac66a..dfa3832437 100644 --- a/doc/topics/install.rst +++ b/doc/topics/install.rst @@ -17,7 +17,7 @@ Prerequisites * Optional: pywebdav 0.9.3 or later (http://code.google.com/p/pywebdav/) * Optional: pydot (http://code.google.com/p/pydot/) * Optional: pytz (http://pytz.sourceforge.net/) - * Optional: openoffice-python (http://pypi.python.org/pypi/openoffice-python/) + * Optional: unoconv http://dag.wieers.com/home-made/unoconv/) * Optional: sphinx (http://sphinx.pocoo.org/) Install Tryton diff --git a/doc/topics/reports/index.rst b/doc/topics/reports/index.rst index 96a70b11ad..7adeab0f2a 100644 --- a/doc/topics/reports/index.rst +++ b/doc/topics/reports/index.rst @@ -74,6 +74,8 @@ When defining an `ir.action.report` the following attributes are available: example, my_module/my_style.odt. If no style is to be used this field will be blank. + * ``template_extension``: The template format. + Report Usage ============ @@ -211,6 +213,7 @@ Then you must activate the new invoice report that exists in your new module: account.invoice my_module/invoice.odt module_name/header_A4.odt + odt Passing custom data to a report diff --git a/etc/trytond.conf b/etc/trytond.conf index f99ac12a04..d706c48199 100644 --- a/etc/trytond.conf +++ b/etc/trytond.conf @@ -3,33 +3,22 @@ [options] # This is the hostname used when generating tryton URI -#hostname = - -# Configure the IP address for trytond -# If empty, the server will listen on all available interfaces -#interface = - -# Activate the netrpc protocol -#netrpc = True -# Configure the port for the netrpc protocol to listen -#netport = 8070 - -# Activate the xml-rpc protocol -#xmlrpc = False -# Configure the port for the xml-rpc protocol to listen -#xmlport = 8069 +#hostname = # Activate the json-rpc protocol -#jsonrpc = False -# Configure the port for the json-rpc protocol to listen -#jsonport = 8000 +jsonrpc = localhost:8000 +#ssl_jsonrpc = False + # Configure the path of json-rpc data #jsondata_path = /var/www/localhost/tryton +# Activate the xml-rpc protocol +#xmlrpc = *:8069 +#ssl_xmlrpc = False + # Activate the webdav protocol -#webdav = False -# Configure the port for the webdav protocol to listen -#webdavport = 8080 +#webdav = *:8080 +#ssl_webdav = False # Configure the database type # allowed values are postgresql, sqlite, mysql @@ -56,11 +45,6 @@ #pidfile = False #logfile = False -# Enable secure connection with SSL -#secure_netrpc = False -#secure_xmlrpc = False -#secure_jsonrpc = False -#secure_webdav = False #privatekey = server.pem #certificate = server.pem @@ -75,9 +59,6 @@ # Configure the path to store attachments and sqlite database #data_path = /var/lib/trytond -# Limit the number of threads -#max_thread = 40 - # Allow to run more than one instance of trytond #multi_server = False @@ -96,3 +77,6 @@ # Enable cron # cron = True + +# unoconv connection +#unoconv = pipe,name=trytond;urp;StarOffice.ComponentContext diff --git a/setup.py b/setup.py index e21a377c6b..004c7b1dc8 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ setup(name=PACKAGE, 'PostgreSQL': ['psycopg2 >= 2.0'], 'MySQL': ['MySQL-python'], 'WebDAV': ['PyWebDAV >= 0.9.3'], - 'PDF': ['openoffice-python'], + 'unoconv': ['unoconv'], 'SSL': ['pyOpenSSL'], 'graphviz': ['pydot'], 'timezone': ['pytz'], diff --git a/trytond/config.py b/trytond/config.py index e4c5fe374c..dea23a99f6 100644 --- a/trytond/config.py +++ b/trytond/config.py @@ -2,21 +2,36 @@ #this repository contains the full copyright notices and license terms. import ConfigParser, os, sys +def get_hostname(netloc): + if '[' in netloc and ']' in netloc: + return netloc.split(']')[0][1:] + elif ':' in netloc: + return netloc.split(':')[0] + else: + return netloc + +def get_port(netloc, protocol): + netloc = netloc.split(']')[-1] + if ':' in netloc: + return int(netloc.split(':')[1]) + else: + return { + 'jsonrpc': 8000, + 'xmlrpc': 8069, + 'webdav': 8080, + }.get(protocol) class ConfigManager(object): def __init__(self, fname=None): self.options = { 'hostname': None, - 'interface': '', - 'netrpc': True, - 'netport': 8070, - 'xmlrpc': False, - 'xmlport': 8069, - 'jsonrpc': False, - 'jsonport': 8000, + 'jsonrpc': [('localhost', '8000')], + 'ssl_jsonrpc': False, + 'xmlrpc': [], + 'ssl_xmlrpc': False, 'jsondata_path': '/var/www/localhost/tryton', - 'webdav': False, - 'webdavport': 8080, + 'webdav': [], + 'ssl_webdav': False, 'db_type': 'postgresql', 'db_host': False, 'db_port': False, @@ -31,10 +46,6 @@ class ConfigManager(object): 'debug_mode': False, 'pidfile': None, 'logfile': None, - 'secure_netrpc': False, - 'secure_xmlrpc': False, - 'secure_jsonrpc': False, - 'secure_webdav': False, 'privatekey': '/etc/ssl/trytond/server.key', 'certificate': '/etc/ssl/trytond/server.pem', 'smtp_server': 'localhost', @@ -44,7 +55,6 @@ class ConfigManager(object): 'smtp_user': False, 'smtp_password': False, 'data_path': '/var/lib/trytond', - 'max_thread': 40, 'multi_server': False, 'session_timeout': 600, 'psyco': False, @@ -53,6 +63,7 @@ class ConfigManager(object): 'init': {}, 'update': {}, 'cron': True, + 'unoconv': 'pipe,name=trytond;urp;StarOffice.ComponentContext', } self.configfile = None @@ -92,8 +103,9 @@ class ConfigManager(object): value = True if value == 'False' or value == 'false': value = False - if name in ('netport', 'xmlport', 'webdavport', 'jsonport'): - value = int(value) + if name in ('netrpc', 'xmlrpc', 'jsonrpc', 'webdav'): + value = [(get_hostname(netloc).replace('*', ''), + get_port(netloc, name)) for netloc in value.split(',')] self.options[name] = value def get(self, key, default=None): diff --git a/trytond/ir/action.py b/trytond/ir/action.py index 8be92988f6..9198b1be24 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -226,10 +226,76 @@ class ActionReport(ModelSQL, ModelView): style_content = fields.Function(fields.Binary('Style'), 'get_style_content') direct_print = fields.Boolean('Direct Print') - extension = fields.Selection( - [('odt', 'ODT Document'), - ('pdf', 'PDF Document'),], - string='Extension', required=True) + template_extension = fields.Selection([ + ('odt', 'OpenDocument Text'), + ('odp', 'OpenDocument Presentation'), + ('ods', 'OpenDocument Spreadsheet'), + ('odg', 'OpenDocument Graphics'), + ], string='Template Extension', required=True) + extension = fields.Selection([ + ('', ''), + ('bib', 'BibTex'), + ('bmp', 'Windows Bitmap'), + ('csv', 'Text CSV'), + ('dbf', 'dBase'), + ('dif', 'Data Interchange Format'), + ('doc', 'Microsoft Word 97/2000/XP'), + ('doc6', 'Microsoft Word 6.0'), + ('doc95', 'Microsoft Word 95'), + ('docbook', 'DocBook'), + ('emf', 'Enhanced Metafile'), + ('eps', 'Encapsulated PostScript'), + ('gif', 'Graphics Interchange Format'), + ('html', 'HTML Document'), + ('jpg', 'Joint Photographic Experts Group'), + ('met', 'OS/2 Metafile'), + ('ooxml', 'Microsoft Office Open XML'), + ('pbm', 'Portable Bitmap'), + ('pct', 'Mac Pict'), + ('pdb', 'AportisDoc (Palm)'), + ('pdf', 'Portable Document Format'), + ('pgm', 'Portable Graymap'), + ('png', 'Portable Network Graphic'), + ('ppm', 'Portable Pixelmap'), + ('ppt', 'Microsoft PowerPoint 97/2000/XP'), + ('psw', 'Pocket Word'), + ('pwp', 'PlaceWare'), + ('pxl', 'Pocket Excel'), + ('ras', 'Sun Raster Image'), + ('rtf', 'Rich Text Format'), + ('latex', 'LaTeX 2e'), + ('sda', 'StarDraw 5.0 (OpenOffice.org Impress)'), + ('sdc', 'StarCalc 5.0'), + ('sdc4', 'StarCalc 4.0'), + ('sdc3', 'StarCalc 3.0'), + ('sdd', 'StarImpress 5.0'), + ('sdd3', 'StarDraw 3.0 (OpenOffice.org Impress)'), + ('sdd4', 'StarImpress 4.0'), + ('sdw', 'StarWriter 5.0'), + ('sdw4', 'StarWriter 4.0'), + ('sdw3', 'StarWriter 3.0'), + ('slk', 'SYLK'), + ('svg', 'Scalable Vector Graphics'), + ('svm', 'StarView Metafile'), + ('swf', 'Macromedia Flash (SWF)'), + ('sxc', 'OpenOffice.org 1.0 Spreadsheet'), + ('sxi', 'OpenOffice.org 1.0 Presentation'), + ('sxd', 'OpenOffice.org 1.0 Drawing'), + ('sxd3', 'StarDraw 3.0'), + ('sxd5', 'StarDraw 5.0'), + ('sxw', 'Open Office.org 1.0 Text Document'), + ('text', 'Text Encoded'), + ('tiff', 'Tagged Image File Format'), + ('txt', 'Plain Text'), + ('wmf', 'Windows Metafile'), + ('xhtml', 'XHTML Document'), + ('xls', 'Microsoft Excel 97/2000/XP'), + ('xls5', 'Microsoft Excel 5.0'), + ('xls95', 'Microsoft Excel 95'), + ('xpm', 'X PixMap'), + ], + string='Extension', help='Leave empty for the same as template, ' + 'see unoconv documentation for compatible format') module = fields.Char('Module', readonly=True, select=1) email = fields.Char('Email') pyson_email = fields.Function(fields.Char('PySON Email'), 'get_pyson') @@ -269,6 +335,12 @@ class ActionReport(ModelSQL, ModelView): TableHandler.dropTable(cursor, 'ir.action.report.outputformat', 'ir_action_report_outputformat') + # Migrate from 2.0 remove required on extension + table.not_null_action('extension', action='remove') + cursor.execute('UPDATE "' + self._table + '" ' + 'SET extension = %s ' + 'WHERE extension = %s', ('', 'odt')) + def default_type(self): return 'ir.action.report' @@ -278,9 +350,12 @@ class ActionReport(ModelSQL, ModelView): def default_direct_print(self): return False - def default_extension(self): + def default_template_extension(self): return 'odt' + def default_extension(self): + return '' + def default_module(self): return Transaction().context.get('module') or '' diff --git a/trytond/ir/action.xml b/trytond/ir/action.xml index 08a28fbad6..9a5318655b 100644 --- a/trytond/ir/action.xml +++ b/trytond/ir/action.xml @@ -92,9 +92,11 @@ this repository contains the full copyright notices and license terms. -->