Wednesday, August 24, 2022
1 change · master
New functionality added to Odoo
Customers can now choose a nearby FedEx pickup or drop-off location during website checkout, making delivery more flexible. The FedEx delivery setup also gains an advanced option for custom request data, helping businesses support specialized FedEx requirements when needed.
Original PR description
[ADD] website_delivery_fedex_locations: add module This commit gives access to pick up delivery to the website clients. When enabled, the "Fedex Location" gives the possibility to choose dropoff…
[ADD] website_delivery_fedex_locations: add module
This commit gives access to pick up delivery to the website clients.
When enabled, the "Fedex Location" gives the possibility to choose dropoff
locations close to the client's address.
Since the Location API is really close to the Rate and Ship APIs, the
FedexLocationsRequest class is a child of the FedexRequest.
To be able to add custom the chosen location to the 'ship', 'rate' and
'return' srm requests, the _fedex_update_srm function was added to the
delivery carrier. This function takes the picking or order and the srm
object, so that we have access to all current information.
---
[IMP] delivery_fedex: input custom data
Before this commit, there was no way to insert custom data to the
fedex connector. With this commit, we add a custom field that can be
accesses from the delivery carrier view, only in debug mode.
This custom field will be evaluated like the inside of a python dict().
The keys of this dict will be 'rate', 'ship', 'return' depending on
when/where the user wants to add custom data.
Just before we send the data to the API, the request items are of type
`<class 'zeep.objects.Request'>`. This is practical to keep it that way
until then because the data added to it is checked with the wsdl file.
However, this is not practical when we want to add custom data. This
is more convenient to use a dictionary at this point. Dictionaries are
supported by zeep, so we do not need to convert it back to a zeep
object. to convert the zeep object to a dictionary, we can use the
function `zeep.helpers.serialize_object`. By default, the resulting
object is an ordered dict, which is an instance of a dict.
example of valid custom data:
```
'rate': {
"WebAuthenticationDetail": {
"UserCredential": {
"Key": "MyAwesomeKey",
}
},
},
"ship": {
"RequestedShipment": {
"ShippingDocumentSpecification": {
"ShippingDocumentTypes": {"Format": {"ImageType": "PNG"}}
}
},
}
```