-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Add support for server_env conf #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simahawk Great idea!!! but travis is red :-(
@lmignon fixed and:
|
ouch, I've left |
845d068
to
9d4fafe
Compare
includes #31 now to not forget about new fields |
have to solve some weird inheritance issues. I'll look into it |
2fc26d9
to
a593a25
Compare
@@ -37,3 +39,33 @@ class StorageBackend(models.Model): | |||
"Public: your file/image can be displayed if nobody is " | |||
"logged (useful to display files on external websites)", | |||
) | |||
url_include_directory_path = fields.Boolean( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
"backend_id.base_url", | ||
"backend_id.url_include_directory_path", | ||
"relative_path", | ||
) | ||
def _compute_url(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simahawk Are we sure that compute methods are triggered if the values provided by the server.env.mixin
changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm very good point. @guewen what is the recommended way in this case?
Context: this is a computed + stored field depending on server env params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simahawk IMO it's not a blocking point. It would probably be necessary to add a warning in the README on this point and propose a procedure to launch this recomputation manually (via click-odoo or ????) if these values are modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure. Can be risky whenever you move a db from prod to integration for instance.
Would be nice to have a common well-known solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It kind of defeats the purpose of environment, since a copy of a prod database to another environment will not reset the url.
Does it need to be stored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. This computation is not so heavy and is not used so often AFAIR.
OTOH can be done on potentially gazillions of records (images + their scales).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the point. I share the same POV. The url should no more be stored... If I remember well, into the past, the url field was used by a controller to lookup for the record... it's no more the case and it seems safe to no more store this value into the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍 Thank you @simahawk (Code review)
argh! breaking tests now 😭 Checking... |
URL computation depends on server env params now hence it makes no sense anymore to store its value. In the past, the url field was used by a controller to lookup for the record which is not the case anymore.
8fb4350
to
a3456f0
Compare
/ocabot merge major |
This PR looks fantastic, let's merge it! |
🍾 ❤️ 🎉 |
Congratulations, your PR was merged at 79d358e. Thanks a lot for contributing to OCA. ❤️ |
No description provided.