Skip to content
Snippets Groups Projects
Unverified Commit f5b2a4b0 authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[FIX] doc: update to version 11

Use python 3.5
Refer to correct page of the doc
Remove old bazar to git (was intended for the 8.0)

Remove outdated setup_dev script: it was intended for odoo developers but if you
are not able to make a git clone, you are going to have a bad time later.
parent e1104ac3
No related branches found
No related tags found
No related merge requests found
......@@ -30,21 +30,4 @@ Getting started with Odoo
For a standard installation please follow the <a href="https://www.odoo.com/documentation/11.0/setup/install.html">Setup instructions</a>
from the documentation.
If you are a developer you may type the following command at your terminal:
wget -O- https://raw.githubusercontent.com/odoo/odoo/11.0/setup/setup_dev.py | python
Then follow <a href="https://www.odoo.com/documentation/11.0/tutorials.html">the developer tutorials</a>
For Odoo employees
------------------
To add the odoo-dev remote use this command:
$ ./setup/setup_dev.py setup_git_dev
To fetch odoo merge pull requests refs use this command:
$ ./setup/setup_dev.py setup_git_review
......@@ -178,7 +178,7 @@ latex_elements = {
todo_include_todos = False
intersphinx_mapping = {
'python': ('https://docs.python.org/2/', None),
'python': ('https://docs.python.org/3/', None),
'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),
'sqlalchemy': ('http://docs.sqlalchemy.org/en/rel_0_9/', None),
'django': ('https://django.readthedocs.org/en/latest/', None),
......
:orphan:
=============
Bazaar to git
=============
Initializing a working copy
---------------------------
Use the easy-setup shell script::
curl -O https://raw.githubusercontent.com/odoo/odoo/10.0/setup/setup_dev.py | python2
it will will ask a few questions and create a local copy.
Git concepts
------------
Remotes
~~~~~~~
Remotes are "remote repositories" which can be fetched from and pushed
to. Remotes can be listed with ``git remote``\ [#remote-default]_ and a local
repository can have any number of remotes. The setup script creates 2 remotes:
``odoo``
the official repository and main branches, roughly corresponds to the old
"mainline" branches in bazaar. You should never need to push to it, and by
default your local copy is configured to forbid it.
``odoo-dev``
a grab-bag of development branches, you can push your work to it so other
coworkers can work with you.
Branches
~~~~~~~~
The working copy and each remote contain multiple branches. Local branches can
be listed by ``git branch``, remote branches can be listed with ``git branch
-r``. Both types can be listed with ``git branch -a``.
Work is only possible on local branches, even though it's possible to check
out a remote branch work on it will be lost.
Staging
~~~~~~~
``bzr commit`` takes all alterations to the working copy and creates a commit
from them. Git has an intermediate step called "staging". ``git commit`` will
create a commit from what has been staged, not from the working copy\
[#commit-no-staging]_. Staging is done with ``git add``. A commit with nothing
staged is a null operation.
.. warning::
It's possible for a single file to have changes in both the index and
working copy: if a file is altered, staged and altered again, the second
set of change has to be staged separately
SHA1
~~~~
Git has no sequential identifier, each commit is uniquely identified by a SHA
(40 hexadecimal characters) roughly corresponding to a bazaar
revision-id. Providing the full sha is rarely necessary, any unique leading
substring is sufficient, e.g. ``dae86e`` will probably stand in for
``dae86e1950b1277e545cee180551750029cfe735``.
Basic development workflow
--------------------------
* update your remotes with ``git fetch --all``
* create your development branch with ``git checkout -b <branch_name>
<source_branch>``. For instance if you wanted to add support for full-text
search in master you could use ``git checkout -b master-fts-xxx odoo/master``
* do your changes, stage them with ``git add`` and commit them with ``git
commit``
* if your branch is long-lived, you may want to update it to its parent
- update the remotes with ``git fetch --all``
- merge the remote branch into the local one with ``git merge --no-ff
odoo/master``
* to push the branch to the development repository, use ``git push -u dev
<branchname>``, this will automatically create a branch called
``<branchname>`` on dev. Next time around you do not have to use ``-u``
* once the feature is done, create a pull request
.. should we promote rebase? That would lead to cleaner histories, but if the
branch is already pushed it requires force-pushing since the branch can't
be fast-forwarded
.. git automatically creates a merge commit, should we configure merge with
--no-commit?
.. make --no-ff the default in the config script?
.. warn about ``git pull``? It is ~ ``git fetch; git merge`` and should
probably be avoided
.. CLI tools?
.. format for specifying issues? e.g. closes #42?
Tasks
-----
Converting your feature branches from bazaar
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`The readme`_ has some instructions.
Viewing history: ``git log``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``git log`` fulfills the same role as ``bzr log`` and is fairly similar, with
a few differences:
* ``git log`` has no ``-r`` argument, its first argument (optional) is a
revision spec
* ``git log`` always operates on ranges, if a single commit is provided (via
hash, tag, branch or other) it will list the specified commit *and all of
its ancestors*. To see a single commit, use ``git show``.
* ``git log``'s second positional argument is a path (file or
directory). Because both are optional, if both a revision and a file match
the revision will be selected. It is recommended to use ``--`` before a file
path::
git log -- filepath
* ``git log`` will actually work if given a directory, instead of pegging the
CPU forever
* ``git log`` works with removed files or directories without having to
provide a revision during which the file or directory still existed
* ``git log`` has *lots* of options to customize the output, e.g. ``-p`` will
display the changes to each file\ [#log-patch-empty]_, ``--name-status``
will list the changed files and how they changed SVN-style (with a ``M`` or
``D`` prefix), ``--name-only`` will just list the changed files, ``--stat``
generates a diffstat view, ``--grep`` filters by grepping on the commit
message, …
Reverting uncommitted changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. danger:: Do *not* use ``git revert``, it does something completely
different than ``bzr revert``
* If you have altered files which you want to revert, use ``git checkout --
<path>``. To revert every file in the directory, use ``git checkout -- .``
* If you have staged a file and you want to unstage it, use ``git reset HEAD
<file>``. This will not revert the file's changes, the file will be marked
as modified again
Diffing: ``git diff``
~~~~~~~~~~~~~~~~~~~~~
``git diff`` is fairly similar to ``bzr diff``: it compares the working copy
with stored content and can be restricted to a given file path. However:
* ``git diff`` compares the working copy and the staging area, not the latest
commit
* ``git diff --staged`` compares the staging area and the latest commit
* ``git diff HEAD`` ignores the staging area and compares the working copy
with the latest commit. More generally ``git diff <commit>`` will diff the
working copy and the specified commit
* to diff between commits, simply pass the commit identifiers (no ``-r``
argument)
* ``git diff --stat`` provides a diffstat-view of the diff, and can be
combined with other flags. It can be used as an intermediate between ``git
status`` and ``git status -s``
Update to a previous revision
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``git checkout`` takes an arbitrary commit, the equivalent to ``bzr update
-r<rev>`` is thus ``git checkout <rev>``.
File from the past
~~~~~~~~~~~~~~~~~~
``bzr cat -r<revision> <filename>`` shows the file ``<filename>`` as it was at
``<revision>``. The Git equivalent is ``git show <revision>:<filename>``
Incorrect last commit: fix it
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the last commit has to be fixed a bit (error, missing data,
incomplete/incorrect commit message) it can be fixed with ``git commit
--amend``. Instead of creating a new commit, it adds whatever is being
committed to the previous commit.
Incorrect last commit: remove it
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the last commit has to be removed entirely (similar to ``bzr uncommit``),
use ``git reset HEAD~1``.
.. danger:: do not use this command or the previous one on commits you have
already pushed
Useful tips
-----------
Partial operations
~~~~~~~~~~~~~~~~~~
``checkout``, ``add``, ``commit``, ``reset`` and ``stash`` can take a ``-p``
flag, which allows operating (staging, reverting, ...) on a subset of the
file. It opens a UI allowing the selection (or not) of each patch hunk, and
even the splitting of hunk if they're too big.
Allows reverting only part of the changes to a file, or cleanly splitting
refactorings and fixes mixed in a file.
short status
~~~~~~~~~~~~
The default ``status`` command is very verbose (though useful, it provides
instructions for reverting things). The ``-s`` flag provides an SVN-like
display instead with just a listing of files and :abbr:`A (Added)`, :abbr:`M
(Modified)` or :abbr:`D (Deleted)` flags next to them. Each file can have 2
flags, the first is for the index (difference between the last commit and the
index) and the and the second is for the working copy (difference between the
index and the working copy).
``checkout`` shortcut
~~~~~~~~~~~~~~~~~~~~~
``checkout -`` will behave like ``cd -``, it will switch to the previously
checked-out branch/commit
.. [#remote-default] by default, ``git remote`` will only give the names of
the various remotes. ``git remote -v`` will give the name
and URL of each remote.
.. [#commit-no-staging] the ``-a`` option will automatically stage modified
and deleted files
.. [#log-patch-empty] but only the changes performed by this actual commit,
for a merge the merged changes are not considered part
of the merge commit
.. _the readme: https://github.com/odoo/odoo/blob/master/README.md#migration-from-bazaar
......@@ -493,7 +493,7 @@ It should be stored securely, and should be generated randomly e.g.
.. code-block:: console
$ python -c 'import base64, os; print(base64.b64encode(os.urandom(24)))'
$ python3 -c 'import base64, os; print(base64.b64encode(os.urandom(24)))'
which will generate a 32 characters pseudorandom printable string.
......@@ -505,9 +505,8 @@ distinction is made according to the browser version in order to be
up-to-date. Odoo is supported on the current browser version. The list
of the supported browsers by Odoo version is the following:
- **Odoo 8:** IE9, Mozilla Firefox, Google Chrome, Safari, Microsoft Edge
- **Odoo 9:** IE11, Mozilla Firefox, Google Chrome, Safari, Microsoft Edge
- **Odoo 10:** Mozilla Firefox, Google Chrome, Safari, Microsoft Edge
- **Odoo 10+:** Mozilla Firefox, Google Chrome, Safari, Microsoft Edge
.. [#different-machines]
to have multiple Odoo installations use the same PostgreSQL database,
......@@ -524,7 +523,7 @@ of the supported browsers by Odoo version is the following:
"self-signed" certificates are easier to deploy on a controlled
environment than over the internet.
.. _regular expression: https://docs.python.org/2/library/re.html
.. _regular expression: https://docs.python.org/3/library/re.html
.. _ARP spoofing: http://en.wikipedia.org/wiki/ARP_spoofing
.. _Nginx termination example:
http://nginx.com/resources/admin-guide/nginx-ssl-termination/
......
......@@ -45,7 +45,7 @@ On Linux, using an installer
.. code-block:: console
$ python /usr/bin/odoo.py -d <database_name> -i web_enterprise --stop-after-init
$ python3 /usr/bin/odoo.py -d <database_name> -i web_enterprise --stop-after-init
* You should be able to connect to your Odoo Enterprise instance using your usual mean of identification.
You can then link your database with your Odoo Enterprise Subscription by entering the code you received
......
......@@ -131,7 +131,7 @@ Configuration
'''''''''''''
The :ref:`configuration file <reference/cmdline/config>` can be found at
:file:`{%PROGRAMFILES%}\\Odoo 10.0-{id}\\server\\odoo.conf`.
:file:`{%PROGRAMFILES%}\\Odoo 11.0-{id}\\server\\odoo.conf`.
The configuration file can be edited to connect to a remote Postgresql, edit
file locations or set a dbfilter.
......@@ -145,13 +145,13 @@ Deb
Community
'''''''''
To install Odoo 10.0 Community on Debian-based distribution, execute the following
To install Odoo 11.0 Community on Debian-based distribution, execute the following
commands as root:
.. code-block:: console
# wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
# echo "deb http://nightly.odoo.com/10.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
# echo "deb http://nightly.odoo.com/11.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
# apt-get update && apt-get install odoo
You can then use the usual ``apt-get upgrade`` command to keep your installation up-to-date.
......@@ -159,7 +159,7 @@ You can then use the usual ``apt-get upgrade`` command to keep your installation
Enterprise
''''''''''
For Odoo 10.0 Enterprise, get the package from the Download_ page. You can then
For Odoo 11.0 Enterprise, get the package from the Download_ page. You can then
use ``gdebi``:
.. code-block:: console
......@@ -205,6 +205,11 @@ When the configuration file is edited, Odoo must be restarted using
RPM
---
.. warning::
As of 2017, Fedora 26 is recommended. CentOS does not have the minimum
Python requirements (3.5) for Odoo 11.0.
.. warning::
with RHEL-based distributions (RHEL, CentOS, Scientific Linux), EPEL_ must
......@@ -220,7 +225,7 @@ RPM
Community
'''''''''
Execute the following commands to install Odoo 10.0 Community on your server:
Execute the following commands to install Odoo 11.0 Community on your server:
.. code-block:: console
......@@ -229,7 +234,7 @@ Execute the following commands to install Odoo 10.0 Community on your server:
$ sudo systemctl enable postgresql
$ sudo systemctl start postgresql
$ sudo yum install yum-utils
$ sudo yum-config-manager --add-repo=https://nightly.odoo.com/10.0/nightly/rpm/odoo.repo
$ sudo yum-config-manager --add-repo=https://nightly.odoo.com/11.0/nightly/rpm/odoo.repo
$ sudo yum install -y odoo
$ sudo systemctl enable odoo
$ sudo systemctl start odoo
......@@ -237,7 +242,7 @@ Execute the following commands to install Odoo 10.0 Community on your server:
Enterprise
''''''''''
For Odoo 10.0 Enterprise, get the package from the Download_ page. Then run:
For Odoo 11.0 Enterprise, get the package from the Download_ page. Then run:
.. code-block:: console
......@@ -245,7 +250,7 @@ For Odoo 10.0 Enterprise, get the package from the Download_ page. Then run:
$ sudo postgresql-setup initdb
$ sudo systemctl enable postgresql
$ sudo systemctl start postgresql
$ sudo yum localinstall odoo_10.0.latest.noarch.rpm
$ sudo yum localinstall odoo_11.0.latest.noarch.rpm
$ sudo systemctl enable odoo
$ sudo systemctl start odoo
......@@ -351,18 +356,23 @@ Installing dependencies
Source installation requires manually installing dependencies:
* Python 2.7.
* Python 3.5+.
- on Linux and OS X, using your package manager if not installed by default
.. note:: on some system, ``python`` command refers to Python 2 (outdated)
or to Python 3 (supported). Make sure you are using the right
version and that the alias ``python3`` is present in your
:envvar:`PATH`
- on Linux and OS X, included by default
- on Windows, use `the official Python 2.7.9 installer
- on Windows, use `the official Python 3 installer
<https://www.python.org/downloads/windows/>`_.
.. warning:: select "add python.exe to Path" during installation, and
reboot afterwards to ensure the :envvar:`PATH` is updated
.. 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
.. note:: if Python is already installed, make sure it is 3.5 or above,
previous versions are not compatible with Odoo.
* PostgreSQL, to use a local database
......@@ -442,7 +452,7 @@ Source installation requires manually installing dependencies:
.. code-block:: doscon
C:\> cd \YourOdooPath
C:\YourOdooPath> C:\Python27\Scripts\pip.exe install -r requirements.txt
C:\YourOdooPath> C:\Python35\Scripts\pip.exe install -r requirements.txt
* *Less CSS* via nodejs
......@@ -519,7 +529,7 @@ Under Windows a typical way to execute odoo would be:
.. code-block:: doscon
C:\YourOdooPath> python odoo-bin -w odoo -r odoo --addons-path=addons,../mymodules --db-filter=mydb$
C:\YourOdooPath> python3 odoo-bin -w odoo -r odoo --addons-path=addons,../mymodules --db-filter=mydb$
Where ``odoo``, ``odoo`` are the postgresql login and password,
``../mymodules`` a directory with additional addons and ``mydb`` the default
......@@ -552,13 +562,11 @@ default db to serve on localhost:8069
.. _pip: https://pip.pypa.io
.. _macports: https://www.macports.org
.. _homebrew: http://brew.sh
.. _Visual C++ Compiler for Python 2.7:
http://www.microsoft.com/en-us/download/details.aspx?id=44266
.. _wheels: https://wheel.readthedocs.org/en/latest/
.. _virtual environment: http://docs.python-guide.org/en/latest/dev/virtualenvs/
.. _pywin32: http://sourceforge.net/projects/pywin32/files/pywin32/
.. _the repository: https://github.com/odoo/odoo
.. _git: http://git-scm.com
.. _Editions: https://www.odoo.com/pricing#pricing_table_features
.. _nightly: https://nightly.odoo.com/10.0/nightly/
.. _nightly: https://nightly.odoo.com/11.0/nightly/
.. _extra: https://nightly.odoo.com/extra/
#!/usr/bin/env python
#----------------------------------------------------------
# odoo cli
#
# To install your odoo development environement type:
#
# wget -O- https://raw.githubusercontent.com/odoo/odoo/10.0/setup/setup_dev.py | python
#
# The setup_* subcommands used to boostrap odoo are defined here inline and may
# only depends on the python 2.7 stdlib
#
# The rest of subcommands are defined in odoo/cli or in <module>/cli by
# subclassing the Command object
#
#----------------------------------------------------------
from __future__ import print_function
import os
import re
import sys
import subprocess
GIT_HOOKS_PRE_PUSH = """
#!/usr/bin/env python2
import re
import sys
if re.search('github.com[:/]odoo/odoo.git$', sys.argv[2]):
print "Pushing to /odoo/odoo.git is forbidden, please push to odoo-dev, use --no-verify to override"
sys.exit(1)
"""
def printf(f,*l):
print("odoo:" + f % l)
def run(*l):
if isinstance(l[0], list):
l = l[0]
printf("running %s", " ".join(l))
subprocess.check_call(l)
def git_locate():
# Locate git dir
# TODO add support for os.environ.get('GIT_DIR')
# check for an odoo child
if os.path.isfile('odoo/.git/config'):
os.chdir('odoo')
path = os.getcwd()
while path != os.path.abspath(os.sep):
gitconfig_path = os.path.join(path, '.git/config')
if os.path.isfile(gitconfig_path):
release_py = os.path.join(path, 'odoo/release.py')
if os.path.isfile(release_py):
break
path = os.path.dirname(path)
if path == os.path.abspath(os.sep):
path = None
return path
def cmd_setup_git():
git_dir = git_locate()
if git_dir:
printf('git repo found at %s',git_dir)
else:
run("git", "init", "odoo")
os.chdir('odoo')
git_dir = os.getcwd()
if git_dir:
# push sane config for git < 2.0, and hooks
#run('git','config','push.default','simple')
# alias
run('git','config','alias.st','status')
# merge bzr style
run('git','config','merge.commit','no')
# pull let me choose between merge or rebase only works in git > 2.0, use an alias for 1
run('git','config','pull.ff','only')
run('git','config','alias.pl','pull --ff-only')
pre_push_path = os.path.join(git_dir, '.git/hooks/pre-push')
open(pre_push_path,'w').write(GIT_HOOKS_PRE_PUSH.strip())
os.chmod(pre_push_path, 0755)
# setup odoo remote
run('git','config','remote.odoo.url','https://github.com/odoo/odoo.git')
run('git','config','remote.odoo.pushurl','git@github.com:odoo/odoo.git')
run('git','config','--add','remote.odoo.fetch','dummy')
run('git','config','--unset-all','remote.odoo.fetch')
run('git','config','--add','remote.odoo.fetch','+refs/heads/*:refs/remotes/odoo/*')
# setup odoo-dev remote
run('git','config','remote.odoo-dev.url','https://github.com/odoo-dev/odoo.git')
run('git','config','remote.odoo-dev.pushurl','git@github.com:odoo-dev/odoo.git')
run('git','remote','update')
# setup 10.0 branch
run('git','config','branch.10.0.remote','odoo')
run('git','config','branch.10.0.merge','refs/heads/10.0')
run('git','checkout','10.0')
else:
printf('no git repo found')
def cmd_setup_git_dev():
git_dir = git_locate()
if git_dir:
# setup odoo-dev remote
run('git','config','--add','remote.odoo-dev.fetch','dummy')
run('git','config','--unset-all','remote.odoo-dev.fetch')
run('git','config','--add','remote.odoo-dev.fetch','+refs/heads/*:refs/remotes/odoo-dev/*')
run('git','config','--add','remote.odoo-dev.fetch','+refs/pull/*:refs/remotes/odoo-dev/pull/*')
run('git','remote','update')
def cmd_setup_git_review():
git_dir = git_locate()
if git_dir:
# setup odoo-dev remote
run('git','config','--add','remote.odoo.fetch','dummy')
run('git','config','--unset-all','remote.odoo.fetch')
run('git','config','--add','remote.odoo.fetch','+refs/heads/*:refs/remotes/odoo/*')
run('git','config','--add','remote.odoo.fetch','+refs/tags/*:refs/remotes/odoo/tags/*')
run('git','config','--add','remote.odoo.fetch','+refs/pull/*:refs/remotes/odoo/pull/*')
def setup_deps_debian(git_dir):
debian_control_path = os.path.join(git_dir, 'debian/control')
debian_control = open(debian_control_path).read()
debs = re.findall('python3-[0-9a-z]+',debian_control)
debs += ["postgresql"]
proc = subprocess.Popen(['sudo','apt-get','install'] + debs, stdin=open('/dev/tty'))
proc.communicate()
def cmd_setup_deps():
git_dir = git_locate()
if git_dir:
if os.path.isfile('/etc/debian_version'):
setup_deps_debian(git_dir)
def setup_pg_debian(git_dir):
cmd = ['sudo','su','-','postgres','-c','createuser -s %s' % os.environ['USER']]
subprocess.call(cmd)
def cmd_setup_pg():
git_dir = git_locate()
if git_dir:
if os.path.isfile('/etc/debian_version'):
setup_pg_debian(git_dir)
def cmd_setup():
cmd_setup_git()
cmd_setup_deps()
cmd_setup_pg()
def main():
# registry of commands
g = globals()
cmds = dict([(i[4:],g[i]) for i in g if i.startswith('cmd_')])
# if curl URL | python2 then use command setup
if len(sys.argv) == 1 and __file__ == '<stdin>':
cmd_setup()
elif len(sys.argv) == 2 and sys.argv[1] in cmds:
cmds[sys.argv[1]]()
else:
sys.exit('Unknow command. Command available: %r' % (list(cmds,)))
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment