Commit Graph
253 Commits
Author SHA1 Message Date
Denis Leemann 849181c4a0 Run manually pre-commit hook 2021-08-09 16:15:45 +02:00
Akim Juillerat e82fe205a0 base_fileurl_field: disable pylint W8106:method-required-super 2021-08-05 14:25:56 +02:00
Akim Juillerat f36dd1bd00 base_fileurl_field: Consider test mode and installation of demo data 2021-08-02 14:37:49 +02:00
Yannick VaucherandGitHub 3cf835dbd2 Merge pull request #230 from yvaucher/12.0-bp-fix-bucket-name
[12.0] [FIX] Bucket name formatting
2021-05-31 09:50:30 +02:00
Miku LaitinenandYannick Vaucher 03bff76f7e [FIX] Bucket name formatting 2021-05-31 09:45:05 +02:00
Yannick VaucherandGitHub f800a4d9b7 Merge pull request #227 from yvaucher/12.0-bp-multi-tenancy
[12.0] [BP] attachment_s3: multi-tenancy use db name in bucket
2021-05-28 12:34:59 +02:00
Yannick Vaucher 6aeebfc455 attachment_s3: multi-tenancy use db name in bucket
Adds the possibility to insert `{db}` placeholder in the bucket name
that will be replaced by the database name to form a unique bucket
name per database.
2021-05-27 18:17:51 +02:00
Yannick VaucherandGitHub 1bd88f1e72 Merge pull request #220 from theoo/12.0
[IMP] session_redis: allow configuring Redis URL instead of host & port.
2021-04-12 20:54:36 +02:00
Miku LaitinenandThéo Reichel 86fc51b5a9 [IMP] session_redis: allow configuring Redis URL instead of host & port.
Back-porting from [13] branch
2021-03-29 18:26:21 +02:00
i-vyshnevskaandGitHub a64024dfe0 Merge pull request #197 from camptocamp/12.0-fix-force-storage-db
[12.0][IMP] force storage db
2020-09-14 13:52:55 +03:00
Iryna Vushnevska 6337607e2c [IMP] adapt features to v12 2020-08-25 15:34:53 +03:00
Guewen BaconnierandIryna Vushnevska b05c5eeb8b 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.
2020-08-25 14:26:03 +03:00
Guewen BaconnierandGitHub 234451065f Merge pull request #193 from acsone/12.0-188-port
[12.0][PORT] 188 from 10.0
2020-06-22 13:36:47 +02:00
Stéphane Bidoul 384c75061a Log uid 2020-06-22 08:42:25 +02:00
Stéphane Bidoul c3b061e980 Log request uuid 2020-06-22 08:42:25 +02:00
Guewen BaconnierandGitHub 0a592403e8 Merge pull request #174 from grindtildeath/12.0_attachment_s3_bin_size_close
[12.0] attachment_s3: Improvements
2020-06-22 07:45:26 +02:00
Guewen BaconnierandGitHub ef07381879 Merge pull request #140 from camptocamp/12-fixes
cloud_platform: fix default config
2020-06-22 07:39:28 +02:00
Guewen Baconnier 3036a8161e Update setuptools files 2020-06-22 07:21:54 +02:00
Guewen Baconnier 74c528e050 Ignore .eggs/ in gitignore 2020-06-22 07:21:43 +02:00
Guewen BaconnierandGitHub 981a99310c Merge pull request #184 from guewen/12.0-redis-json-encode-date
[12.0] Encode/decode date and datetime in redis sessions
2020-05-28 20:44:07 +02:00
Guewen BaconnierandGitHub a05bbfe517 Merge pull request #185 from PCatinean/12.0-session-preserve-forward-port-pc
12.0 session preserve forward port pc
2020-05-28 20:42:32 +02:00
Andreas PerhabandPaul c18e84a3bf [FIX] session_redis: fix flake8 errors 2020-05-26 14:46:56 +02:00
Andreas PerhabandPaul 9ac4d26470 [IMP] session_redis: add option to copy sessions from filesystem when starting 2020-05-26 14:39:27 +02:00
Andreas PerhabandPaul 18b5ceaebc [FIX] session_redis: add required option 'post_load' for server wide addon 2020-05-26 14:39:08 +02:00
Guewen Baconnier 2c5805e858 Add (de-)serialization of set objects in sessions 2020-05-26 11:39:39 +02:00
Guewen Baconnier 2a022ba537 Encode/decode date and datetime in redis sessions
In several places, odoo sets a datetime object directly in the
session. It works with the default session handler of odoo which
uses pickle.

But datetime and date are not json serializable by default.

