@@ -399,17 +399,27 @@ def _cron_check_output_exchange_sync(self, **kw):
399
399
backend ._check_output_exchange_sync (** kw )
400
400
401
401
def exchange_generate_send (self , recordset , skip_generate = False , skip_send = False ):
402
+ """Generate and send output files for given records.
403
+
404
+ If both are False, the record will be generated and sent right away
405
+ with chained jobs.
406
+
407
+ If both `skip_generate` and `skip_send` are True, nothing will be done.
408
+ :param recordset: edi.exchange.record recordset
409
+ :param skip_generate: only send records
410
+ :param skip_send: only generate missing output
411
+ """
402
412
for rec in recordset :
403
- if skip_generate :
404
- job1 = rec
405
- else :
413
+ if not skip_generate and not skip_send :
406
414
job1 = rec .delayable ().action_exchange_generate ()
407
- if hasattr (job1 , "on_done" ):
408
- if not skip_send :
409
- # Chain send job.
410
- # Raise prio to max to send the record out as fast as possible.
411
- job1 .on_done (rec .delayable (priority = 0 ).action_exchange_send ())
415
+ # Chain send job.
416
+ # Raise prio to max to send the record out as fast as possible.
417
+ job1 .on_done (rec .delayable (priority = 0 ).action_exchange_send ())
412
418
job1 .delay ()
419
+ elif skip_send :
420
+ rec .with_delay ().action_exchange_generate ()
421
+ elif not skip_send :
422
+ rec .with_delay (priority = 0 ).action_exchange_send ()
413
423
414
424
def _check_output_exchange_sync (
415
425
self , skip_send = False , skip_sent = True , record_ids = None
0 commit comments