-
-
Notifications
You must be signed in to change notification settings - Fork 526
[19.0] [MIG] queue_job: migrate + tests #840
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: 19.0
Are you sure you want to change the base?
Changes from 11 commits
2a5ccb8
ce67593
b283cd8
df50b83
b7129d7
ac812d7
a7d4364
4da9fae
f494bcc
3b733f1
ee67632
d827d58
9aeebee
9ac6b25
99cc44f
211e467
620413a
82d62a1
81a1488
6d330f2
f685d12
d27f83d
8dd4af0
231705d
9ea78c5
038c334
96a9ada
afc9c76
f947199
c30bf4b
123900c
d25ff12
754e438
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 |
|---|---|---|
|
|
@@ -262,9 +262,26 @@ def _job_prepare_context_before_enqueue(self): | |
|
|
||
| @classmethod | ||
| def _patch_method(cls, name, method): | ||
| """Patch ``name`` with ``method`` preserving API metadata (Odoo 19). | ||
|
|
||
| Odoo 19 no longer exposes ``api.propagate``. We emulate the | ||
| propagation by using ``functools.update_wrapper`` and copying the | ||
| decorator metadata which Odoo relies on (see orm.decorators). | ||
| """ | ||
| origin = getattr(cls, name) | ||
| method.origin = origin | ||
| # propagate decorators from origin to method, and apply api decorator | ||
| wrapped = api.propagate(origin, method) | ||
| # carry over wrapper attributes (name, doc, etc.) | ||
| wrapped = functools.update_wrapper(method, origin) | ||
| # propagate common decorator metadata used by the framework | ||
| for attr in ( | ||
| "_constrains", | ||
| "_depends", | ||
| "_onchange", | ||
| "_ondelete", | ||
| "_api_model", | ||
| "_api_private", | ||
| ): | ||
| if hasattr(origin, attr): | ||
| setattr(wrapped, attr, getattr(origin, attr)) | ||
|
||
| wrapped.origin = origin | ||
| setattr(cls, name, wrapped) | ||
Uh oh!
There was an error while loading. Please reload this page.