diff --git a/MANIFEST.in b/MANIFEST.in index c864492136d..fa159fbadbf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,7 +7,7 @@ graft win32 include README include LICENSE include MANIFEST.in -include gunicorn.conf.py +include openerp-wsgi.py include openerp-server include setup* global-exclude *pyc *~ # Exclude possible garbage from previous graft. diff --git a/debian/control b/debian/control index d5980232b73..a4c1b050c0a 100644 --- a/debian/control +++ b/debian/control @@ -19,6 +19,7 @@ Depends: python-docutils, python-feedparser, python-gdata, + python-imaging, python-jinja2, python-ldap, python-libxslt1, @@ -46,12 +47,12 @@ Depends: Conflicts: tinyerp-server, openerp-server, openerp-web Replaces: tinyerp-server, openerp-server, openerp-web Recommends: - graphviz, ghostscript, postgresql, python-imaging, python-matplotlib + graphviz, ghostscript, postgresql, python-matplotlib, poppler-utils Description: OpenERP Enterprise Resource Management OpenERP, previously known as TinyERP, is a complete ERP and CRM. The main features are accounting (analytic and financial), stock management, sales and purchases management, tasks automation, marketing campaigns, help desk, POS, etc. Technical features include a distributed server, flexible workflows, an - object database, a dynamic GUI, customizable reports, and NET-RPC and XML-RPC - interfaces. + object database, a dynamic GUI, customizable reports, and an XML-RPC + interface. diff --git a/debian/openerp.init b/debian/openerp.init index 6abb6f10ed6..98e653298b2 100644 --- a/debian/openerp.init +++ b/debian/openerp.init @@ -17,55 +17,46 @@ DAEMON=/usr/bin/openerp-server NAME=openerp-server DESC=openerp-server CONFIG=/etc/openerp/openerp-server.conf -LOGFILE=/var/log/openerp-server.log +LOGFILE=/var/log/openerp/openerp-server.log USER=openerp test -x ${DAEMON} || exit 0 set -e +do_start () { + echo -n "Starting ${DESC}: " + start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid --chuid ${USER} --background --make-pidfile --exec ${DAEMON} -- --config=${CONFIG} --logfile=${LOGFILE} + echo "${NAME}." +} + +do_stop () { + echo -n "Stopping ${DESC}: " + start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid --oknodo + echo "${NAME}." +} + case "${1}" in - start) - echo -n "Starting ${DESC}: " + start) + do_start + ;; - start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ - --chuid ${USER} --background --make-pidfile \ - --exec ${DAEMON} -- --config=${CONFIG} \ - --logfile=${LOGFILE} + stop) + do_stop + ;; - echo "${NAME}." - ;; + restart|force-reload) + echo -n "Restarting ${DESC}: " + do_stop + sleep 1 + do_start + ;; - stop) - echo -n "Stopping ${DESC}: " - - start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ - --oknodo - - echo "${NAME}." - ;; - - restart|force-reload) - echo -n "Restarting ${DESC}: " - - start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ - --oknodo - - sleep 1 - - start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ - --chuid ${USER} --background --make-pidfile \ - --exec ${DAEMON} -- --config=${CONFIG} \ - --logfile=${LOGFILE} - - echo "${NAME}." - ;; - - *) - N=/etc/init.d/${NAME} - echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + *) + N=/etc/init.d/${NAME} + echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 + exit 1 + ;; esac exit 0 diff --git a/debian/openerp.postinst b/debian/openerp.postinst index 8700a259198..2eccd5111ec 100644 --- a/debian/openerp.postinst +++ b/debian/openerp.postinst @@ -12,9 +12,9 @@ case "${1}" in chown openerp:openerp /etc/openerp/openerp-server.conf chmod 0640 /etc/openerp/openerp-server.conf # Creating log file - touch /var/log/openerp-server.log - chown openerp:openerp /var/log/openerp-server.log - chmod 0640 /var/log/openerp-server.log + mkdir -p /var/log/openerp/ + chown openerp:openerp /var/log/openerp + chmod 0750 /var/log/openerp # Creating local storage directory mkdir -p /var/lib/openerp/filestore chown openerp:openerp -R /var/lib/openerp diff --git a/debian/openerp.postrm b/debian/openerp.postrm index 55c28f04eb5..bc81ce98b71 100644 --- a/debian/openerp.postrm +++ b/debian/openerp.postrm @@ -6,10 +6,11 @@ case "${1}" in remove) deluser --quiet --system "openerp" || true delgroup --quiet --system --only-if-empty "openerp" || true + find /var/lib/openerp -path '/var/lib/openerp/*' ! -path '/var/lib/openerp/filestore*' -delete ;; purge) - rm -rf /var/lib/openerp-server + rm -rf /var/lib/openerp ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) diff --git a/doc/01_getting_started.rst b/doc/01_getting_started.rst index 175c78cd9bc..341d96db7ae 100644 --- a/doc/01_getting_started.rst +++ b/doc/01_getting_started.rst @@ -103,9 +103,6 @@ General Options --logfile=LOGFILE file where the server log will be stored -n INTERFACE, --interface=INTERFACE specify the TCP IP address -p PORT, --port=PORT specify the TCP port - --net_interface=NETINTERFACE specify the TCP IP address for netrpc - --net_port=NETPORT specify the TCP port for netrpc - --no-netrpc disable netrpc --no-xmlrpc disable xmlrpc -i INIT, --init=INIT init a module (use "all" for all modules) --without-demo=WITHOUT_DEMO load demo data for a module (use "all" for all modules) diff --git a/doc/02_architecture.rst b/doc/02_architecture.rst index 815a498d5bd..203a1bceba9 100644 --- a/doc/02_architecture.rst +++ b/doc/02_architecture.rst @@ -1,6 +1,6 @@ -======================================== +============ Architecture -======================================== +============ OpenERP as a multitenant three-tiers architecture ================================================= @@ -180,6 +180,7 @@ OpenERP follows the MVC semantic with Network communications and WSGI =============================== + OpenERP is an HTTP web server and may also be deployed as an WSGI-compliant application. @@ -207,3 +208,45 @@ As such, it can be run as a stand-alone HTTP server or embedded inside OpenERP. The HTTP namespaces /openerp/ /object/ /common/ are reserved for the XML-RPC layer, every module restrict it's HTTP namespace to // +Process model +============= + +In the past, the OpenERP server was using threads to handle HTTP requests +concurrently or to process cron jobs. Using threads is still the default +behavior when running the ``openerp-server`` script but not the recommended +one: it is in fact recommended to use the ``--workers`` option. + +By using the ``--workers`` option, the OpenERP server will spawn a fixed number +of processes instead of spawning a new thread for each incoming request. + +This has a number of advantages: + + - Processes do not suffer from CPython's Global Interpreter Lock. + - Processes can be gracefully recycled while requests are still handled by the + server. + - Resources such as CPU time and memory made available to a process can be + monitored on a per-process basis. + +When using the ``--workers`` options, two types of processes may be spawned: +web process, and cron process. + +.. versionadded:: 7.1 + +.. _longpolling-worker: + +When using the ``--workers`` options, three types of processes may be spawned: +web process, and cron process, just as previsouly, but also an evented (using +gevent) web process is started. It is used for long-polling as needed by the +upcoming Instant Messaging feature. As for now, that process is listening on a +different port than the main web processes. A reverse proxy (e.g. Nginx) to +listen on a unique port, mapping all requests to the normal port, but mapping +the ``/longpolling`` route to the evented process is necessary (the web +interface cannot issue requests to different ports). + +(It is possible to make the threaded server evented by passing the ``--gevent`` +flag.) + +The goal is to drop support for the threaded model, and also make all web +processes evented; there would be no more distinction between "normal" and +"longpolling" processes. For this to happen, further testing is needed. + diff --git a/doc/03_module_dev.rst b/doc/03_module_dev.rst index 72f035be4d0..c5f965e4b93 100644 --- a/doc/03_module_dev.rst +++ b/doc/03_module_dev.rst @@ -13,3 +13,4 @@ Modules 03_module_dev_04 03_module_dev_05 03_module_dev_06 + report-declaration diff --git a/doc/changelog.rst b/doc/changelog.rst new file mode 100644 index 00000000000..59c4a6bced5 --- /dev/null +++ b/doc/changelog.rst @@ -0,0 +1,23 @@ +.. _changelog: + +Changelog +========= + +`trunk` +------- + +- Almost removed ``LocalService()``. For reports, + ``openerp.osv.orm.Model.print_report()`` can be used. For workflows, see + :ref:`orm-workflows`. +- Removed support for the ``NET-RPC`` protocol. +- Added the :ref:`Long polling ` worker type. +- Added :ref:`orm-workflows` to the ORM. +- Added :ref:`routing-decorators` to the RPC and WSGI stack. +- Removed support for ``__terp__.py`` descriptor files. +- Removed support for ```` root element in XML files. +- Removed support for the non-openerp namespace (e.g. importing ``tools`` + instead of ``openerp.tools`` in an addons). +- Add a new type of exception that allows redirections: + ``openerp.exceptions.RedirectWarning``. +- Give a pair of new methods to ``res.config.settings`` and a helper to make + them easier to use: ``get_config_warning()``. diff --git a/doc/deployment-mod-wsgi.rst b/doc/deployment-mod-wsgi.rst new file mode 100644 index 00000000000..f28094608c5 --- /dev/null +++ b/doc/deployment-mod-wsgi.rst @@ -0,0 +1,73 @@ +.. _using-mod-wsgi: + +Deploying with ``mod_wsgi`` +=========================== + +``mod_wsgi`` makes it possible to run a WSGI_ application (such as OpenERP) +under the Apache_ HTTP server. + +.. _WSGI: http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface +.. _Apache: https://httpd.apache.org/ + +Summary +------- + +Similarly to :doc:`deployment-gunicorn`, running OpenERP behind Apache with +``mod_wsgi`` requires to modify the sample ``openerp-wsgi.py`` script. Then +that Python script can be set in the Apache configuration. + +Python (WSGI) application +------------------------- + +Apache needs a Python script providing the WSGI application. By default the +symbol looked up by Apache is ``application`` but it can be overidden with the +``WSGICallableObject`` directive if necessary. A sample script +``openerp-wsgi.py`` is provided with OpenERP and you can adapt it to your +needs. For instance, make sure to correctly set the ``addons_path`` +configuration (using absolute paths). + +.. note :: + The script provided to Apache has often the extension ``.wsgi`` but the + ``openerp-wsgi.py`` script will do just as fine. + +Apache Configuration +-------------------- + +In Apache's configuration, add the following line to activate ``mod_wsgi``:: + + LoadModule wsgi_module modules/mod_wsgi.so + +Then a possible (straightforward, with e.g. no virtual server) configuration is +as follow:: + + WSGIScriptAlias / /home/thu/repos/server/trunk/openerp-wsgi.py + WSGIDaemonProcess oe user=thu group=users processes=2 python-path=/home/thu/repos/server/trunk/ display-name=apache-openerp + WSGIProcessGroup oe + + + Order allow,deny + Allow from all + + +The ``WSGIScriptAlias`` directive indicates that any URL matching ``/`` will +run the application defined in the ``openerp-wsgi.py`` script. + +The ``WSGIDaemonProcess`` and ``WSGIProcessGroup`` directives create a process +configuration. The configuration makes it possible for isntance to specify +which user runs the OpenERP process. The ``display-name`` option will make the +processes appear as ``apache-openerp`` in ``ps`` (instead of the normal +``httpd``). + +Finally, it is necessary to make sure the source directory where the script can +be found is allowed by Apache with the ``Directory`` block. + +``mod_wsgi`` supports a lot of directives, please see this ``mod_wsgi`` wiki +page for more details: +http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives. + +Running +------- + +When the Apache configuration changes, it is necessary to restart Apache, e.g. with:: + + /etc/init.d/httpd restart diff --git a/doc/form-view-guidelines.rst b/doc/form-view-guidelines.rst new file mode 100644 index 00000000000..ceec973682c --- /dev/null +++ b/doc/form-view-guidelines.rst @@ -0,0 +1,303 @@ +.. _form-view-guidelines: + +Form Views Guidelines +===================== + +Authors: Aline Preillon, Raphael Collet + + +This document presents functional and technical guidelines for +creating/organizing form views in OpenERP version 7.0. For each item, both the +functional and technical aspects are explained. The goal of the new style of +forms is to make OpenERP easier to use, and to guide users through the system. + +Business Views +-------------- + +Business views are targeted at regular users, not advanced users. Examples +are: Opportunities, Products, Partners, Tasks, Projects, etc. + +.. image:: /form-view-guidelines/oppreadonly.png + +In general, a business view is composed of + +1. a status bar on top (with technical or business flow), +2. a sheet in the middle (the form itself), +3. a bottom part with History and Comments. + +Technically, the new form views are structured as follows in XML:: + +
+
... content of the status bar ...
+ ... content of the sheet ... +
... content of the bottom part ...
+
+ +The Status Bar +'''''''''''''' + +The purpose of the status bar is to show the status of the record and the +action buttons, which were formerly at the bottom of form views. + +.. image:: /form-view-guidelines/status.png + +The Buttons +........... + +The order of buttons follows the business flow. For instance, in a sale order, +the logical steps are: + +1. Send the quotation +2. Confirm the quotation +3. Create the final invoice +4. Send the goods + +Highlighted buttons (in red) emphasize the logical next step, to help the user. +It is usually the first active button. On the other end, cancel buttons must +remain grey (normal). For instance, in Invoice, the button “Refund” must never +be red. + +Technically, buttons are highlighted by adding the class “oe_highlight”:: + +