-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] queue_job: Adapt code after backporting improvements
- Loading branch information
1 parent
7c1064f
commit 77d6da1
Showing
7 changed files
with
90 additions
and
5 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
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import queue_requeue_job | ||
from . import queue_jobs_to_done | ||
from . import queue_jobs_to_cancelled |
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,17 @@ | ||
# Copyright 2013-2020 Camptocamp SA | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html) | ||
|
||
from odoo import models | ||
|
||
|
||
class SetJobsToCancelled(models.TransientModel): | ||
_inherit = "queue.requeue.job" | ||
_name = "queue.jobs.to.cancelled" | ||
_description = "Cancel all selected jobs" | ||
|
||
def set_cancelled(self): | ||
jobs = self.job_ids.filtered( | ||
lambda x: x.state in ("pending", "failed", "enqueued") | ||
) | ||
jobs.button_cancelled() | ||
return {"type": "ir.actions.act_window_close"} |
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,34 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="view_set_jobs_cancelled" model="ir.ui.view"> | ||
<field name="name">Cancel Jobs</field> | ||
<field name="model">queue.jobs.to.cancelled</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<group string="The selected jobs will be cancelled."> | ||
<field name="job_ids" nolabel="1" colspan="2" /> | ||
</group> | ||
<footer> | ||
<button | ||
name="set_cancelled" | ||
string="Cancel jobs" | ||
type="object" | ||
class="oe_highlight" | ||
/> | ||
<button string="Cancel" class="oe_link" special="cancel" /> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="action_set_jobs_cancelled" model="ir.actions.act_window"> | ||
<field name="name">Cancel jobs</field> | ||
<field name="res_model">queue.jobs.to.cancelled</field> | ||
<field name="view_mode">form</field> | ||
<field name="view_id" ref="view_set_jobs_cancelled" /> | ||
<field name="target">new</field> | ||
<field name="binding_model_id" ref="queue_job.model_queue_job" /> | ||
</record> | ||
|
||
</odoo> |
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