Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2263 Vizualizări

Hi,


We have created an action to call the carrier API when a picking is validated. Basically, we have created a delivery_carrier.py file in our module, then added  xxxx_send_shipping method: this method calls the carrier API to create the expedition and get the tracking number.

This method is executed «correctly» when validating the picking. The problem is that sometimes it is being executed twice, and we don't know why. It is very simple:

def xxxxxx_send_shipping(self, pickings):
try:
tracking_number = self.xxxxxx_create_expedition(pickings)
_logger.info("Tracking Number XXXXX: {}".format(tracking_number))
label_data = self.get_label_data(tracking_number)
mesage_ept = "Generate XXXXX label data file"
pickings.message_post(body=mesage_ept, attachments=[
('XXXXX Label-{}.txt'.format(tracking_number), label_data)])
return [{'exact_price': 0.0, 'tracking_number': tracking_number}]
except Exception as error:
raise ValidationError(error)

Any idea why it is being executed twice? No errors are displayed.


Thanks for your help

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mai 25
901
3
nov. 23
2256
0
mai 19
3575
1
mai 18
8468
0
ian. 16
4428