Skip to content

[FIX] base_multi_image: Use env in uninstall_hook#677

Merged
StefanRijnhart merged 4 commits intoOCA:10.0from
LasLabs:hotfix/10.0/base_multi_image-uninstall_hook
Jan 16, 2017
Merged

[FIX] base_multi_image: Use env in uninstall_hook#677
StefanRijnhart merged 4 commits intoOCA:10.0from
LasLabs:hotfix/10.0/base_multi_image-uninstall_hook

Conversation

@lasley
Copy link
Copy Markdown
Contributor

@lasley lasley commented Dec 26, 2016

  • Uninstall hook should use new API instead of old, which doesn’t exist anymore

This should fix the Travis fails in OCA/product-attribute#201

* Uninstall hook should use new API instead of old, which doesn’t exist anymore
@lasley lasley added this to the 10.0 milestone Dec 26, 2016
Image.unlink(cr, SUPERUSER_ID, ids)
env = api.Environment(cr, SUPERUSER_ID, dict())
Image = env["base_multi_image.image"]
ids = Image.search(env, [("owner_model", "=", model)])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to call the variable records or recs

@pedrobaeza
Copy link
Copy Markdown
Member

registry still exists on v10: https://github.com/OCA/OCB/blob/10.0/odoo/modules/registry.py#L23.

What is the value of the argument registry passed to the function?

@lasley
Copy link
Copy Markdown
Contributor Author

lasley commented Dec 26, 2016

@pedrobaeza Registry is valid, I just figured that while the env was there I should use it. Is that not the case?

@lasley
Copy link
Copy Markdown
Contributor Author

lasley commented Dec 26, 2016

The real error I am circumventing is the cr, SUPERUSER_ID being sent into the .search method: https://travis-ci.org/OCA/product-attribute/jobs/180247258#L559 - the switch from registry just seemed like bonus while I was there honestly.

@pedrobaeza
Copy link
Copy Markdown
Member

Have you tried to use directly registry, but without cr and SUPERUSER_ID?

@lasley
Copy link
Copy Markdown
Contributor Author

lasley commented Dec 26, 2016

Yeah but an environment is still required as the first argument, so I don't see the different from just using the environment itself. Both of these work:

    env = api.Environment(cr, SUPERUSER_ID, dict())
    Image = env["base_multi_image.image"]
    images = Image.search([("owner_model", "=", model)])
    images.unlink()
    env = api.Environment(cr, SUPERUSER_ID, dict())
    Image = registry["base_multi_image.image"]
    images = Image.search(env, [("owner_model", "=", model)])
    images.unlink()

But the former seems cleaner and more OOP IMO

I am about to double check all of this in a new install though just to make sure

@pedrobaeza
Copy link
Copy Markdown
Member

OK, thanks for the tests.

@lasley
Copy link
Copy Markdown
Contributor Author

lasley commented Dec 26, 2016

Hmmm yeah ok so that worked too, without the env. In hindsight I'm actually not sure why it worked the first time around when I passed an env to the .search, but it definitely does.

Simplified version, which I'm pretty sure is what you were thinking of, is pushed. Confirmed it works too 😄

Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, indeed that was my idea.

To the merger: please squash on merge

@lasley
Copy link
Copy Markdown
Contributor Author

lasley commented Jan 10, 2017

@StefanRijnhart StefanRijnhart merged commit 0addd55 into OCA:10.0 Jan 16, 2017
@lasley lasley deleted the hotfix/10.0/base_multi_image-uninstall_hook branch January 16, 2017 16:32
sebalix pushed a commit to osiell/server-tools that referenced this pull request Jan 23, 2017
* [FIX] base_multi_image: Use env in uninstall_hook
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jun 12, 2018
* [FIX] base_multi_image: Use env in uninstall_hook
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jun 12, 2018
* [FIX] base_multi_image: Use env in uninstall_hook
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jun 12, 2018
* [FIX] base_multi_image: Use env in uninstall_hook
hugosantosred pushed a commit to factorlibre/server-tools that referenced this pull request Aug 20, 2018
* [FIX] base_multi_image: Use env in uninstall_hook
devang-dreambits pushed a commit to devang-dreambits/server-tools that referenced this pull request Mar 4, 2019
* [FIX] base_multi_image: Use env in uninstall_hook
angelmoya pushed a commit to PESOL/server-tools that referenced this pull request Mar 7, 2019
* [FIX] base_multi_image: Use env in uninstall_hook
javierjcf pushed a commit to Comunitea/server-tools that referenced this pull request Sep 9, 2020
* [FIX] base_multi_image: Use env in uninstall_hook
hailangvn pushed a commit to hailangvn/server-tools that referenced this pull request May 16, 2021
* [FIX] base_multi_image: Use env in uninstall_hook
TobiasSorg pushed a commit to AmetrasIntelligence/server-tools that referenced this pull request Nov 26, 2021
* [FIX] base_multi_image: Use env in uninstall_hook
hailangvn pushed a commit to hailangvn/server-tools that referenced this pull request Jan 24, 2022
* [FIX] base_multi_image: Use env in uninstall_hook
flachica pushed a commit to flachica/server-tools that referenced this pull request May 6, 2022
* [FIX] base_multi_image: Use env in uninstall_hook
flachica pushed a commit to flachica/server-tools that referenced this pull request May 6, 2022
* [FIX] base_multi_image: Use env in uninstall_hook
flachica pushed a commit to flachica/server-tools that referenced this pull request May 17, 2022
* [FIX] base_multi_image: Use env in uninstall_hook
mtelahun pushed a commit to mtelahun/server-tools that referenced this pull request Sep 5, 2022
* [FIX] base_multi_image: Use env in uninstall_hook
clb-openfire pushed a commit to odof/server-tools that referenced this pull request Apr 4, 2023
* [FIX] base_multi_image: Use env in uninstall_hook
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Apr 26, 2023
* [FIX] base_multi_image: Use env in uninstall_hook
Ricardoalso pushed a commit to camptocamp/server-tools that referenced this pull request Sep 19, 2023
* [FIX] base_multi_image: Use env in uninstall_hook
omalbastin pushed a commit to omalbastin/server-tools that referenced this pull request Jan 5, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 9, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 19, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 19, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
psugne pushed a commit to versada/server-tools that referenced this pull request Oct 9, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (12.0)
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
* [FIX] base_multi_image: Use env in uninstall_hook
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
* [FIX] base_multi_image: Use env in uninstall_hook
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
* [FIX] base_multi_image: Use env in uninstall_hook
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
* [FIX] base_multi_image: Use env in uninstall_hook
oerp-odoo pushed a commit to versada/server-tools that referenced this pull request Feb 14, 2025
* [FIX] base_multi_image: Use env in uninstall_hook
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Feb 24, 2025
* [FIX] base_multi_image: Use env in uninstall_hook
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Aug 19, 2025
* [FIX] base_multi_image: Use env in uninstall_hook
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Jan 12, 2026
* [FIX] base_multi_image: Use env in uninstall_hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants