[FIX] delivery: return label portal download

Before this commit
================
- Portal users were not able to download the return label via the portal because
the Access token is not passed.

After this commit
================
- Portal users are able to download return labels via the portal.

task-3245766

closes odoo/odoo#147315

X-original-commit: 2b9fe4854078e237b5da7e97e4ff3fa8d6c270a9
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Gitashri Mantha(gman)
2023-12-22 16:14:53 +00:00
committed by kir-odoo
parent b467658170
commit 06d6000ae9
2 changed files with 5 additions and 2 deletions
@@ -50,9 +50,12 @@ class DeliveryCarrier(models.Model):
def get_return_label(self, pickings, tracking_number=None, origin_date=None):
self.ensure_one()
if self.can_generate_return:
return getattr(self, '%s_get_return_label' % self.delivery_type)(
res = getattr(self, '%s_get_return_label' % self.delivery_type)(
pickings, tracking_number, origin_date
)
if self.get_return_label_from_portal:
pickings.return_label_ids.generate_access_token()
return res
def get_return_label_prefix(self):
return 'LabelReturn-%s' % self.delivery_type
@@ -25,7 +25,7 @@
</t>
</div>
<div t-if="picking.carrier_id.get_return_label_from_portal and picking.return_label_ids">
<a class="ms-3" t-attf-href="/web/content/#{picking.return_label_ids[:1].id}" target="_blank">
<a class="ms-3" t-attf-href="/web/content/#{picking.return_label_ids[:1].id}?access_token=#{i.return_label_ids[:1].access_token}" target="_blank">
Print Return Label
</a>
</div>