Skip to content

Commit

Permalink
Skip autoworkers when there are no jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolpiera committed Feb 11, 2022
1 parent ff76ef2 commit bc1f264
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions som_infoenergia/som_infoenergia_enviament.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ def send_reports(self, cursor, uid, ids, context=None):
cursor, uid, _id, context
)
job_ids.append(j.id)

if not job_ids:
return False

create_jobs_group(
cursor.dbname, uid, _('Enviament Infoenergia Lot {} - {} enviaments').format(
lot_name, len(ids)
Expand Down
6 changes: 5 additions & 1 deletion som_infoenergia/som_infoenergia_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ def create_enviaments_from_object_list(self, cursor, uid, ids, object_ids, conte

job = self.create_single_enviament_from_object_async(cursor, uid, ids, obj_id, context=contexte)
job_ids.append(job.id)
# Create a jobs_group to see the status of the operation

if not job_ids:
return False

# Create a jobs_group to see the status of the operation
create_jobs_group(
cursor.dbname, uid,
_('Crear Enviaments al lot {0} a partir de {1} {2}.').format(lot_info['name'], len(job_ids), context['from_model']),
Expand Down

0 comments on commit bc1f264

Please sign in to comment.