@@ -142,7 +142,8 @@ def exchange_generate(self, exchange_record, store=True, force=False, **kw):
142142 "exchange_error_traceback" : traceback ,
143143 }
144144 )
145- exchange_record .notify_action_complete ("generate" , message = message )
145+ if exchange_record .edi_exchange_state == "output_pending" :
146+ exchange_record .notify_action_complete ("generate" , message = message )
146147 return message
147148
148149 # TODO: unify to all other checkes that return something
@@ -258,7 +259,11 @@ def exchange_send(self, exchange_record):
258259 "exchanged_on" : fields .Datetime .now (),
259260 }
260261 )
261- exchange_record .notify_action_complete ("send" , message = message )
262+ if exchange_record .edi_exchange_state in [
263+ "output_sent" ,
264+ "output_sent_and_processed" ,
265+ ]:
266+ exchange_record .notify_action_complete ("send" , message = message )
262267 return res
263268
264269 def _swallable_exceptions (self ):
@@ -466,7 +471,8 @@ def exchange_process(self, exchange_record):
466471 exchange_record ._notify_error ("process_ko" )
467472 elif state == "input_processed" :
468473 exchange_record ._notify_done ()
469- exchange_record .notify_action_complete ("process" , message = message )
474+ if exchange_record .edi_exchange_state == "input_processed" :
475+ exchange_record .notify_action_complete ("process" , message = message )
470476 return res
471477
472478 def _exchange_process (self , exchange_record ):
@@ -522,7 +528,8 @@ def exchange_receive(self, exchange_record):
522528 "exchanged_on" : fields .Datetime .now (),
523529 }
524530 )
525- exchange_record .notify_action_complete ("receive" , message = message )
531+ if exchange_record .edi_exchange_state == "input_processed" :
532+ exchange_record .notify_action_complete ("receive" , message = message )
526533 return res
527534
528535 def _exchange_receive_check (self , exchange_record ):
0 commit comments