Skip to content

[10.0][FIX] base_multi_image: Uninstall hook#709

Merged
pedrobaeza merged 3 commits intoOCA:10.0from
LasLabs:bugfix/10.0/base_multi_image-hook-revisited
Jan 23, 2017
Merged

[10.0][FIX] base_multi_image: Uninstall hook#709
pedrobaeza merged 3 commits intoOCA:10.0from
LasLabs:bugfix/10.0/base_multi_image-hook-revisited

Conversation

@lasley
Copy link
Copy Markdown
Contributor

@lasley lasley commented Jan 21, 2017

Revisiting the base_multi_image uninstall hook. It turns out we do need to use the env, because the registry is actually returning a MetaModel here. This can be seen in:

  • 3afbb19
  • And there was a Travis build proving it, but it seems it was overwritten when I rebuilt. Sorry about that. Basically it was the same error we were getting, except saying that I was passing a MetaModel instead of a list. It still wanted the BaseModel.

I switched up to the env in the second commit here, then rebuilt the product-attribute PR to yield a positive Travis.

I'm curious if there's a way to test this directly in this module. The whole double PR to fix an issue that made it to a production branch isn't awesome, so I'd like to figure out how to nip this in the butt forever with a test. Best I can think of though is a test_ module, which really isn't that much better than just requiring some other module that already exists IMO.

* Fix registry usage in uninstall hook
* Use env in uninstall hook
Image = registry["base_multi_image.image"]
images = Image.search([("owner_model", "=", model)])
images.unlink()
env = api.Environment(cr, SUPERUSER_ID, dict())
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.

nitpicking: why dict() rather than {}?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Admittedly, laziness. I copied this from the env creation above instead of typing the ever so many characters 😉

Good nitpick though, dict() is totally not pythonic - and actually I think slightly less efficient due to method call.

@pedrobaeza pedrobaeza merged commit 5d71aaf into OCA:10.0 Jan 23, 2017
@lasley lasley deleted the bugfix/10.0/base_multi_image-hook-revisited branch January 23, 2017 18:30
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jun 12, 2018
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jun 12, 2018
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jun 12, 2018
hugosantosred pushed a commit to factorlibre/server-tools that referenced this pull request Aug 20, 2018
devang-dreambits pushed a commit to devang-dreambits/server-tools that referenced this pull request Mar 4, 2019
angelmoya pushed a commit to PESOL/server-tools that referenced this pull request Mar 7, 2019
javierjcf pushed a commit to Comunitea/server-tools that referenced this pull request Sep 9, 2020
hailangvn pushed a commit to hailangvn/server-tools that referenced this pull request May 16, 2021
TobiasSorg pushed a commit to AmetrasIntelligence/server-tools that referenced this pull request Nov 26, 2021
hailangvn pushed a commit to hailangvn/server-tools that referenced this pull request Jan 24, 2022
flachica pushed a commit to flachica/server-tools that referenced this pull request May 6, 2022
flachica pushed a commit to flachica/server-tools that referenced this pull request May 6, 2022
flachica pushed a commit to flachica/server-tools that referenced this pull request May 17, 2022
mtelahun pushed a commit to mtelahun/server-tools that referenced this pull request Sep 5, 2022
clb-openfire pushed a commit to odof/server-tools that referenced this pull request Apr 4, 2023
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Apr 26, 2023
Ricardoalso pushed a commit to camptocamp/server-tools that referenced this pull request Sep 19, 2023
omalbastin pushed a commit to omalbastin/server-tools that referenced this pull request Jan 5, 2024
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 9, 2024
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 19, 2024
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 19, 2024
psugne pushed a commit to versada/server-tools that referenced this pull request Oct 9, 2024
SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (13.0)
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
oerp-odoo pushed a commit to versada/server-tools that referenced this pull request Feb 14, 2025
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Feb 24, 2025
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Aug 19, 2025
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Jan 12, 2026
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