Skip to content

Commit

Permalink
[FIX]delivery_deliverea:Fixes error when recording shipments
Browse files Browse the repository at this point in the history
When you try to record a shipment in Deliverea, it is calling the pickup URL, not allowing any shipment to be recorded and returning an error.
  • Loading branch information
zahravelasco committed Oct 10, 2024
1 parent 36a88ad commit 96cbbd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions delivery_deliverea/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,16 @@ def _deliverea_check_response(self, response):
def deliverea_return_shipping(self, pickings):
deliverea_request = DelivereaRequest(self)
for picking in pickings:
vals = self._prepare_deliverea_order(picking)
response = deliverea_request.create_return(vals)
self._deliverea_check_response(response)
picking.write(
{
"carrier_tracking_ref": response.get("carrierReference", ""),
"deliverea_reference": response.get("delivereaReference", ""),
}
)
if picking.picking_type_code == "incoming":
vals = self._prepare_deliverea_order(picking)
response = deliverea_request.create_return(vals)
self._deliverea_check_response(response)
picking.write(
{
"carrier_tracking_ref": response.get("carrierReference", ""),
"deliverea_reference": response.get("delivereaReference", ""),
}
)
return True

def deliverea_cancel_shipment(self, pickings):
Expand Down
2 changes: 1 addition & 1 deletion delivery_deliverea/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def deliverea_get_label(self):

def send_to_shipper(self):
self.ensure_one()
if self.delivery_type == "deliverea":
if self.delivery_type == "deliverea" and self.carrier_id.deliverea_return_label:
self.carrier_id.deliverea_return_shipping(self)
self.carrier_id.deliverea_get_return_label(self)
return super().send_to_shipper()
Expand Down

0 comments on commit 96cbbd2

Please sign in to comment.