Commit Graph
25 Commits
Author SHA1 Message Date
Christophe Monniez 65c8814a2f [FIX] various: replace deprecated currentThread method
CurrentThread is now really deprecated in Python 3.10 ... Time to
change.

Part-of: odoo/odoo#91927
2022-05-23 08:29:52 +02:00
Christophe Monniez 38deea6730 [IMP] requirements: adapt to latest focal versions
With the release of Debian Bullseye the time has come for the balancing
act by trying to update the requirements.

The constraints are the following:
    * Stick as close as possible to python3-* Debian packages versions
      of the current Debian stable.
    * Same but for the Ubuntu LTS version.
    * When one of the above package is patched by Debian or Ubuntu
      maintainers, set the upstream version that includes the patch if any.

Also, as support for python < 3.7 is dropped, some cleanup can be done.

The `reportlab / pillow` combo is a special case:
    * Pillow has to be updated to 8.1.2 as this version includes the
      security patches that were added to Ubuntu package 7.0.0 (Focal).
    * Reportlab crashes with 8.1.2 with version prior to 3.5.54 [0].
      The problem does not occur on Ubuntu Focal as both versions from
      the Ubuntu packaging are compatible.

So the reportlab 3.5.59 is chosen as it's the Debian Bullseye version
and to avoid multiple lines for a few minor versions.

[0] https://hg.reportlab.com/hg-public/reportlab/rev/0cf382dab63b

X-original-commit: 794677fb6a3391379200eb2144a6ed372e89c17a
Part-of: odoo/odoo#78781
2021-10-21 19:09:47 +00:00
Julien Castiaux eded14b4c4 [ADD] fields.py: New x2many command helper
We provide a new helper class to help redact x2many commands for create
and write methods. To ensure best compatibility with the xmlrpc layer we
do not change the protocole, the commands are still 3-elements tuples
where the first element is still an integer in between 0 and 6. The
helper class provide the cannonical constants and static methods to ease
working with the commands. The new helper class is also available in QWeb.

Developers are encouraged to transition their code so it uses this new
helper class.

Task: 2366606
2020-11-30 10:16:09 +00:00
Xavier-Do 9c26d4d870 [IMP] core: rename upgrades-paths to upgrade-path
Since this option is soon to be used, this rename is a last tweek
to make it more logical to use since it will point to a single
upgrade dir most of the time.

closes odoo/odoo#44593

X-original-commit: 1c8e2809fb296abce6114b7da906d48a240df418
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-02-04 13:19:02 +00:00
fw-bot 48b51e67c9 [FIX] module.py: --upgrades-paths dynamic hooks
Migration have long been only accessible thanks to a symlink from
`odoo.base.maintenance` to our private migration repository. Thank to
the change of bbb1a8f it is now possible to give a load the
migrations scripts from a path given in options.

The `initialize_sys_path` function has been updated to hooks the new
paths or the legacy symlink and to provide aliases to the previous
import logic to ensure backward compatibility.

`odoo.upgrades` (`community/odoo/upgrades`) is a new namespace that hook
all `--upgrades-paths` directories or the
`community/odoo/base/maintenance/migrations` symlink if none is previded.
`odoo.addons.base.maintenance.migrations` has been made an alias to
`odoo.upgrades`.

The `odoo.upgrades` is the desired method for accessing migrations
scripts and should be used by all new scripts.

closes odoo/odoo#44117

Task: 2178274
X-original-commit: d963cc05acd882729c4eb5ab940dae2a2197e55a
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-01-28 14:16:02 +00:00
Julien Castiaux 7ef68e4b0e [FIX] core: using absolute paths
Start odoo-bin using a tier module (like `python3 -m pdb odoo-bin`), the
odoo/addons __path__ contains the relative link to the modules instead
of the absolute link like when directly started (`python3 odoo-bin`).

This cause trouble importing modules because it reuses the relative path
from within other directories.

