[9.0][FIX] base_multi_image - New storage backend 'Filestore'#468
[9.0][FIX] base_multi_image - New storage backend 'Filestore'#468
Conversation
…xisting attachment record + Fix the 'pre_init_hook_for_submodules()' hook to extract the images from the ir_attachment table for binary fields initialized with the 'attachment=True' parameter
e2de984 to
16e7412
Compare
|
Ready for reviews. |
| @api.constrains('storage', 'attachment_id') | ||
| def _check_store(self): | ||
| if self.storage == 'filestore' and not self.attachment_id: | ||
| raise exceptions.ValidationError( |
There was a problem hiding this comment.
base_multi_image/models/image.py:195: [C8107(translation-required), Image._check_store] String parameter of raise "ValidationError" requires translation. Use _('You must provide an attachment for the image.')
|
👍 |
|
I would like to discuss about what we should do about these The pros of the implementation proposed in this PR:
Cons:
Another method is to add a new binary field Pros:
Cons:
|
|
IMO the implementation in this PR is great. (code review 👍 btw) I would also say that the migration of image records into an unrecoverable table could be a big red flag in terms of using this module. As a sys admin, I naturally shy away from something that migrates my data without a way to walk it back. |
|
code review 👍 |
Syncing from upstream OCA/server-tools (12.0)
New storage backend Filestore to link an existing attachment record + Fix the
pre_init_hook_for_submodules()function to extract the images from their_attachmenttable for binary fields initialized with theattachment=Trueparameter.Required to fix OCA/product-attribute#161
I'm not quite satisfied with the pre_init_hook function, it works but it is not really elegant and error prone. Any advices?
cc @yajo @atchuthan @pedrobaeza