[13.0] Refactor storage of job records with "sudo" support#281
Merged
OCA-git-bot merged 2 commits intoOCA:13.0from Nov 18, 2020
Merged
[13.0] Refactor storage of job records with "sudo" support#281OCA-git-bot merged 2 commits intoOCA:13.0from
OCA-git-bot merged 2 commits intoOCA:13.0from
Conversation
added 2 commits
November 13, 2020 14:26
These fields contain the current model and record ids and user id the job works on. Storing them as separate fields does not allow to take benefits on the "JobSerialized" field, which keeps the original user, and later the 'su' flag. We could store the context there as well (or a cleaned one). Use computed fields to keep the model_name, record_ids, user_id fields for backward compatibility. The model_name should stay anyway for the searches on the UI, and the user_id for the same reason + possibility to edit the user.
Which means that the record the job is working on, or any record argument of the job keeps the 'su' flag.
Closed
simahawk
approved these changes
Nov 13, 2020
| list: "[]", | ||
| tuple: "[]", | ||
| models.BaseModel: lambda env: json.dumps( | ||
| {"_type": "odoo_recordset", "model": "base", "ids": [], "uid": env.uid} |
Contributor
There was a problem hiding this comment.
shall we store record.context too?
Member
Author
There was a problem hiding this comment.
This clearly opens this possibility, this is definitely where the context has to be stored. I mentioned it in the commit message :)
However, there are some questions about what should be allowed or not to store in the context (cf #121), also whether we should or not always store it (can take useless space?), so it should not be part of this PR.
TDu
approved these changes
Nov 13, 2020
Member
Author
|
/ocabot merge nobump (version is changed in the PR already) |
Contributor
|
What a great day to merge this nice PR. Let's do it! |
Contributor
|
Congratulations, your PR was merged at 644a4a5. Thanks a lot for contributing to OCA. ❤️ |
guewen
pushed a commit
to guewen/queue
that referenced
this pull request
Dec 1, 2020
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
guewen
pushed a commit
to guewen/queue
that referenced
this pull request
Dec 1, 2020
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
guewen
pushed a commit
to guewen/queue
that referenced
this pull request
Dec 1, 2020
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
etobella
pushed a commit
to tegin/queue
that referenced
this pull request
Apr 19, 2021
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
bizzappdev
pushed a commit
to BizzAppDev-Systems/queue
that referenced
this pull request
Nov 23, 2023
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
bizzappdev
pushed a commit
to BizzAppDev-Systems/queue
that referenced
this pull request
Nov 23, 2023
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
nguyenminhchien
pushed a commit
to nguyenminhchien/queue
that referenced
this pull request
Nov 25, 2023
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
QuocDuong1306
pushed a commit
to QuocDuong1306/queue
that referenced
this pull request
Sep 19, 2024
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
QuocDuong1306
pushed a commit
to QuocDuong1306/queue
that referenced
this pull request
Sep 24, 2024
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
thienvh332
pushed a commit
to thienvh332/queue
that referenced
this pull request
Oct 7, 2024
Following changes of OCA#281 The initial sudo() is lost when we call "with_env()" with a False su flag. Ensure the read job.record keeps a su flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #272
Previously, the "main" record, the one on which the job works, was stored in 3 fields:
model_name,user_idandrecord_ids(and the support for any new field such as sudo or context would need a new field). The records ofargsandkwargsare serialized inJobSerializedfields.This PR unifies the way they are stored: the "main" record is now stored in a
JobSerializedfield as well.The support of the
suflag (which means the record wassudo()-ed), is added in the second commit, which shows how we benefit from the refactor.The original fields are kept:
model_nameis stored for the UI (used in search or groupby)user_idis stored for the same reason, but also has ainversemethod that updates the serialized recordrecord_idsis kept only for backward compatibility, but could be removed in 14.0