-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[17.0][FW] fs_attachement: Oca port from 16.0 to 17.0 #401
[17.0][FW] fs_attachement: Oca port from 16.0 to 17.0 #401
Commits on Oct 7, 2024
-
Create base_attachment_object_storage to extract common code to store…
… implementations
Configuration menu - View commit details
-
Copy full SHA for 8260d45 - Browse repository at this point
Copy the full SHA 8260d45View commit details -
Abstract object storage in attachment_s3
Using the base_attachment_object_storage module, the same way attachment_swift is done. Fixed a few issues along the way in attachment_swift.
Configuration menu - View commit details
-
Copy full SHA for 84ff5ad - Browse repository at this point
Copy the full SHA 84ff5adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 471914d - Browse repository at this point
Copy the full SHA 471914dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 45b2ea9 - Browse repository at this point
Copy the full SHA 45b2ea9View commit details -
Configuration menu - View commit details
-
Copy full SHA for b3150fc - Browse repository at this point
Copy the full SHA b3150fcView commit details -
Ensure that migration of files is commited before deleting files
When moving attachments from the filestore to an object storage, the filesystem files will be deleted only after the commit, so if the transaction is rollbacked, we still have the local files for another try.
Configuration menu - View commit details
-
Copy full SHA for a0d9b7d - Browse repository at this point
Copy the full SHA a0d9b7dView commit details -
Fix attachments stored in FS instead of object storage
Assume the following situation: * We have installed addons base, sale and attachment_s3 (hence base_attachment_object_storage as dependency) * All attachments are in S3 already * We run an upgrade of the 'base' addon, 'sale' is upgraded before attachment_s3 in the order of loading. * Sale updates the icon of the Sale menu * As attachment_s3 is not loaded yet, the attachment is created in the filestore Now if we don't persist the filestore or use different servers, we'll lose the images of the menus (or any attachment loaded by the install/upgrade of an addon). The implemented solution is to move the attachments from the filestore to the object storage at the loading of the module. However, this operation can take time and it shouldn't be run by 2 processes at the same time, so we want to detect if the module is loaded during a normal odoo startup or when some addons have been upgraded. There is nothing anymore at this point which allow us to know that modules just have been upgraded except... in the caller frame (load_modules). We have to rely on the inpect module and get the caller frame, which is not recommended, but seems the only way, besides, it's not called often and if _register_hook was called from another place, it would have no effect (unless the other place has a variable 'update_module' too).
Configuration menu - View commit details
-
Copy full SHA for 5285c0f - Browse repository at this point
Copy the full SHA 5285c0fView commit details -
Document a weird domain which is there for a reason
The reason being: https://github.com/odoo/odoo/blob/9032617120138848c63b3cfa5d1913c5e5ad76db/odoo/addons/base/ir/ir_attachment.py#L344-L347 I nearly deleted this domain but it was too weird to be there for no reason. A comment explaining the issue was really missing.
Configuration menu - View commit details
-
Copy full SHA for 5ba0232 - Browse repository at this point
Copy the full SHA 5ba0232View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f6728f - Browse repository at this point
Copy the full SHA 9f6728fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 841fdc7 - Browse repository at this point
Copy the full SHA 841fdc7View commit details -
Configuration menu - View commit details
-
Copy full SHA for cca211d - Browse repository at this point
Copy the full SHA cca211dView commit details -
Configuration menu - View commit details
-
Copy full SHA for b8405bd - Browse repository at this point
Copy the full SHA b8405bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for adf09b7 - Browse repository at this point
Copy the full SHA adf09b7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7345c77 - Browse repository at this point
Copy the full SHA 7345c77View commit details -
Configuration menu - View commit details
-
Copy full SHA for 41182c7 - Browse repository at this point
Copy the full SHA 41182c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 19edbf3 - Browse repository at this point
Copy the full SHA 19edbf3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6af6d4b - Browse repository at this point
Copy the full SHA 6af6d4bView commit details -
Add method to force storage of special attachments to DB
Some attachments (e.g. image_small, image_medium) are stored in DB instead of the object storage for faster access. In some situations, we may have pushed all these files on the Object Storage (migration from a filesystem to object storage) and want to bring back these attachments from the object storage to the database. This method is not called anywhere but can be called by RPC or scripts.
Configuration menu - View commit details
-
Copy full SHA for 9545d43 - Browse repository at this point
Copy the full SHA 9545d43View commit details -
Rework and fix storage forced in database
The initial issue that triggered this rework is that the forced storage in database was working only on writes, and was never applied on attachment creations. This feature is used to store small files that need to be read in a fast way in database rather than in the object storage. Reading a file from the object storage can take 150-200ms, which is fine for downloading a PDF file or a single image, but not if you need 40 thumbnails. Down the path to make a correction, I found that: * the logic to force storage was called in `_inverse_datas`, which is not called during a create * odoo implemented a new method `_get_datas_related_values`, which is a model method that receive only the data and the mimetype, and return the attachment values and write the file to the correct place The `_get_datas_related_values` is where we want to plug this special storage, as it is called for create and write, and already handle the values and conditional write. But using this method, we have less information than before about the attachment, so let's review the different criterias we had before: * res_model: we were using it to always store attachments related to 'ir.ui.view' in db, because assets are related to this model. However, we don't really need to check this: we should store any javascript and css documents in database. * exclude res_model: we could have an exclusion list, to tell that for instance, for mail.message, we should never store any image in db. We don't have this information anymore, but I think it was never used and added "in case of". Because the default configuration is "mail.mail" and "mail.message" and I couldn't find any attachment with such res_model in any of our biggest databases. So this is removed. * mimetype and data (size) are the last criteria and we still have them The new system is only based on mimetype and data size and I think it's actually more versatile. Previously, we could set a global size and include mimetypes, but we couldn't say "I want to store all images below 50KB and all files of type X below 10KB". Now, we have a single system parameter with a dict configuration (`ir_attachment.storage.force.database`) defaulting to: {"image/": 51200, "application/javascript": 0, "text/css": 0} Assets have a limit of zero, which means they will all be stored in the database whatever their size is. Overall, this is a great simplification of the module too, as the method `_get_datas_related_values` integrates it better in the base calls of IrAttachment. Note for upgrade: I doubt we customized the previous system parameters which are now obsolete, but if yes, the configuration may need to be moved to `ir_attachment.storage.force.database`. For the record, the params were: * mimetypes.list.storedb (default: image) * file.maxsize.storedb (default: 51200) * excluded.models.storedb (mail.message,mail.mail), no equivalent now The method IrAttachment.force_storage_to_db_for_special_fields() should be called through a migration script on existing databases to move the attachments back into the database.
Configuration menu - View commit details
-
Copy full SHA for 4a2e1ff - Browse repository at this point
Copy the full SHA 4a2e1ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for 164bede - Browse repository at this point
Copy the full SHA 164bedeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2cb4690 - Browse repository at this point
Copy the full SHA 2cb4690View commit details -
Configuration menu - View commit details
-
Copy full SHA for 70ab23f - Browse repository at this point
Copy the full SHA 70ab23fView commit details -
Configuration menu - View commit details
-
Copy full SHA for f7d8edf - Browse repository at this point
Copy the full SHA f7d8edfView commit details -
Update manifest files to be consistent inbetween them
The main goal is to be able to easily do grep and sed when we do mass update on them
Configuration menu - View commit details
-
Copy full SHA for 63d9133 - Browse repository at this point
Copy the full SHA 63d9133View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6ea15ae - Browse repository at this point
Copy the full SHA 6ea15aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f67ff2 - Browse repository at this point
Copy the full SHA 7f67ff2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 72665ff - Browse repository at this point
Copy the full SHA 72665ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1c2967e - Browse repository at this point
Copy the full SHA 1c2967eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 909c457 - Browse repository at this point
Copy the full SHA 909c457View commit details -
feat: remove after method (OCA#393)
* fix: azure reading in stream monkey patch documents
Configuration menu - View commit details
-
Copy full SHA for 2d380fa - Browse repository at this point
Copy the full SHA 2d380faView commit details -
Configuration menu - View commit details
-
Copy full SHA for ba5ba75 - Browse repository at this point
Copy the full SHA ba5ba75View commit details -
Configuration menu - View commit details
-
Copy full SHA for e5a77d3 - Browse repository at this point
Copy the full SHA e5a77d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 82cde62 - Browse repository at this point
Copy the full SHA 82cde62View commit details -
[IMP] fs_attachment: No crash on missing file
When trying to get access to files stored into an external filesystem, don't crash if the files cannot be accessed. This is necessary to avoid blocking Odoo's operation if an external system is not accessible.
Configuration menu - View commit details
-
Copy full SHA for b027702 - Browse repository at this point
Copy the full SHA b027702View commit details -
[FIX] fs_attachment: prevent recompute_urls from skipping records wit…
…h res_field != False
Configuration menu - View commit details
-
Copy full SHA for 48ac610 - Browse repository at this point
Copy the full SHA 48ac610View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ef1492 - Browse repository at this point
Copy the full SHA 3ef1492View commit details