The x2many "create" command is now like: `(0, ref, vals)`, where `ref` is an
arbitrary reference that may be used to identify a new line in the relation.
The reference is returned in a similar command by the method `onchange`.
`onchange` now supports self-modifying x2many fields.
When re-launching Odoo on an existing database in Python 3.6[0] it's
possible that the scheduler will preempt the main thread
mid-module-import and run the cron thread which causes registry (and
module) initialisation with only a subset of the Python files loaded
and thus e.g. tries loading auth_crypt with a registry in which none
of res has been loaded makes for interesting situations.
Delay spawning the cron thread until *after* the registry preload at
least, though I don't think that actually entirely fixes the issue.
[0] and probably in any Python >= 3.3, I'm guessing it's related to
the per-module import locks which replaced the old global lock:
https://docs.python.org/3.3/whatsnew/3.3.html#a-finer-grained-import-lock
though since ir.cron has little reason to import anything it could
also just be Python 3 scheduler changes which allow/cause a
context-switch during imports while the Python 2 scheduler would
not allow that. IDK.
This will avoid useless warning when the file does not exists and
possible false positive errors in case of invalid config in this file.
Also strip output
Cherry-pick of c955c3051c
The behavior is no longer implemented by the web client. Implement it
server-side as part of the onchange mechanism, simply by defining onchange
methods for the fields that have the flag.
P2 and P3 subprocess stdout seem to have very odd/different behaviours
in the face of mixing select and buffering.
Use raw/low-level IO (os.read) with select to try and fix that
up. Also read more than one byte at a time since os.read will not
block *if* the fd is readable, it will just get whatever data is
immediately available.
It may be confusing that a constraint is not triggered in a name_create call.
Testing the absence of value should be done in an override of create, not in a
api.constrains.
Closes#18382
Before this patch, if some view had both `inherit_id` and `website_id`,
its inheritances were being applied even in different websites.
After this patch, if a view inherits from another, inheritances will only apply
when both views belong to the same (or none) website.
Refactoring based on the pr #17635
This closesodoo/odoo#17635
Without this patch, all Qweb cache is shared among all available websites.
This turns impossible in practice to actually create multiple websites with
different look.
This closesodoo/odoo#18462
As of P3 socket.error is replaced by IOError and the underlying error
code must be accessed with `.errno `. This also worked in P2, so simply
use that all the time.
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.
No formal decision there, and the stdlib API seems like a PITA as it's
based around native strings, not bytes and not text.
* try to use cross-model API instead of random encode/decode
* unicode all the mail_template things
* formataddr *requires* a text tuple now
In P2, formataddr((False, False)) "worked" (generated "False
<False>"), in P3 it will fail and blow up.
* attachments are quite definitely bytes
* remove try_coerce_ascii because it's garbage