Skip to content

Conversation

@FFernandez-PlanetaTIC
Copy link
Member

Hi,

Improve uninstall hook to move images from multi to single mode.

Thanks!

Model = env[model]
Field = field and Model._fields[field]
FieldMedium = field_medium and Model._fields[field_medium]
FieldSmall = field_small and Model._fields[field_small]
Copy link
Member

Choose a reason for hiding this comment

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

one of these 3 can fail with KeyError easily

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @yajo , if a KeyError is raised it means that the uninstall hook hasn't been used correctly by the module that depends on it. It would be a programming error.

Copy link
Member

Choose a reason for hiding this comment

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

In such case, the arguments shouldn't be optional

Copy link
Member Author

Choose a reason for hiding this comment

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

If the new parameters would be required then it will break existing modules using the hook.

They should be optional because the introduced behavior isn't the desired in some cases as product variants in OCA/product-attribute#359

@yajo
Copy link
Member

yajo commented Jun 13, 2018

Wasn't it supposed that this addon lets the original image in place, stored in database?

@FFernandez-PlanetaTIC
Copy link
Member Author

@yajo , no, it moves the main of multiple images to the original field, stored in a database column or as an attachment depending of the field declaration.

@FFernandez-PlanetaTIC
Copy link
Member Author

Hi @yajo ,

Is there something more to change? Could you change you review?

Thanks!

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Yikes, the code is very hard to read 😕

However it seems to do the trick.

Copy link
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.

Indeed, this is very convoluted, but it's what Odoo forces us to do for preserving this. Thanks for the hard work

@pedrobaeza pedrobaeza merged commit dc57cb4 into OCA:10.0 Jun 22, 2018
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jul 2, 2018
improve uninstall hook to move images from multi to single mode
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jul 2, 2018
improve uninstall hook to move images from multi to single mode
qtheuret pushed a commit to qtheuret/server-tools that referenced this pull request Jul 3, 2018
improve uninstall hook to move images from multi to single mode
daramousk pushed a commit to daramousk/server-tools that referenced this pull request Jul 16, 2018
improve uninstall hook to move images from multi to single mode
@FFernandez-PlanetaTIC FFernandez-PlanetaTIC deleted the 10.0-IMP-base_multi_image-uninstall_hook branch July 27, 2018 07:11
hugosantosred pushed a commit to factorlibre/server-tools that referenced this pull request Aug 20, 2018
improve uninstall hook to move images from multi to single mode
devang-dreambits pushed a commit to devang-dreambits/server-tools that referenced this pull request Mar 4, 2019
improve uninstall hook to move images from multi to single mode
angelmoya pushed a commit to PESOL/server-tools that referenced this pull request Mar 7, 2019
improve uninstall hook to move images from multi to single mode
ljimenezsidoo pushed a commit to PESOL/server-tools that referenced this pull request Mar 13, 2019
improve uninstall hook to move images from multi to single mode
javierjcf pushed a commit to Comunitea/server-tools that referenced this pull request Sep 9, 2020
improve uninstall hook to move images from multi to single mode
hailangvn pushed a commit to hailangvn/server-tools that referenced this pull request May 16, 2021
improve uninstall hook to move images from multi to single mode
TobiasSorg pushed a commit to AmetrasIntelligence/server-tools that referenced this pull request Nov 26, 2021
improve uninstall hook to move images from multi to single mode
hailangvn pushed a commit to hailangvn/server-tools that referenced this pull request Jan 24, 2022
improve uninstall hook to move images from multi to single mode
flachica pushed a commit to flachica/server-tools that referenced this pull request May 6, 2022
improve uninstall hook to move images from multi to single mode
flachica pushed a commit to flachica/server-tools that referenced this pull request May 6, 2022
improve uninstall hook to move images from multi to single mode
flachica pushed a commit to flachica/server-tools that referenced this pull request May 17, 2022
improve uninstall hook to move images from multi to single mode
mtelahun pushed a commit to mtelahun/server-tools that referenced this pull request Sep 5, 2022
improve uninstall hook to move images from multi to single mode
clb-openfire pushed a commit to odof/server-tools that referenced this pull request Apr 4, 2023
improve uninstall hook to move images from multi to single mode
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Apr 26, 2023
improve uninstall hook to move images from multi to single mode
Ricardoalso pushed a commit to camptocamp/server-tools that referenced this pull request Sep 19, 2023
improve uninstall hook to move images from multi to single mode
omalbastin pushed a commit to omalbastin/server-tools that referenced this pull request Jan 5, 2024
improve uninstall hook to move images from multi to single mode
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 9, 2024
improve uninstall hook to move images from multi to single mode
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 19, 2024
improve uninstall hook to move images from multi to single mode
IJOL pushed a commit to BITVAX/server-tools that referenced this pull request Aug 19, 2024
improve uninstall hook to move images from multi to single mode
psugne pushed a commit to versada/server-tools that referenced this pull request Oct 9, 2024
improve uninstall hook to move images from multi to single mode
SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (14.0)
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
improve uninstall hook to move images from multi to single mode
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
improve uninstall hook to move images from multi to single mode
yibudak pushed a commit to yibudak/server-tools that referenced this pull request Dec 23, 2024
improve uninstall hook to move images from multi to single mode
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
improve uninstall hook to move images from multi to single mode
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
improve uninstall hook to move images from multi to single mode
aaltinisik pushed a commit to altinkaya-opensource/server-tools that referenced this pull request Jan 13, 2025
improve uninstall hook to move images from multi to single mode
oerp-odoo pushed a commit to versada/server-tools that referenced this pull request Feb 14, 2025
improve uninstall hook to move images from multi to single mode
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Feb 24, 2025
improve uninstall hook to move images from multi to single mode
BhaveshHeliconia pushed a commit to HeliconiaIO/server-tools that referenced this pull request Aug 19, 2025
improve uninstall hook to move images from multi to single mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants