Skip to content

Commit

Permalink
Merge pull request #138 from akretion/16.0-roulier-multi-tracking-man…
Browse files Browse the repository at this point in the history
…agement

[IMP] delivery_roulier : allow to easily by pass the tracking url per…
  • Loading branch information
florian-dacosta authored Jun 14, 2023
2 parents 169fcad + 6159960 commit dfe5e0a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions delivery_roulier/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def _get_to_address(self):
def _cancel_shipment(self):
pass

@implemented_by_carrier
def _support_multi_tracking(self):
pass

# End of API.

# Implementations for base_delivery_carrier_label
Expand Down Expand Up @@ -258,6 +262,12 @@ def _roulier_get_service(self, account, package=None):
}
return service

def _roulier_support_multi_tracking(self):
# By default roulier carrier may have one tracking ref per pack.
# override this method for your carrier if you always have a unique
# tracking per picking
return True

def open_website_url(self):
"""Open tracking page.
Expand All @@ -271,8 +281,11 @@ def open_website_url(self):
packages = self.package_ids
if len(packages) == 0:
raise UserError(_("No packages found for this picking"))
elif len(packages) == 1:
return packages.open_website_url() # shortpath
else:
if not self._support_multi_tracking():
packages = packages[0]
if len(packages) == 1:
return packages.open_website_url() # shortpath

# display a list of pickings
xmlid = "stock.action_package_view"
Expand Down

0 comments on commit dfe5e0a

Please sign in to comment.