Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.
The removed helpers are:
* izip, imap and ifilter
* unichr, text_type
* implements_to_string, implements_iterator
* string_types, integer_types
* to_native
The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)
[REM] pyjsparser: remove PY3 shims
They're no longer necessary as Odoo doesn't officially support python 2
anymore.
closesodoo/odoo#28519
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.
This includes:
* calls to imap/izip/ifilter replaced by map/zip/filter
* uses of text_type replaced by str
* uses of unichr replaced by chr
* calls to implements_to_string, implements_iterator removed
* string_types and integer_types replaced by str, int respectively
* calls to to_native replaced by calls to to_text
This is done in preparation to the removal of these deprecated helpers
in the following commit.
- When a tracked field is modified, a mail.message is created.
When create is called its tries to fill missing values with "default
values".
It first tries to find the default values in the context, which may
occurs.
For example, modifying a tracked field on a subtask will add a key
"default_parent_id" in the context, which is the parent_id of the project.task.
Create will try to use "default_parent_id" for the mail.message
parent_id field, which make the SQL Request invalid.
The dateutil package uses lazy import to selectively expose its
features: `parser`, `relativedelta`, `rrule`, `tz`.
Depending on installed modules and order of initialization, there was no
guarantee that a given feature was already loaded during the preparation
of the action context.
This patch ensures that we always preload the feature set we need, and
only that feature set. This way we have a consistent `dateutil` lib in
the action context at all times.
The dateutil package uses lazy import to selectively expose its
features: `parser`, `relativedelta`, `rrule`, `tz`.
Depending on installed modules and order of initialization, there was no
guarantee that a given feature was already loaded during the preparation
of the action context.
This patch ensures that we always preload the feature set we need, and
only that feature set. This way we have a consistent `dateutil` lib in
the action context at all times.
The function `stripped_sys_argv` was broken because of `itertools.groupby`
being hidden by the local `groupby`. Aligning APIs makes the local one a valid
substitution for `itertools.groupby`.
As this class has grown a lot some methods have been put a bit anywhere
in the file. To prepare future improvements it is easier to regroup
them a bit.
remove_accent from mail_alias is also moved to tools in order to separate
tools from business or class specific code.
- Install French language
- Set language of Customer A to French
- Create an invoice due in the past
- Open the Customer Statements
The customer statement of A is translated in French, but the amounts are
formatted in the company's user language (English by default).
We add the possiblity to take into account the lang in the context when
calling `formatLang`.
By using the thread's repr() we get its type, name, daemon status and
ID, all at one time. No need to include them separately.
Fall back to the threadId in case the repr() is empty, which can
happen for exotic threads (the gevent main thread seems to be like that)
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.
All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.
Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.
Also removed some dead code or improved the API to remove unnecessary
conversions.
* unichr -> pycompat (builtin removed from Python 3, ``chr`` has
become unicode-aware)
* Psycopg2 bytea values (binary fields) are returned as memoryviews in
P3 but buffers in P2
* Both bytes and (text) strings are conventionally iterable in
P3 (they have a __iter__ method), so fix up the exclusion pattern
for flatten
* remove references to basestring & unicode (use relevant pycompat
helpers)
* remove some str calls (either entirely or replaced by relevant
helper, either text or native)
* use better API to avoid unnecessary conversions
* remove some XML declarations in views
This patch modifies Root#dispatch() in order to keep the httprequest url
in the current thread's attribute and use if for dumpstacks and the
phantomjs tests remaining requests handling.
Also added a counter in order to avoid looping forever when trying to join unclosed http requests
in phantomjs test suite after a phantomjs failure + added a log.warning in such a case so it's easier to troubleshoot runbot's ir.logging.
When xlsx is used, the worksheet name may be longer than 31 chars and
raise an exception.
This fix will troncate the name up to 31 chars and will remove invalid
chars.
Similar patch was already done at 0122c05eff for xlwt
xlsxwriter 0.9.8 has added a parameter worksheet_class=None so adding **kw to be
compatible with installs with the latest version (requirements.txt asks for
version 0.9.3)
Closes#18077
opw-751157