Add custom encoder / decoder to handle them (from
https://github.com/OCA/queue/blob/dc12a6a20ecfd15c5b90f9b089c9a64cf9d8bbe4/queue_job/fields.py#L57-L99)

See the discussion raised by @PCatinean on https://github.com/camptocamp/odoo-cloud-platform/pull/176
2020-05-26 11:39:30 +02:00
Guewen BaconnierandGitHub a6f4e7990f Merge pull request #180 from guewen/12.0-fix-server-env
[12.0] Fix build after changes in server_environment
2020-05-11 09:39:21 +02:00
Guewen Baconnier 8524eeff2d Fix build after changes in server_environment
Now the default env is "test", and we don't need the directory
at all.
See https://github.com/OCA/server-env/pull/44
2020-05-11 08:25:59 +02:00
Akim Juillerat 123947100b [FIX] attachment_s3: Close fileobjects after usage 2020-03-18 13:22:02 +01:00
Akim Juillerat bd3be08203 [IMP] attachment_s3: Consider bin_size context key
When bin_size context key is set, read operations on attachments
are supposed to return the size of the attachment and not its content
2020-03-18 12:51:48 +01:00
Akim JuilleratandGitHub 20a8493a63 Merge pull request #165 from grindtildeath/12.0-fix_auth_to_keystone_v3
[12.0] attachment_swift: Fix authentication to Keystone v3
2020-03-09 13:32:56 +01:00
Akim Juillerat 4a7ac33d9f Fix authentication to Keystone v3
- Use newer version from python lib.
 - Define project_domain_id + user_domain_id in auth
2020-03-09 12:07:59 +01:00
Patrick TombezandGitHub 6d92bd626b Merge pull request #152 from p-tombez/12.0-keystoneauth_v3
[12.0] Use keystoneauth v3 for Swift attachments
2020-03-04 10:45:41 +01:00
Mussie SirakandPatrick Tombez 8ac54f4773 Use keystoneauth v3 for Swift attachments 2020-03-04 10:23:59 +01:00
Akim JuilleratandGitHub cca48fb020 Merge pull request #141 from grindtildeath/12.0_dev_s3_attachments
[12.0] Require AWS_BUCKETNAME for prod and integration environments only
2020-02-26 14:40:13 +01:00
Akim Juillerat 928faced58 Require AWS_BUCKETNAME for prod, integration and labs environments only
AWS_BUCKETNAME is only needed in order to write on the bucket, but
read-only access should be allowed for other environments.

Fixes bug introduced by 6c3b610610
2020-02-25 17:19:48 +01:00
Yannick VaucherandGitHub 312a4001c4 Merge pull request #116 from yvaucher/aws-bucketname-unstrctured
Add AWS_BUCKETNAME_UNSTRUCTURED to by-pass check
2020-02-25 16:27:46 +01:00
Yannick Vaucher a6533576f2 Swift same by-pass structured store location 2020-02-25 15:36:19 +01:00
Simone Orsi 3c7f9f951b cloud_platform: fix default config
`_config_by_server_env` should always retutn a `PlatformConfig` instance
2020-02-04 13:39:40 +01:00
Patrick TombezandGitHub ccbae04ae0 Merge pull request #135 from p-tombez/12.0-anon_redis_session
[12.0] Add anonymous redis session expiration configuration
2020-01-31 11:14:56 +01:00
Patrick Tombez c139b4da0a Add anonymous redis session expiration configuration 2020-01-29 16:31:38 +01:00
Guewen BaconnierandGitHub d544a881f8 Merge pull request #125 from acsone/12.0-fix-pythonjsonlogger-setup
[FIX] pythonjsonlogger external dependency in setup.py
2020-01-14 16:17:42 +01:00
Stéphane Bidoul (ACSONE) 1c5a5088b6 [FIX] pythonjsonlogger external dependency in setup.py 2019-12-21 12:09:43 +01:00
Vincent RenavilleandGitHub ed7c246493 Merge pull request #79 from sebalix/12.0-add-force-storage-special-fields
[12.0] Add method to force storage of special attachments to DB
2019-12-12 15:52:43 +01:00
Denis LeemannandGitHub 0ea58439f6 Merge pull request #117 from leemannd/description_added
Add description to model
2019-12-09 16:06:53 +01:00
Denis Leemann 07f7b3b19f Add description to model
This removes the useless warning at startup
2019-12-09 15:06:55 +01:00
Yannick Vaucher 7be1cebeeb Add AWS_BUCKETNAME_UNSTRUCTURED to by-pass check
Curently the name of the bucket is cross checked with the
running environment. In rare case you can have a bucket name
that doesn't match the structure <project>-odoo-<env> in place.
2019-12-05 15:33:54 +01:00
Guewen BaconnierandGitHub 7a6adaffec Merge pull request #105 from camptocamp/revert-100-12.0-monitoring_check_db_connection
Revert "[12.0] [IMP] monitoring_status: check the db is reachable"
2019-11-18 13:50:32 +01:00
Guewen BaconnierandGitHub 1a907eea02 Merge pull request #110 from guewen/add-support-running-env-labs
[12.0] Add support of 'labs' RUNNING_ENV in cloud_platform
2019-11-18 13:41:06 +01:00
Guewen Baconnier d04e7d558f Add an advice in error message 2019-11-18 13:07:54 +01:00