Skip to content

Commit

Permalink
[IMP] api: Remove fields in shipping_info
Browse files Browse the repository at this point in the history
Removed unnecessary fields from the shipping_info in the get_shipping_info endpoint. This change simplifies the response structure and improves performance.

Changes:
- Removed specific fields from the shipping_info response to streamline the data returned by the endpoint.

Closes #25
  • Loading branch information
JAntonioSalas committed May 21, 2024
1 parent a1f3d6d commit dfbaf01
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions hantec_api_ecommerce/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def get_shipping_info(self):
Returns:
dict: A dictionary containing the shipping information.
"""

# Delivery address data
shipping_address = self.partner_shipping_id
fields = [
Expand All @@ -29,19 +28,6 @@ def get_shipping_info(self):
]
address_data = shipping_address.read(fields)[0] if shipping_address else {}

address_data.update(
{
"state": (
shipping_address.state_id.name if shipping_address.state_id else ""
),
"country": (
shipping_address.country_id.name
if shipping_address.country_id
else ""
),
}
)

# Get related shipping records
pickings = self.picking_ids

Expand All @@ -63,7 +49,6 @@ def get_shipping_info(self):
"name": picking.name,
"scheduled_date": picking.scheduled_date,
"state": picking.state,
"tracking_reference": picking.carrier_tracking_ref,
"lines": lines_data,
"address_data": address_data,
}
Expand Down

0 comments on commit dfbaf01

Please sign in to comment.