[MERGE] forward port of branch 8.0 up to 0aab81c
This commit is contained in:
Vendored
-1
@@ -6,7 +6,6 @@
|
||||
'_static/bootstrap/js/tooltip.js',
|
||||
'_static/bootstrap/js/collapse.js',
|
||||
'_static/bootstrap/js/dropdown.js',
|
||||
'_static/zeroclipboard-2.1.6/ZeroClipboard.min.js',
|
||||
'_static/app.js'
|
||||
] %}
|
||||
|
||||
|
||||
Vendored
+23
-64
@@ -25,40 +25,6 @@ $(function () {
|
||||
});
|
||||
}, 100);
|
||||
|
||||
/*
|
||||
for clipboard:
|
||||
* add per-language setup code to document, hidden
|
||||
* adds button to each switchable language block except when they're setup
|
||||
stuff because fuck'em
|
||||
* per-language, add clipboard hook to prefix with setup bit on-copy
|
||||
* setup bit is... ?
|
||||
* actually not all blocks because we don't want to add the setup bits to
|
||||
the setup bits, so that's kinda shit
|
||||
*/
|
||||
|
||||
document.addEventListener('copy', copyCode);
|
||||
|
||||
ZeroClipboard.config({
|
||||
swfPath: '../_static/zeroclipboard-2.1.6/ZeroClipboard.swf',
|
||||
flashLoadTimeout: 3e3,
|
||||
});
|
||||
var zc = new ZeroClipboard();
|
||||
zc.on('ready', function () {
|
||||
var $highlighted = $('.switchable:not(.setup) .highlight').addClass('with-btn-clipboard');
|
||||
var $clipboard_buttons =
|
||||
$('<button type="button" class="btn-clipboard">Copy</button>')
|
||||
.on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () {
|
||||
$(this).removeClass('active');
|
||||
})
|
||||
.prependTo($highlighted);
|
||||
zc.clip($clipboard_buttons);
|
||||
});
|
||||
zc.on('copy', function (e) {
|
||||
// yellow flash
|
||||
$(e.target).addClass('active');
|
||||
copyCode(e);
|
||||
});
|
||||
|
||||
// stripe page stuff
|
||||
if ($('div.document-super').hasClass('stripe')) { (function () {
|
||||
// iterate on highlighted PL blocks (but not results because that'd
|
||||
@@ -95,38 +61,31 @@ $(function () {
|
||||
sheet.insertRule(sel + '{' + content + '}', lastIndex);
|
||||
});
|
||||
$switcher.affix();
|
||||
|
||||
$('<button type="button" class="btn-show-setup">Toggle Setup Code</button>')
|
||||
.prependTo('.switchable:not(.setup) .highlight');
|
||||
$(document).on('click', '.btn-show-setup', function (e) {
|
||||
var $target = $(e.target);
|
||||
var target = $target.closest('.switchable:not(.setup)').get(0);
|
||||
// not in a switchable (???)
|
||||
if (!target) { return; }
|
||||
var lang = getHighlightLanguage(target);
|
||||
if (!lang) {
|
||||
// switchable without highlight (e.g. language-specific notes),
|
||||
// don't munge
|
||||
return;
|
||||
}
|
||||
|
||||
var $setup_code = $target.prev();
|
||||
if ($setup_code.length) {
|
||||
// remove existing setup code
|
||||
$setup_code.remove();
|
||||
} else {
|
||||
$('.setupcode.highlight-' + lang + ' pre').clone().insertBefore($target);
|
||||
}
|
||||
});
|
||||
})(); }
|
||||
|
||||
|
||||
function copyCode(e) {
|
||||
// works for both C-c and "Copy" button if copy button is injected
|
||||
// inside highlighted code section
|
||||
var target = $(e.target).closest('.switchable:not(.setup)').get(0);
|
||||
// not in a switchable
|
||||
if (!target) { return; }
|
||||
var lang = getHighlightLanguage(target);
|
||||
if (!lang) {
|
||||
// switchable without highlight (e.g. language-specific notes),
|
||||
// don't munge
|
||||
return;
|
||||
}
|
||||
|
||||
// get generic setup code
|
||||
var setup_selector = '.setupcode.highlight-' + lang + ' pre';
|
||||
var setup = document.querySelector(setup_selector).textContent;
|
||||
|
||||
// prepend setup code to current snippet, get all of current snippet
|
||||
// in case only part of it was selected. Ensure we don't get e.g.
|
||||
// button text around snippet itself
|
||||
var data = setup + '\n' + target.querySelector('pre').textContent;
|
||||
// sane browsers & ZeroClipboard
|
||||
e.clipboardData.setData('text/plain', data);
|
||||
// MSIE
|
||||
e.clipboardData.setData('Text', data);
|
||||
|
||||
// no preventDefault on ZC event
|
||||
e.preventDefault && e.preventDefault();
|
||||
}
|
||||
/**
|
||||
* @param {Node} node highlight node to get the language of
|
||||
* @returns {String|null} either the highlight language or null
|
||||
|
||||
Vendored
+27
-41
@@ -4076,7 +4076,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
|
||||
}
|
||||
}
|
||||
.navbar-default {
|
||||
background-color: #ffffff;
|
||||
background-color: white;
|
||||
border-color: 0;
|
||||
}
|
||||
.navbar-default .navbar-brand {
|
||||
@@ -6663,49 +6663,43 @@ div.section > h2 {
|
||||
.admonition.exercise > .admonition-title {
|
||||
color: #555555;
|
||||
}
|
||||
/*
|
||||
* Code snippets
|
||||
*
|
||||
* Generated via Pygments
|
||||
*/
|
||||
.highlight {
|
||||
position: relative;
|
||||
color: #333333;
|
||||
background: #eeeeee none !important;
|
||||
border: 1px solid #777777;
|
||||
border-radius: 4px 0 4px 4px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.highlight pre {
|
||||
padding: 4px;
|
||||
padding: 0;
|
||||
margin: 10px;
|
||||
font-size: 75%;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
.switchable .highlight.with-btn-clipboard pre {
|
||||
padding-right: 50px;
|
||||
.highlight:hover .btn-show-setup {
|
||||
display: block;
|
||||
}
|
||||
/*
|
||||
* ZeroClipboard styles
|
||||
*/
|
||||
.highlight {
|
||||
position: relative;
|
||||
}
|
||||
.btn-clipboard {
|
||||
.highlight .btn-show-setup {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 100%;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
display: block;
|
||||
padding: 5px 8px;
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
color: #777777;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e1e1e8;
|
||||
border-radius: 0 4px 0 4px;
|
||||
border: 1px solid #777777;
|
||||
border-radius: 4px 4px 0 0;
|
||||
background: inherit;
|
||||
}
|
||||
.btn-clipboard:focus {
|
||||
.highlight .btn-show-setup:focus {
|
||||
outline: none;
|
||||
}
|
||||
.btn-clipboard.active {
|
||||
background-color: #ffffad;
|
||||
-webkit-transition: background-color 0.5s linear;
|
||||
-o-transition: background-color 0.5s linear;
|
||||
transition: background-color 0.5s linear;
|
||||
}
|
||||
img.align-center {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
@@ -6843,20 +6837,14 @@ td.field-body > ul {
|
||||
border-bottom-color: #777777;
|
||||
border-right-color: #777777;
|
||||
}
|
||||
.stripe .section > .force-right pre,
|
||||
.stripe .section > [class*=highlight] pre {
|
||||
padding: 0;
|
||||
margin: 10px;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
.stripe .section > .force-right .highlight,
|
||||
.stripe .section > [class*=highlight] .highlight {
|
||||
border-color: #555555;
|
||||
border-style: solid;
|
||||
border-width: 1px 0;
|
||||
border-radius: 0;
|
||||
color: #cccccc;
|
||||
background: none;
|
||||
background: none !important;
|
||||
/* Line Numbers */
|
||||
/* Comment */
|
||||
/* Error */
|
||||
@@ -7243,14 +7231,12 @@ td.field-body > ul {
|
||||
.stripe .highlight pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.stripe .btn-clipboard {
|
||||
.stripe .btn-show-setup {
|
||||
background-color: transparent;
|
||||
color: #eeeeee;
|
||||
border-color: #777777;
|
||||
border-top: none;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
.stripe .btn-clipboard.active {
|
||||
.stripe .btn-show-setup.active {
|
||||
background-color: #555555;
|
||||
-webkit-transition: background-color 0.5s linear;
|
||||
-o-transition: background-color 0.5s linear;
|
||||
|
||||
+42
-52
@@ -465,50 +465,50 @@ div.section > h2 {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code snippets
|
||||
*
|
||||
* Generated via Pygments
|
||||
*/
|
||||
.highlight pre {
|
||||
padding: 4px;
|
||||
font-size: 75%;
|
||||
// don't break lines within words
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
}
|
||||
.switchable .highlight.with-btn-clipboard pre {
|
||||
// avoid copy button overlapping with even long lines
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
/*
|
||||
* ZeroClipboard styles
|
||||
*/
|
||||
.highlight {
|
||||
position: relative;
|
||||
}
|
||||
.btn-clipboard {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
display: block;
|
||||
padding: 5px 8px;
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e1e1e8;
|
||||
border-radius: 0 4px 0 4px;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
// move styling from pre to highlight so can have multiple pre elements in
|
||||
// a single "code block" for ease of adding and removing setup code &al
|
||||
color: @gray-dark;
|
||||
// force override of pygments yellow background background
|
||||
background: @gray-lighter none !important;
|
||||
border: 1px solid @gray-light;
|
||||
border-radius: @border-radius-base 0 @border-radius-base @border-radius-base;
|
||||
margin: 10px 0;
|
||||
|
||||
pre {
|
||||
padding: 0;
|
||||
margin: 10px;
|
||||
font-size: 75%;
|
||||
// don't break lines within words
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: #ffffad;
|
||||
.transition(background-color .5s linear);
|
||||
&:hover .btn-show-setup {
|
||||
display: block;
|
||||
}
|
||||
.btn-show-setup {
|
||||
display: none;
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
padding: 5px 8px;
|
||||
font-size: 12px;
|
||||
color: @gray-light;
|
||||
cursor: pointer;
|
||||
border: 1px solid @gray-light;
|
||||
border-radius: @border-radius-base @border-radius-base 0 0;
|
||||
background: inherit;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,22 +638,14 @@ td.field-body {
|
||||
border-bottom-color: @separator-right;
|
||||
border-right-color: @separator-right;
|
||||
}
|
||||
pre {
|
||||
// padding leads to overflow scrollbar in safari for no reason I understand,
|
||||
// margin does not have that issue
|
||||
padding: 0;
|
||||
margin: 10px;
|
||||
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
.highlight {
|
||||
border-color: @gray;
|
||||
border-style: solid;
|
||||
border-width: 1px 0;
|
||||
border-radius: 0;
|
||||
// solarized-ish from https://gist.github.com/qguv/7936275
|
||||
color: @color-right-code;
|
||||
background: none;
|
||||
background: none !important;
|
||||
.lineno { color: #586e75 } /* Line Numbers */
|
||||
.c { color: #586e75 } /* Comment */
|
||||
.err { color: @color-right-code } /* Error */
|
||||
@@ -761,12 +753,10 @@ td.field-body {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.btn-clipboard {
|
||||
.btn-show-setup {
|
||||
background-color: transparent;
|
||||
color: @color-right;
|
||||
border-color: @separator-right;
|
||||
border-top: none;
|
||||
border-top-right-radius: 0;
|
||||
|
||||
&.active {
|
||||
background-color: @gray;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
:classes: stripe
|
||||
|
||||
===========
|
||||
Web Service
|
||||
===========
|
||||
===============
|
||||
Web Service API
|
||||
===============
|
||||
|
||||
Odoo is mostly extended internally via modules, but much of its features and
|
||||
all of its data is also available from the outside for external analysis or
|
||||
|
||||
+9
-31
@@ -74,31 +74,9 @@ option.
|
||||
most command-line options can also be set using :ref:`a configuration
|
||||
file <reference/cmdline/config>`
|
||||
|
||||
An Odoo module is declared by its :ref:`manifest <reference/module/manifest>`. It
|
||||
is mandatory and contains a single python dictionary declaring various
|
||||
metadata for the module: the module's name and description, list of Odoo
|
||||
modules required for this one to work properly, references to data files, …
|
||||
|
||||
The manifest's general structure is::
|
||||
|
||||
{
|
||||
'name': "MyModule",
|
||||
'version': '1.0',
|
||||
'depends': ['base'],
|
||||
'author': "Author Name",
|
||||
'category': 'Category',
|
||||
'description': """
|
||||
Description text
|
||||
""",
|
||||
# data files always loaded at installation
|
||||
'data': [
|
||||
'mymodule_view.xml',
|
||||
],
|
||||
# data files containing optionally loaded demonstration data
|
||||
'demo': [
|
||||
'demo_data.xml',
|
||||
],
|
||||
}
|
||||
An Odoo module is declared by its :ref:`manifest <reference/module/manifest>`.
|
||||
See the :ref:`manifest documentation <reference/module/manifest>` information
|
||||
about it.
|
||||
|
||||
A module is also a
|
||||
`Python package <http://docs.python.org/2/tutorial/modules.html#packages>`_
|
||||
@@ -108,15 +86,15 @@ files in the module.
|
||||
For instance, if the module has a single ``mymodule.py`` file ``__init__.py``
|
||||
might contain::
|
||||
|
||||
import mymodule
|
||||
from . import mymodule
|
||||
|
||||
Fortunately, there is a mechanism to help you set up an module. The command
|
||||
``odoo.py`` has a subcommand :ref:`scaffold <reference/cmdline/scaffold>` to
|
||||
create an empty module:
|
||||
Odoo provides a mechanism to help set up a new module, :ref:`odoo.py
|
||||
<reference/cmdline/server>` has a subcommand :ref:`scaffold
|
||||
<reference/cmdline/scaffold>` to create an empty module:
|
||||
|
||||
.. code:: bash
|
||||
.. code-block:: console
|
||||
|
||||
odoo.py scaffold <module name> <where to put it>
|
||||
$ odoo.py scaffold <module name> <where to put it>
|
||||
|
||||
The command creates a subdirectory for your module, and automatically creates a
|
||||
bunch of standard files for a module. Most of them simply contain commented code
|
||||
|
||||
@@ -46,8 +46,8 @@ Index: addons/openacademy/__init__.py
|
||||
+++ addons/openacademy/__init__.py 2014-08-26 17:25:49.791783523 +0200
|
||||
@@ -0,0 +1,3 @@
|
||||
+# -*- coding: utf-8 -*-
|
||||
+import controllers
|
||||
+import models
|
||||
+from . import controllers
|
||||
+from . import models
|
||||
Index: addons/openacademy/controllers.py
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
|
||||
@@ -54,6 +54,7 @@ Index: addons/openacademy/views/session_board.xml
|
||||
+ <record model="ir.ui.view" id="board_session_form">
|
||||
+ <field name="name">Session Dashboard Form</field>
|
||||
+ <field name="model">board.board</field>
|
||||
+ <field name="type">form</field>
|
||||
+ <field name="arch" type="xml">
|
||||
+ <form string="Session Dashboard">
|
||||
+ <board style="2-1">
|
||||
@@ -89,6 +90,6 @@ Index: addons/openacademy/views/session_board.xml
|
||||
+ name="Session Dashboard" parent="base.menu_reporting_dashboard"
|
||||
+ action="open_board_session"
|
||||
+ sequence="1"
|
||||
+ id="menu_board_session"/>
|
||||
+ id="menu_board_session" icon="terp-graph"/>
|
||||
+ </data>
|
||||
+</openerp>
|
||||
|
||||
@@ -7,9 +7,9 @@ Index: addons/openacademy/__init__.py
|
||||
+++ addons/openacademy/__init__.py 2014-08-26 17:26:01.219783354 +0200
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import controllers
|
||||
import models
|
||||
+import partner
|
||||
from . import controllers
|
||||
from . import models
|
||||
+from . import partner
|
||||
Index: addons/openacademy/__openerp__.py
|
||||
===================================================================
|
||||
--- addons.orig/openacademy/__openerp__.py 2014-08-26 17:26:01.227783353 +0200
|
||||
|
||||
@@ -3,10 +3,10 @@ Index: addons/openacademy/__init__.py
|
||||
--- addons.orig/openacademy/__init__.py 2014-08-27 14:19:23.023111330 +0200
|
||||
+++ addons/openacademy/__init__.py 2014-08-27 14:22:25.043108628 +0200
|
||||
@@ -2,3 +2,4 @@
|
||||
import controllers
|
||||
import models
|
||||
import partner
|
||||
+import wizard
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import partner
|
||||
+from . import wizard
|
||||
Index: addons/openacademy/wizard.py
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
|
||||
+39
-28
@@ -30,7 +30,7 @@ with the structure:
|
||||
|-- pages.xml
|
||||
`-- snippets.xml
|
||||
|
||||
``static/styles`` contains your stylesheet(s), ``views`` contains the various
|
||||
``static/style`` contains your stylesheet(s), ``views`` contains the various
|
||||
XML files describing the theme and theme features to Odoo.
|
||||
|
||||
Static Page
|
||||
@@ -51,7 +51,12 @@ copy paste the lines::
|
||||
</t>
|
||||
</template>
|
||||
|
||||
Refresh the page and feel the hit.
|
||||
Comment the lines about ``options.xml`` and ``pages.xml`` in ``__openerp__.py``.
|
||||
|
||||
Run the server and update the theme (``./odoo.py -u dummy_theme``), then
|
||||
install the theme in the settings menu.
|
||||
|
||||
Go to ``http://localhost:8069/page/hello`` feel the hit.
|
||||
|
||||
Editing content on a page
|
||||
'''''''''''''''''''''''''
|
||||
@@ -104,14 +109,25 @@ modify these lines as below:
|
||||
|
||||
.. code-block:: css
|
||||
|
||||
.h1 {
|
||||
h1 {
|
||||
color: #215487;
|
||||
}
|
||||
.span {
|
||||
span {
|
||||
border: 2px solid black;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
Compile your file (http://lesscss.org/usage/#command-line-usage) to get the
|
||||
``custom.css`` file.
|
||||
|
||||
Add this asset to your template in ``page.xml``::
|
||||
|
||||
<template id="dummy_theme_asset" name="website assete for Dummy theme" inherit_id="website.theme">
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" href="/dummy_theme/static/style/custom.css"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
Refresh the page and feel the hit.
|
||||
|
||||
Get the most of the dom
|
||||
@@ -267,9 +283,9 @@ Adding images to your snippet
|
||||
You can easely add images in your snippets simply by setting up css
|
||||
backgrounds images.
|
||||
|
||||
In ``odoo/addons/theme_dummy/static/`` create a new folder and name it
|
||||
``img``. Put your images there, in sub-folders if needed. Open
|
||||
:file:`odoo/addons/theme_dummy/static/style/custom.less`, add these lines
|
||||
Put your images in ``odoo/addons/theme_dummy/static/img``, or in sub-folders
|
||||
if needed. Open :file:`odoo/addons/theme_dummy/static/style/custom.less`, add
|
||||
these lines
|
||||
|
||||
.. code-block:: css
|
||||
|
||||
@@ -279,28 +295,20 @@ In ``odoo/addons/theme_dummy/static/`` create a new folder and name it
|
||||
@img-02: url("../img/img-girl.png");
|
||||
.dummy-girl { background-image: @img-02; }
|
||||
|
||||
Add also the ``width`` and the ``height`` css attributes to theses new classes.
|
||||
|
||||
In :file:`odoo/addons/theme_dummy/views/pages.xml` change the correspondant
|
||||
lines as below::
|
||||
|
||||
<section>
|
||||
<div class="container">
|
||||
<div class="row dummy-bg">
|
||||
<div class="alert alert-primary" role="alert">
|
||||
<a href="#" class="alert-link">...</a>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h2>BLUE it!</h2>
|
||||
<div class="dummy-boy">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h2>GREEN THAT!</h2>
|
||||
<div class="dummy-girl">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center mt32 mb32">
|
||||
<h2 class="options_simple_snippet">A great Title, prmize</h2>
|
||||
<h3 class="text-muted">And a great subtilte too</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
|
||||
<div class="dummy-boy"></div>
|
||||
<div class="dummy-girl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Your new snippet is now ready to use. Just drag and drop it on your page to
|
||||
see it in action.
|
||||
@@ -329,9 +337,12 @@ Explain xpath
|
||||
|
||||
.. TODO:: syntax not correct (see website examples)
|
||||
|
||||
Your option menu is now correctly set in the database, you can create an new dropdown menu.
|
||||
Your option menu is now correctly set in the database, you can create an new
|
||||
dropdown menu.
|
||||
|
||||
Let's say yout want three options which will change the text color and the
|
||||
background.
|
||||
|
||||
Let's say yout want three options which will change the text color and the background.
|
||||
In option.xml, add these lines inside the xpath::
|
||||
|
||||
<li data-check_class="text-purple"><a>YOUR OPTION 1</a></li>
|
||||
|
||||
@@ -204,6 +204,7 @@ field:
|
||||
.. code-block:: xml
|
||||
|
||||
<record model="ir.actions.server" id="print_instance">
|
||||
<field name="name">Res Partner Server Action</field>
|
||||
<field name="model_id" ref="model_res_partner"/>
|
||||
<field name="code">
|
||||
print self, object
|
||||
@@ -218,6 +219,7 @@ field:
|
||||
.. code-block:: xml
|
||||
|
||||
<record model="ir.actions.server" id="print_instance">
|
||||
<field name="name">Res Partner Server Action</field>
|
||||
<field name="model_id" ref="model_res_partner"/>
|
||||
<field name="code">
|
||||
if object.some_condition():
|
||||
|
||||
@@ -249,6 +249,35 @@ customize the amout of logging output
|
||||
enables DEBUG logging of SQL querying, equivalent to
|
||||
``--log-handler=openerp.sql_db:DEBUG``
|
||||
|
||||
.. option:: --log-level <level>
|
||||
|
||||
Shortcut to more easily set predefined levels on specific loggers. "real"
|
||||
levels (``critical``, ``error``, ``warn``, ``debug``) are set on the
|
||||
``openerp`` and ``werkzeug`` loggers (except for ``debug`` which is only
|
||||
set on ``openerp``).
|
||||
|
||||
Odoo also provides debugging pseudo-levels which apply to different sets
|
||||
of loggers:
|
||||
|
||||
``debug_sql``
|
||||
sets the SQL logger to ``debug``
|
||||
|
||||
equivalent to ``--log-sql``
|
||||
``debug_rpc``
|
||||
sets the ``openerp`` and HTTP request loggers to ``debug``
|
||||
|
||||
equivalent to ``--log-level debug --log-request``
|
||||
``debug_rpc_answer``
|
||||
sets the ``openerp`` and HTTP request and response loggers to
|
||||
``debug``
|
||||
|
||||
equivalent to ``--log-level debug --log-request --log-response``
|
||||
|
||||
.. note::
|
||||
|
||||
In case of conflict between :option:`--log-level` and
|
||||
:option:`--log-handler`, the latter is used
|
||||
|
||||
.. _reference/cmdline/scaffold:
|
||||
|
||||
Scaffolding
|
||||
|
||||
@@ -15,6 +15,27 @@ and to specify a number of module metadata.
|
||||
It is a file called ``__openerp__.py`` and contains a single Python
|
||||
dictionary, each dictionary key specifying a module metadatum.
|
||||
|
||||
::
|
||||
|
||||
{
|
||||
'name': "A Module",
|
||||
'version': '1.0',
|
||||
'depends': ['base'],
|
||||
'author': "Author Name",
|
||||
'category': 'Category',
|
||||
'description': """
|
||||
Description text
|
||||
""",
|
||||
# data files always loaded at installation
|
||||
'data': [
|
||||
'mymodule_view.xml',
|
||||
],
|
||||
# data files containing optionally loaded demonstration data
|
||||
'demo': [
|
||||
'demo_data.xml',
|
||||
],
|
||||
}
|
||||
|
||||
Available manifest fields are:
|
||||
|
||||
``name`` (``str``, required)
|
||||
|
||||
@@ -418,7 +418,7 @@ the name of the template to alter as parameter.
|
||||
The alteration is then performed with any number of ``t-jquery``
|
||||
sub-directives::
|
||||
|
||||
<t t-extends="base.template">
|
||||
<t t-extend="base.template">
|
||||
<t t-jquery="ul" t-operation="append">
|
||||
<li>new element</li>
|
||||
</t>
|
||||
|
||||
@@ -24,8 +24,16 @@ and ``__init__.py`` contains::
|
||||
|
||||
from . import test_foo, test_bar
|
||||
|
||||
.. note:: test modules which are not imported from ``tests/__init__.py`` will
|
||||
not be run
|
||||
.. warning::
|
||||
|
||||
test modules which are not imported from ``tests/__init__.py`` will not be
|
||||
run
|
||||
|
||||
.. versionchanged:: 8.0
|
||||
|
||||
previously, the test runner would only run modules added to two lists
|
||||
``fast_suite`` and ``checks`` in ``tests/__init__.py``. In 8.0 it will
|
||||
run all imported modules
|
||||
|
||||
The test runner will simply run any test case, as described in the official
|
||||
`unittest documentation`_, but Odoo provides a number of utilities and helpers
|
||||
@@ -46,8 +54,8 @@ been installed, and not run right after the module installation:
|
||||
.. autofunction:: openerp.tests.common.post_install
|
||||
|
||||
The most common situation is to use
|
||||
:class:`~openerp.tests.common.TransactionCase` and test a property of a of a
|
||||
model in each method::
|
||||
:class:`~openerp.tests.common.TransactionCase` and test a property of a model
|
||||
in each method::
|
||||
|
||||
class TestModelA(common.TransactionCase):
|
||||
def test_some_action(self):
|
||||
@@ -67,7 +75,7 @@ Tests are automatically run when installing or updating modules if
|
||||
Odoo server.
|
||||
|
||||
As of Odoo 8, running tests outside of the install/update cycle is not
|
||||
|
||||
supported.
|
||||
|
||||
.. _unittest2: http://pypi.python.org/pypi/unittest2
|
||||
.. _unittest documentation: https://docs.python.org/2/library/unittest.html
|
||||
|
||||
+204
-117
@@ -33,21 +33,19 @@ This documents attempts to describe most of the installation options.
|
||||
|
||||
Good for developing modules, can be used as base for production
|
||||
deployment.
|
||||
:ref:`setup/install/vcs`
|
||||
Mostly has the same strengths and weaknesses as the
|
||||
:ref:`setup/install/source`, but allows (technically) simpler
|
||||
switching between versions of Odoo, as well as more structured patching
|
||||
and customisations of Odoo itself (not through custom modules): with a
|
||||
standard :ref:`setup/install/source`, a custom solution has to be
|
||||
implemented to keep track of patches applied to Odoo (e.g. Quilt_). With
|
||||
a VCS checkout, these changes can be implemented as standard Git revisions
|
||||
or a custom Git branch, and can more easily be contributed back to the
|
||||
main project.
|
||||
|
||||
The source code can be obtained by downloading a tarball or using git.
|
||||
Using git makes it easier to update, switch between multiple versions
|
||||
(including the current development version) or contribute.
|
||||
`docker image <https://registry.hub.docker.com/_/odoo/>`_
|
||||
if you usually use docker_ for development or deployment, an official
|
||||
docker_ base image is available, see the image's help document for more
|
||||
information
|
||||
|
||||
.. _setup/install/demo:
|
||||
|
||||
Demo_
|
||||
=====
|
||||
Demo
|
||||
====
|
||||
|
||||
To simply get a quick idea of Odoo, demo_ instances are available. They are
|
||||
shared instances which only live for a few hours, and can be used to browse
|
||||
@@ -57,8 +55,8 @@ Demo_ instances require no local installation, just a web browser.
|
||||
|
||||
.. _setup/install/saas:
|
||||
|
||||
SaaS_
|
||||
=====
|
||||
SaaS
|
||||
====
|
||||
|
||||
Odoo's SaaS_ provides private instances and starts out free. It can be used to
|
||||
discover and test Odoo and do non-code customizations without having to
|
||||
@@ -72,11 +70,8 @@ browser is sufficient.
|
||||
Packaged installers
|
||||
===================
|
||||
|
||||
.. Odoo provides packaged installers for Windows, deb-based distributions
|
||||
.. (Debian, Ubuntu, …) and RPM-based distributions (Fedora, CentOS, RHEL, …).
|
||||
|
||||
Odoo provides packaged installers for Windows and deb-based distributions
|
||||
(Debian, Ubuntu, …).
|
||||
Odoo provides packaged installers for Windows, deb-based distributions
|
||||
(Debian, Ubuntu, …) and RPM-based distributions (Fedora, CentOS, RHEL, …).
|
||||
|
||||
These packages automatically set up all dependencies, but may be difficult to
|
||||
keep up-to-date.
|
||||
@@ -84,6 +79,33 @@ keep up-to-date.
|
||||
Official packages with all relevant dependency requirements are available on
|
||||
https://nightly.odoo.com.
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
* download https://nightly.odoo.com/8.0/nightly/exe/odoo_8.0.latest.exe
|
||||
* run the downloaded file
|
||||
|
||||
.. warning:: on Windows 8, you may see a warning titled "Windows protected
|
||||
your PC". Click :guilabel:`More Info` then
|
||||
:guilabel:`Run anyway`
|
||||
|
||||
* Accept the UAC_ prompt
|
||||
* Go through the various installation steps
|
||||
|
||||
Odoo will automatically be started at the end of the installation.
|
||||
|
||||
Configuration
|
||||
'''''''''''''
|
||||
|
||||
The :ref:`configuration file <reference/cmdline/config>` can be found at
|
||||
:file:`{%PROGRAMFILES%}\\Odoo 8.0-{id}\\server\\openerp-server.conf`.
|
||||
|
||||
The configuration file can be edited to connect to a remote Postgresql, edit
|
||||
file locations or set a dbfilter.
|
||||
|
||||
To reload the configuration file, restart the Odoo service via
|
||||
:menuselection:`Services --> odoo server`.
|
||||
|
||||
Deb
|
||||
---
|
||||
|
||||
@@ -99,10 +121,6 @@ commands as root:
|
||||
This will automatically install all dependencies, install Odoo itself as a
|
||||
daemon and automatically start it.
|
||||
|
||||
.. postgres-server apparently automatically installed due to being a
|
||||
recommended package, maybe install it explicitly for the purpose of this
|
||||
document?
|
||||
|
||||
.. danger:: to print PDF reports, you must install wkhtmltopdf_ yourself:
|
||||
the version of wkhtmltopdf_ available in debian repositories does
|
||||
not support headers and footers so it can not be installed
|
||||
@@ -167,32 +185,6 @@ When the configuration file is edited, Odoo must be restarted via SystemD:
|
||||
|
||||
$ sudo systemctl restart odoo
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
* download https://nightly.odoo.com/8.0/nightly/exe/odoo_8.0.latest.exe
|
||||
* run the downloaded file
|
||||
|
||||
.. warning:: on Windows 8, you may see a warning titled "Windows protected
|
||||
your PC". Click :guilabel:`More Info` then
|
||||
:guilabel:`Run anyway`
|
||||
|
||||
* Accept the UAC_ prompt
|
||||
* Go through the various installation steps
|
||||
|
||||
Odoo will automatically be started at the end of the installation.
|
||||
|
||||
Configuration
|
||||
'''''''''''''
|
||||
|
||||
The :ref:`configuration file <reference/cmdline/config>` can be found at
|
||||
:file:`{%PROGRAMFILES%}\\Odoo 8.0-{id}\\server\\openerp-server.conf`.
|
||||
|
||||
The configuration file can be edited to connect to a remote Postgresql, edit
|
||||
file locations or set a dbfilter.
|
||||
|
||||
To reload the configuration file, restart the Odoo service via
|
||||
:menuselection:`Services --> odoo server`.
|
||||
|
||||
.. _setup/install/source:
|
||||
|
||||
@@ -214,77 +206,168 @@ edit a configuration file.
|
||||
Finally it provides greater control over the system's set up, and allows more
|
||||
easily keeping (and running) multiple versions of Odoo side-by-side.
|
||||
|
||||
The Odoo source can be downloaded from
|
||||
https://nightly.odoo.com/8.0/nightly/src/odoo_8.0-latest.tar.gz
|
||||
There are two way to get the odoo source source zip or git.
|
||||
|
||||
.. warning:: Windows does not handle .tar.gz archives natively, you will have
|
||||
to download and install `7-Zip <http://www.7-zip.org>`_ to
|
||||
decompress the archive
|
||||
* Odoo zip can be downloaded from
|
||||
https://nightly.odoo.com/8.0/nightly/src/odoo_8.0.latest.zip, the zip file
|
||||
then needs to be uncompressed to use its content
|
||||
|
||||
* git allows simpler update and easier switching between differents versions
|
||||
of Odoo. It also simplifies maintaining non-module patches and
|
||||
contributions. The primary drawback of git is that it is significantly
|
||||
larger than a tarball as it contains the entire history of the Odoo project.
|
||||
|
||||
The git repository is https://github.com/odoo/odoo.git.
|
||||
|
||||
Downloading it requires a `a git client <http://git-scm.com/download/>`_
|
||||
(which may be available via your distribution on linux) and can be performed
|
||||
using the following command:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ git clone https://github.com/odoo/odoo.git
|
||||
|
||||
Installing dependencies
|
||||
-----------------------
|
||||
|
||||
Source installation requires manually installing dependencies, be them native
|
||||
dependencies or Python libraries:
|
||||
Source installation requires manually installing dependencies:
|
||||
|
||||
* Python, should be preinstalled on most systems. On Windows, use `the
|
||||
official Python 2.7 installer <https://www.python.org/downloads/windows/>`_.
|
||||
* Python 2.7.
|
||||
|
||||
* PostgreSQL, if you want the database to be on the same machine as Odoo
|
||||
(simplest and default)
|
||||
- on Linux and OS X, included by default
|
||||
- on Windows, use `the official Python 2.7.9 installer
|
||||
<https://www.python.org/downloads/windows/>`_.
|
||||
|
||||
- on Linux, use your distribution's package
|
||||
- on Windows, use `the official installer`_
|
||||
- on OS X, `postgres.app <http://postgresapp.com>`_ is the simplest way to
|
||||
get started
|
||||
.. warning:: select "add python.exe to Path" during installation, and
|
||||
reboot afterwards to ensure the :envvar:`PATH` is updated
|
||||
|
||||
.. todo:: create new role?
|
||||
.. note:: if Python is already installed, make sure it is 2.7.9, previous
|
||||
versions are less convenient and 3.x versions are not compatible
|
||||
with Odoo
|
||||
|
||||
* the :file:`requirements.txt` file in the source lists all the Python
|
||||
dependencies
|
||||
* PostgreSQL, to use a local database
|
||||
|
||||
- for Windows, http://www.lfd.uci.edu/~gohlke/pythonlibs/ provides a number
|
||||
of libraries, for both pure-python and native, packaged as installers
|
||||
- dependencies may be installable with the system's package manager
|
||||
- pip_ can take the requirements file directly and install everything listed
|
||||
in it, either globally or within a `virtual environment`_:
|
||||
After installation you will need to create a postgres user: by default the
|
||||
only user is ``postgres``, and Odoo forbids connecting as ``postgres``.
|
||||
|
||||
- on Linux, use your distribution's package, then create a postgres user
|
||||
named like your login:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install -r path/to/requirements.txt
|
||||
$ sudo su - postgres -c "createuser -s $USER"
|
||||
|
||||
For libraries using native code (Pillow, lxml, greenlet, gevent, psycopg2)
|
||||
it may be necessary to install development tools and native dependencies
|
||||
before pip is able to install the dependencies themselves:
|
||||
Because the role login is the same as your unix login unix sockets can be
|
||||
use without a password.
|
||||
|
||||
* Linux distributions generally require ``-dev`` or ``-devel`` packages
|
||||
for Python, Postgres, libxml2, libxslt and libevent
|
||||
* for OSX, install the Command Line Tools (``xcode-select --install``) the
|
||||
native dependency via your preferred package manager (macports_,
|
||||
homebrew_)
|
||||
* for Windows
|
||||
- on OS X, `postgres.app <http://postgresapp.com>`_ is the simplest way to
|
||||
get started, then create a postgres user as on Linux
|
||||
|
||||
.. danger:: you will have to remove ``python-ldap`` from the
|
||||
requirements file, it can not be installed via pip_ on
|
||||
Windows and must be installed as a precompiled binary
|
||||
- on Windows, use `PostgreSQL for windows`_ then
|
||||
|
||||
- install the `Visual C++ Compiler for Python 2.7`_ (and restart)
|
||||
- install `PostgreSQL for windows`_ if not already done
|
||||
- Add PostgreSQL's ``bin`` directory (default:
|
||||
``C:\Program Files\PostgreSQL\9.3\bin``) to your :envvar:`PATH`
|
||||
- add PostgreSQL's ``bin`` directory (default:
|
||||
``C:\Program Files\PostgreSQL\9.4\bin``) to your :envvar:`PATH`
|
||||
- create a postgres user with a password using the pg admin gui: open
|
||||
pgAdminIII, double-click the server to create a connection, select
|
||||
:menuselection:`Edit --> New Object --> New Login Role`, enter the
|
||||
usename in the :guilabel:`Role Name` field (e.g. ``odoo``), then open
|
||||
the :guilabel:`Definition` tab and enter the password (e.g. ``odoo``),
|
||||
then click :guilabel:`OK`.
|
||||
|
||||
``greenlet``, ``Pillow`` and ``lxml`` are available as pre-compiled
|
||||
wheels_ and trivially installed by pip_, ``gevent`` only needs the
|
||||
compiler to be installable and a local installation ``psycopg2``
|
||||
The user and password must be passed to Odoo using either the
|
||||
:option:`-w <odoo.py -w>` and :option:`-r <odoo.py -r>` options or
|
||||
:ref:`the configuration file <reference/cmdline/config>`
|
||||
|
||||
.. note:: by default, Python scripts are not on the PATH in windows,
|
||||
after installing pip_ add ``C:\Python27\Scripts`` to your
|
||||
:envvar:`PATH`
|
||||
* Python dependencies listed in the :file:`requirements.txt` file.
|
||||
|
||||
.. danger:: whatever the installation method, Odoo on Windows also needs
|
||||
pywin32_ which is not listed in the requirements file. It can be
|
||||
installed using pip_ with ``pip install pypiwin32``, or manually
|
||||
by downloading the official pywin32_ installer and running it.
|
||||
- on Linux, python dependencies may be installable with the system's package
|
||||
manager or using pip.
|
||||
|
||||
For libraries using native code (Pillow, lxml, greenlet, gevent, psycopg2,
|
||||
ldap) it may be necessary to install development tools and native
|
||||
dependencies before pip is able to install the dependencies themselves.
|
||||
These are available in ``-dev`` or ``-devel`` packages for Python,
|
||||
Postgres, libxml2, libxslt, libevent and libsasl2. Then the Python
|
||||
dependecies can themselves be installed:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install -r requirements.txt
|
||||
|
||||
- on OS X, you will need to install the Command Line Tools
|
||||
(``xcode-select --install``) then download and install a package manager
|
||||
of your choice (homebrew_, macports_) to install non-Python dependencies.
|
||||
pip can then be used to install the Python dependencies as on Linux:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install -r requirements.txt
|
||||
|
||||
- on Windows you need to install some of the dependencies manually, tweak the
|
||||
requirements.txt file, then run pip to install the remaning ones.
|
||||
|
||||
Install ``psycopg`` using the installer here
|
||||
http://www.stickpeople.com/projects/python/win-psycopg/
|
||||
|
||||
Then edit the requirements.txt file:
|
||||
|
||||
- remove ``psycopg2`` as you already have it.
|
||||
- remove the optional ``python-ldap``, ``gevent`` and ``psutil`` because
|
||||
they require compilation.
|
||||
- add ``pypiwin32`` because it's needed under windows.
|
||||
|
||||
Then use pip to install install the dependencies using the following
|
||||
command from a cmd.exe prompt (replace ``\YourOdooPath`` by the actual
|
||||
path where you downloaded Odoo):
|
||||
|
||||
.. code-block:: ps1
|
||||
|
||||
C:\> cd \YourOdooPath
|
||||
C:\YourOdooPath> C:\Python27\Scripts\pip.exe install -r requirements.txt
|
||||
|
||||
* *Less CSS* via nodejs
|
||||
|
||||
- on Linux, use your distribution's package manager to install nodejs and
|
||||
npm.
|
||||
|
||||
.. warning::
|
||||
|
||||
In debian wheezy and Ubuntu 13.10 and before you need to install
|
||||
nodejs manually:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ wget -qO- https://deb.nodesource.com/setup | bash -
|
||||
$ apt-get install -y nodejs
|
||||
|
||||
In later debian (>jessie) and ubuntu (>14.04) you may need to add a
|
||||
symlink as npm packages call ``node`` but debian calls the binary
|
||||
``nodejs``
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ apt-get install -y npm
|
||||
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
|
||||
|
||||
Once npm is installed, use it to install less and less-plugin-clean-css:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo npm install -g less less-plugin-clean-css
|
||||
|
||||
- on OS X, install nodejs via your preferred package manager (homebrew_,
|
||||
macports_) then install less and less-plugin-clean-css:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo npm install -g less less-plugin-clean-css
|
||||
|
||||
- on Windows, `install nodejs <http://nodejs.org/download/>`_, reboot (to
|
||||
update the :envvar:`PATH`) and install less and less-plugin-clean-css:
|
||||
|
||||
.. code-block:: ps1
|
||||
|
||||
C:\> npm install -g less less-plugin-clean-css
|
||||
|
||||
Running Odoo
|
||||
------------
|
||||
@@ -297,33 +380,37 @@ Once all dependencies are set up, Odoo can be launched by running ``odoo.py``.
|
||||
|
||||
Common necessary configurations are:
|
||||
|
||||
* PostgreSQL host, port, user and password. Odoo has no defaults beyond
|
||||
`psycopg2's defaults <http://initd.org/psycopg/docs/module.html>`_: connects
|
||||
over a UNIX socket on port 5432 with the current user and no password.
|
||||
* PostgreSQL host, port, user and password.
|
||||
|
||||
Odoo has no defaults beyond
|
||||
`psycopg2's defaults <http://initd.org/psycopg/docs/module.html>`_: connects
|
||||
over a UNIX socket on port 5432 with the current user and no password. By
|
||||
default this should work on Linux and OS X, but it *will not work* on
|
||||
windows as it does not support UNIX sockets.
|
||||
|
||||
This may require creating new PostgreSQL roles, by default the only user is
|
||||
``postgres``, and Odoo forbids connecting as ``postgres``.
|
||||
* Custom addons path beyond the defaults, to load your own modules
|
||||
|
||||
.. _setup/install/vcs:
|
||||
Under Windows a typical way to execute odoo would be:
|
||||
|
||||
VCS Checkout
|
||||
============
|
||||
.. code-block:: ps1
|
||||
|
||||
The VCS Checkout installation method is similar to
|
||||
:ref:`source-based installation <setup/install/source>` in most respect.
|
||||
C:\YourOdooPath> python odoo.py -w odoo -r odoo --addons-path=addons,../mymodules --db-filter=mydb$
|
||||
|
||||
* Instead of downloading a tarball the Odoo source code is downloaded from
|
||||
`the repository`_ using git_
|
||||
* This simplifies the development and contributions to Odoo itself
|
||||
* This also simplifies maintaining non-module patches on top of the base Odoo
|
||||
system
|
||||
Where ``odoo``, ``odoo`` are the postgresql login and password,
|
||||
``../mymodules`` a directory with additional addons and ``mydb`` the default
|
||||
db to serve on localhost:8069
|
||||
|
||||
The primary drawback of the VCS checkout method is that it is significantly
|
||||
larger than a :ref:`source install <setup/install/source>` as it contains
|
||||
the entire history of the Odoo project.
|
||||
Under Unix a typical way to execute odoo would be:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ ./odoo.py --addons-path=addons,../mymodules --db-filter=mydb$
|
||||
|
||||
Where ``../mymodules`` is a directory with additional addons and ``mydb`` the
|
||||
default db to serve on localhost:8069
|
||||
|
||||
.. _demo: https://demo.odoo.com
|
||||
.. _docker: https://www.docker.com
|
||||
.. _EPEL: https://fedoraproject.org/wiki/EPEL
|
||||
.. _PostgreSQL: http://www.postgresql.org
|
||||
.. _the official installer:
|
||||
|
||||
Reference in New Issue
Block a user