OCA / delivery-carrier

Odoo Carriers And Deliveries Management
https://odoo-community.org/psc-teams/logistics-18
GNU Affero General Public License v3.0
112 stars 351 forks source link

[14.0][FIX] delivery_ups_oca: update delivery state #832

Closed manuelregidor closed 2 months ago

manuelregidor commented 3 months ago

Before this fix, the delivery state was not properly updated, as the first UPS state was taken instead of the last one.

manuelregidor commented 3 months ago

@ValentinVinagre

manuelregidor commented 2 months ago

@LoisRForgeFlow @rousseldenis @Cedric-Pigeon Could you have a look, please? Thank you.

HaraldPanten commented 2 months ago

@pedrobaeza @etobella This is a critical FIX for this module. Could you give us a hand in order to move it forward?

THX!

pedrobaeza commented 2 months ago

AFAIK, the idea is to have all the activities added in one shot. This way, you are only getting one update, not the in between. If the activity order is reversed, then do the for reversed, but don't remove such loop.

manuelregidor commented 2 months ago

@pedrobaeza What this FIX does is just getting the most recent state update obtained from the carrier, which is in the first position of the list of the states updates list (shipment["package"][0]["activity"][0]). In the previous version of the module, the element of the states updates list that was taken was the last element, which is not correct, as the last element of the list is the oldest state. This is the value that we need to update the delivery_state field.

However, this method also updates the field tracking_state_history with the full list of states updates, placing the most recent states on top, and this part has remained unchaged.

manuelregidor commented 2 months ago

@pedrobaeza Done

OCA-git-bot commented 2 months ago

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot commented 2 months ago

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot commented 2 months ago

This PR looks fantastic, let's merge it! Prepared branch 14.0-ocabot-merge-pr-832-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot commented 2 months ago

Congratulations, your PR was merged at cc09f6ef2c2ebc0da0bf233ac4e1fd48c6677f80. Thanks a lot for contributing to OCA. ❤️