-
-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] report_async: change job_ids to One2many with queue.job
- Loading branch information
1 parent
9a0f99f
commit 2288549
Showing
5 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def populate_report_async_id(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE queue_job qj | ||
SET report_async_id = ra.id | ||
FROM report_async ra | ||
WHERE qj.func_string LIKE '%report.async(' || ra.id || ',%' | ||
AND qj.user_id = ra.create_uid | ||
""" | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
populate_report_async_id(env) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
|
||
from . import report_async | ||
from . import ir_report | ||
from . import queue_job |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from odoo import models, fields | ||
|
||
|
||
class QueueJob(models.Model): | ||
_inherit = 'queue.job' | ||
|
||
report_async_id = fields.Many2one( | ||
comodel_name='report.async', | ||
string='Report Async', | ||
index=True, | ||
ondelete='cascade', | ||
) |
This file contains 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