closes odoo/odoo#39182

X-original-commit: 941e051fc6b33e7a90400c77d63d589049b027a6
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-10-22 13:17:03 +00:00
Martin Trigaux e7c70e3635 [FIX] packaging,doc: minimum python version is 3.6
In 12.0 it was 3.5 but for 13.0, it is acceptable 3.6.
Debian Buster has 3.7 and Ubuntu 18.04 LTS has 3.6
This will avoid undeterminist errors with OrderedDict

CentOS 7 still does not ship python3 by default but it is possible to
install it and CentOS 8 with python 3.6 was released in septembre 2019

closes odoo/odoo#38827

X-original-commit: 14e3e7524c2edd08ddf19afe512cb4462d070c0b
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-10-15 16:07:07 +00:00
Christophe Simonis 3faea8fbf8 [MERGE] forward port branch saas-12.4 up to f26de445e5 2019-08-21 10:10:11 +02:00
Christophe Simonis 168e54d488 [MERGE] forward port branch 12.0 up to 32039b2ab4 2019-08-19 18:57:08 +02:00
Andrea Grazioso (agr-odoo) f8978fc235 [FIX] odoo: zlib error in PyPDF2
Pdf files created with third party tools could trigger an exception in
several modules that attempt to manipulate them (see example below).

```
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2239, in mergePage
self._mergePage(page2)
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2277, in _mergePage
originalContent, self.pdf))
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2199, in _pushPopGS
stream = ContentStream(contents, pdf)
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2673, in __init__
stream = BytesIO(b_(stream.getData()))
File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 845, in getData
decoded._data = filters.decodeStreamData(self)
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 346, in decodeStreamData
data = FlateDecode.decode(data, stream.get("/DecodeParms"))
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 111, in decode
data = decompress(data)
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 49, in decompress
return zlib.decompress(data)
zlib.error: Error -5 while decompressing data: incomplete or truncated stream
```

This is caused by the decompression function used by default in PyPDF2
which uses a limited buffer, unable to store all the data.

