Skip to content

[FW] 16.0 py311 moc#112450

Closed
fw-bot wants to merge 4 commits intoodoo:masterfrom
odoo-dev:master-16.0-py311-moc-zGUO-fw
Closed

[FW] 16.0 py311 moc#112450
fw-bot wants to merge 4 commits intoodoo:masterfrom
odoo-dev:master-16.0-py311-moc-zGUO-fw

Conversation

@fw-bot
Copy link
Copy Markdown
Contributor

@fw-bot fw-bot commented Feb 10, 2023

Since the next imminent release of Debian Bookworm will come with Python 3.11 as some other distros (like Fedora 37) this PR adapts Odoo 16.0 to work with Python 3.11.

Note:
This is an excerpt from this testing branch that was made to test against the Jammy and Bookworm distributions.

Forward-Port-Of: #112317

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Feb 10, 2023

Pull request status dashboard

@fw-bot fw-bot mentioned this pull request Feb 10, 2023
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Feb 10, 2023

@d-fence @xmo-odoo cherrypicking of pull request #112317 failed.

stderr:

17:25:11.171764 git.c:455               trace: built-in: git cherry-pick 9b8b8cfb7ff20646317b02bbee4b74f2b9182024
error: Cherry-picking is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: cherry-pick failed
----------
status:

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels Feb 10, 2023
@C3POdoo C3POdoo added the RD research & development, internal work label Feb 10, 2023
pimodoo and others added 4 commits February 13, 2023 08:45
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.
As getdefaultlocale is deprecated in 3.11 in favor of getlocale which is
available since at least 3.0.
Since python/cpython#18544, unittest mock is not able to properly find
the "odoo.tools.config".

When trying to patch the `options` dictionnary, it leads to
`AttributeError: module 'odoo.tools.config' has no attribute 'options'`

In order to have the tests
working in python <= 3.11, we have to import the config module and patch
the options in place.
Since Python 3.11, sampling from a set deprecated, the population must
be a sequence.

This commit applies the suggested fix.

Also, the filtering of the deprecation warning about sampling from set
can be disabled when the python version is not 3.9. This warning was
wrongly triggered since 3.9 because recordsets are bot a sequence and a
set.
This was fixed in python 3.10, see https://bugs.python.org/issue42470
@d-fence d-fence force-pushed the master-16.0-py311-moc-zGUO-fw branch from 4cf84a2 to 6a461d6 Compare February 13, 2023 08:07
@C3POdoo C3POdoo requested review from a team, rco-odoo and ryv-odoo and removed request for a team February 13, 2023 08:08
@fw-bot fw-bot mentioned this pull request Feb 14, 2023
@xmo-odoo
Copy link
Copy Markdown
Collaborator

@robodoo override=ci/security

@d-fence
Copy link
Copy Markdown
Contributor

d-fence commented Feb 14, 2023

robodoo r+

robodoo pushed a commit that referenced this pull request Feb 14, 2023
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.

Part-of: #112450
robodoo pushed a commit that referenced this pull request Feb 14, 2023
As getdefaultlocale is deprecated in 3.11 in favor of getlocale which is
available since at least 3.0.

Part-of: #112450
robodoo pushed a commit that referenced this pull request Feb 14, 2023
Since python/cpython#18544, unittest mock is not able to properly find
the "odoo.tools.config".

When trying to patch the `options` dictionnary, it leads to
`AttributeError: module 'odoo.tools.config' has no attribute 'options'`

In order to have the tests
working in python <= 3.11, we have to import the config module and patch
the options in place.

Part-of: #112450
robodoo pushed a commit that referenced this pull request Feb 14, 2023
Since Python 3.11, sampling from a set deprecated, the population must
be a sequence.

This commit applies the suggested fix.

Also, the filtering of the deprecation warning about sampling from set
can be disabled when the python version is not 3.9. This warning was
wrongly triggered since 3.9 because recordsets are bot a sequence and a
set.
This was fixed in python 3.10, see https://bugs.python.org/issue42470

closes #112450

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
@robodoo robodoo temporarily deployed to merge February 14, 2023 08:00 Inactive
@robodoo robodoo closed this Feb 14, 2023
robodoo pushed a commit that referenced this pull request Sep 29, 2023
Complement on 1e35315 (#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

closes #137099

X-original-commit: 3227ae4
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Sep 29, 2023
Complement on 1e35315 (#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

closes #137078

X-original-commit: 3227ae4
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Sep 29, 2023
Complement on 1e35315 (#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

closes #137089

X-original-commit: 3227ae4
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
sbidoul pushed a commit to acsone/odoo that referenced this pull request Jan 16, 2024
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...
hugosantosred pushed a commit to factorlibre/odoo that referenced this pull request Mar 4, 2024
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...
hugosantosred pushed a commit to factorlibre/odoo that referenced this pull request Mar 5, 2024
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...
robodoo pushed a commit that referenced this pull request Mar 6, 2024
Complement on 1e35315 (#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

closes #156438

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Mar 6, 2024
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

X-original-commit: 22ad0a3
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Mar 6, 2024
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

X-original-commit: 22ad0a3
robodoo pushed a commit that referenced this pull request Mar 6, 2024
Complement on 1e35315 (#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

closes #156700

X-original-commit: 22ad0a3
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Xavier-Do pushed a commit to odoo-dev/odoo that referenced this pull request Mar 28, 2024
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...
robodoo pushed a commit that referenced this pull request Mar 29, 2024
Complement on 1e35315 (#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

Part-of: #151989
gurneyalex pushed a commit to camptocamp/odoo that referenced this pull request Feb 16, 2026
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

Part-of: odoo#151989
gurneyalex pushed a commit to camptocamp/odoo that referenced this pull request Feb 16, 2026
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

Part-of: odoo#151989
gurneyalex pushed a commit to camptocamp/odoo that referenced this pull request Feb 17, 2026
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

Part-of: odoo#151989
gurneyalex pushed a commit to camptocamp/odoo that referenced this pull request Mar 20, 2026
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

Part-of: odoo#151989
gurneyalex pushed a commit to camptocamp/odoo that referenced this pull request Mar 20, 2026
Complement on 1e35315 (odoo#112450):
alongside the split between forwards and backwards jump we missed that
3.11 has a specialized version of each for the `is None` and `is not
None` cases. A use of that was added in standard in 16.5 (odoo#120446) but
more generally it makes sense that server actions would support
conditional tests against `None`, probably...

Part-of: odoo#151989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

16.2 conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants