-
Notifications
You must be signed in to change notification settings - Fork 0
[FIX] keep context #1
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
base: 11.0
Are you sure you want to change the base?
Changes from all commits
c761ca2
4fc4f80
4e32fd4
f45ce59
4f73733
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| from . import test_runner_runner | ||
| from . import test_json_field | ||
| from . import test_model_job_channel | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ def test_batch(self): | |
| batch = self.env['queue.job.batch'].get_new_batch('TEST') | ||
| self.assertFalse(batch.job_ids) | ||
| model = self.env['test.queue.job'].with_context( | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thomaspaulb the culprit was such line which made the conversion have issues when we assign batch record instead of the batch.id
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, I think we were going about this totally the wrong way, because we did not understand the original PR. Instead of using a text or JSON field, they're actually (JSON-)encoding the original context in a variable Then instead of using So this then reinstates the context keys that were saved in that variable, one by one. I guess if that works, then it avoids 1) Deviating from the other PR and 2) spending time getting our own JSON conversion right The only comment on the current original PR was that by default it does not keep context, and most reviewers want it to keep context by default, and I agree with that too
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It already takes care of properly encoding and decoding Odoo recordsets: https://github.com/OCA/queue/blob/11.0/queue_job/fields.py#L31 |
||
| job_batch=batch | ||
| job_batch=batch.id | ||
| ) | ||
| job_1 = model.with_delay().testing_method() | ||
| self.assertEqual(job_1.db_record().state, 'pending') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.