The solution, as per
[zlib documentation](https://docs.python.org/3/library/zlib.html#zlib.decompressobj),
is to use an intermediate ```decompressobj``` object to handle
the decompression.
However we do not directly control the library, which is also used
multiple times in the codebase so we decided to apply a fix directly into
the core module instead of patching every call.

opw-2048029

closes odoo/odoo#35646

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-14 11:55:53 +00:00
Martin Trigaux f4319580e5 [ADD] tools: lazy translation method
Introduces the method _lt

The translation method is now evaluated lazily.
It allows to declare global variables with translatable content

e.g. this code will now work:

LABEL = _lt("User")

def _compute_label(self):
    context = {'lang': self.partner_id.lang}
    self.user_label = LABEL
2019-08-01 12:39:56 +00:00
Lucas Perais (lpe) 0e85b5b132 [FIX] odoo: patch babel for "World" language territory
Following c844d66091
where generic Arabic (World) is coded ar_AA
but babel doesn't support this

Instead, babel understands xx_001 for World generic languages

http://www.unicode.org/reports/tr35/#unicode_region_subtag
http://www.unicode.org/reports/tr35/#unicode_region_subtag_validity
BCP47: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

OPW 1961396

closes odoo/odoo#32344

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-04-03 14:03:00 +00:00
Adrian Torres 2824efee4b [FIX] base: ensure python version >= 3.5
Odoo 12.0 does *not* officially support any python version below 3.5,
but no effort had been made to gracefully announce this to the end user
if they were to run Odoo in an unsupported python version.

This is done because Odoo 12.0 uses py3-only constructs which can
and will raise different errors if ran in python 2.

With this patch, Odoo will display an appropriate error message and won't
launch at all unless it is being run with python 3.5 or greater.

closes odoo/odoo#28502
2018-11-08 11:53:35 +00:00
Stefan Rijnhart 4d8b0b723b [FIX] base: don't hardcode the new admin user id
There is no longer a priviledged user and the user named "Administrator" may
not have the id 2.

Instead of hardcoding an id, uses a group-based check

Remove the global variable ADMINUSER_ID to ensure nobody is using it (as it can
be a source of bugs when base.user_admin is not ID 2)

closes odoo/odoo#27432
2018-10-23 14:40:02 +00:00
Sébastien Theys 1addade28b [FIX] base: correctly detect when admin logs in
Since 2f7c03d9ca it's not possible to log in as user 1.

However, we reset the base url when the admin logs in, which is now user 2.

This fixes wkhtml2pdf was not able to load css file, and probably some other side effects.

PR: none
Task: 1879620
2018-08-24 15:55:46 +02:00
Christophe Monniez bb14c41663 [REF] core: Remove psycogreen dependency
Purpose:
    The psycogreen module is unmaintained. Last source update was in
    2015 and last pypi package was in 2012. Odoo only use a small
    part of the psycogreen module that could be written directly in
    the odoo code. This commit reproduce the small function from
    psycogreen used in ODoo and remove all depencies from it.
    Also the copyright and license are honored and the documentation
    is updated accordingly.

    pypi pckage: https://pypi.python.org/pypi/psycogreen
    bitbucket repos: https://bitbucket.org/dvarrazzo/psycogreen/
2017-10-09 18:56:57 +02:00
Stéphane Bidoul (ACSONE) 8bf06adc8d [FIX] namespace packages: move from pkg_resources-style to pkg_util
Deprecates the previous pkg_resources-style packages. Our use was
not entirely spec compliant, and it broke with setuptools 31.
More information in https://github.com/odoo/odoo/pull/15718

Instead, use the pkgutil-style namespace packages.
This is spec compliant as long as all other distributions providing
odoo.addons use PEP 420 namespace packages (i.e. no __init__.py).
So this mechanism fully works on Python 3 only, but does not break
anything on Python 2.

See also:
https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages

Closes #19517
Fixes #15718
2017-09-18 16:05:31 +02:00
Laurent Smet 3425752eac [REM] odoo/report: remove deprecated stuff
- RML Reports
- Webkit Reports (most part already removed by 13b9982c62)
- LocalService in netsvc.py
- rename attributes like rml_% to report_%
- rename ir.actions.report.xml to ir.actions.report
- allow rendering directly on an ir.actions.report by calling render method
- remove 'controller' report_type
- remove unused res.font stuff
- remove print_report method in models.py (not used)
- restore removed call to pdftotext process in test_reports
2017-05-08 09:22:56 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Christophe Simonis 557feb950c [MERGE] forward port branch 10.0 up to 482fd04167 2017-01-10 13:50:48 +01:00
Nicolas Lempereur 07bf7bf4f3 [FIX] odoo-bin: server UTC timezone on windows
On UNIX, the timezone modules conversions can be reset by using
`time.tzset()`. On windows this is not available and the timezone (TZ)
environment variable must be set before the first import of time module.

If not, all datetime gotten in python without specifying UTC (such as
datetime.datetime.now) could be wrong.

This was fixed with 4a77c6a0 in 2013, but has come back since 389c2ba97b
imported pkg_resources (which do  a `time` module import) before that.

closes #14926
opw-693764
2017-01-06 14:19:09 +01:00
Yannick Tivisse 98cb4719db [REM] workflow: Remove workflow engine, documentation and tests 2016-11-23 11:52:39 +01:00
Christophe Simonis 467a958ab0 [FIX] core: handle gevent on command line correctly 2016-09-30 12:05:49 +02:00
Raphael Collet 4a700d0ad9 [FIX] odoo: rename imports and adapt import hooks 2016-09-02 17:28:12 +02:00
Raphael Collet 9e64f9f951 [REF] openerp: move openerp to odoo 2016-09-02 17:28:12 +02:00