Skip to content

Commit b87e0ad

Browse files
author
Hadrien Huvelle
committed
Change final action at end of wizard
1 parent e1b15da commit b87e0ad

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

delivery_carrier_label_batch/wizard/generate_labels.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from psycopg2 import OperationalError
88

9-
from odoo import api, exceptions, fields, models
9+
from odoo import _, api, exceptions, fields, models
1010
from odoo.tools.safe_eval import safe_eval
1111

1212
from odoo.addons.queue_job.delay import chain
@@ -257,26 +257,23 @@ def action_generate_labels(self):
257257

258258
job_ids = batch_summary.job_ids.ids
259259

260-
if len(job_ids) == 1:
261-
return {
262-
"type": "ir.actions.act_window",
263-
"name": "Job Detail",
264-
"res_model": "queue.job",
265-
"view_mode": "form",
266-
"res_id": job_ids[0],
267-
"context": self.env.context,
268-
"target": "new",
269-
}
270-
elif len(job_ids) > 1:
271-
return {
272-
"type": "ir.actions.act_window",
273-
"name": "Summary Jobs",
274-
"res_model": "queue.job",
275-
"view_mode": "list",
276-
"domain": [("id", "in", job_ids)],
277-
"context": self.env.context,
278-
"target": "new",
279-
}
260+
return {
261+
"type": "ir.actions.client",
262+
"tag": "display_notification",
263+
"params": {
264+
"title": _("Label generation"),
265+
"message": _(
266+
"""%s job(s) have been created for label generation.
267+
Labels will be available as soon as those jobs are finished."""
268+
)
269+
% (len(job_ids),),
270+
"type": "warning",
271+
"next": {
272+
"type": "ir.actions.client",
273+
"tag": "soft_reload",
274+
},
275+
},
276+
}
280277

281278
@api.model
282279
def _group_labels_by_file_type(self, labels):

0 commit comments

Comments
 (0)