Skip to Content
Menu
This question has been flagged
1 Reply
2608 Views

Fedex has added some new Service types that are i do not see in ODOO 14.

Anyone know if there a way to fetch new service types or myself adding new service types ? 

Avatar
Discard
Best Answer

Yes, it is possible to fetch new service types from FedEx and add them to Odoo 14.

Here are the steps you can follow:

Log in to your FedEx account and navigate to the "Developer Resource Center" section.

In the Developer Resource Center, navigate to the "API Documentation" section and select the API you are using in Odoo 14.

Look for the latest version of the API documentation and search for the list of service types.

Copy the new service types that you want to add to Odoo 14.

In Odoo 14, navigate to the FedEx Shipping Configuration page and open the "Service Types" tab.

Click on the "Create" button to create a new service type.

Enter the name of the new service type and paste the service type code that you copied from the FedEx API documentation.

Save the new service type and repeat the process for any other new service types you want to add.

After adding the new service types, they should be available in Odoo 14 for use in shipping configurations.

Note that adding new service types in this way does not include any specific customizations or functionalities associated with those service types. If you need to customize the behavior of the new service types, you may need to create a custom module or customize the existing FedEx module in Odoo 14.

Avatar
Discard
Author

Dear Geek,
many thanks for your reply. Yes, i found the Fedex Service on this website : https://developer.fedex.com/api/en-us/catalog/ship/docs.html

Should work well. Many thanks

Author

Geek,
somehow i can't find the FedEx Shipping Configuration page. I tried to use the debug mode and go to Settings -> Technical -> Fields. I searched for the field name "fedex_service_type". Then i tried to add my new service types to the list.
When i clicked on Save I get this error message " Properties of base fields cannot be altered in this manner! Please modify them through Python code, preferably through a custom addon!". Any thoughts how to fix it ?

Based on the error message you received, it seems that you're trying to modify a base field in Odoo through the UI, which is not allowed.

To add your new service types to the list, you will need to create a custom addon that extends the existing FedEx shipping module in Odoo. Here are the steps you can follow:

Create a new module: You can create a new module through the Odoo user interface or using the command line.

In your new module, create a new Python file: You can name this file whatever you like, but it's a good idea to name it something descriptive, like "fedex_service_type.py".

In the Python file, create a new class that extends the existing FedEx carrier class in Odoo. You can do this by importing the existing FedEx carrier class and creating a new class that extends it. Here's an example:

python
from odoo.addons.delivery_fedex.models.delivery_carrier import DeliveryFedex

class DeliveryFedexCustom(DeliveryFedex):
_description = "Custom FedEx Delivery Carrier"

def fedex_rate_shipment(self, **kwargs):
# Add your new service types to the list here
# You can access the existing service types using self.fedex_services
# For example, to add a new service type called "My Service Type", you could do:
# self.fedex_services.append(('my_service_type', 'My Service Type'))

# Call the original method to get the updated rates
return super().fedex_rate_shipment(**kwargs)

In your new class, override the fedex_rate_shipment method: This method is called when a customer requests a shipping rate quote from FedEx. In this method, you can add your new service types to the list of available services. You can access the existing list of services using self.fedex_services.

Update the __init__.py file in your new module: In the __init__.py file, you need to import your new class and replace the existing FedEx carrier class with your new custom class. Here's an example:

python
from . import fedex_service_type

# Replace the existing FedEx carrier class with your custom class
from odoo.addons.delivery.models.delivery_carrier import DeliveryCarrier
DeliveryCarrier._inherit = 'delivery.carrier'
DeliveryCarrier._delivery_fedex = fedex_service_type.DeliveryFedexCustom

Install and activate your new module: Once you've made these changes, you can install and activate your new module in Odoo. Your new service types should now be available in the FedEx shipping configuration.

Note that modifying base fields in Odoo through the UI is not recommended, as it can cause problems with other parts of the system. Creating a custom addon is a more robust and flexible solution that allows you to extend the system without interfering with its core functionality.

Related Posts Replies Views Activity
1
Oct 19
3379
0
Apr 25
1216
1
Jul 24
1567
1
Nov 24
1330
0
Aug 22
5873