Skip to content

Commit

Permalink
[FIX] delivery_postlogistics: avoid overriding attach_shipping_label…
Browse files Browse the repository at this point in the history
… for delivery type other than postlogistics.
  • Loading branch information
hailangvn committed Jan 19, 2022
1 parent 23989c3 commit b8a5078
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions delivery_postlogistics/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _get_packages_from_picking(self):
return packages

def get_shipping_label_values(self, label):
# TODO: consider to depends on base_delivery_carrier_label
self.ensure_one()
return {
"name": label["name"],
Expand All @@ -59,6 +60,8 @@ def get_shipping_label_values(self, label):

def attach_shipping_label(self, label):
"""Attach a label returned by generate_shipping_labels to a picking"""
if self.delivery_type != "postlogistics":
return super().attach_shipping_label(label)
self.ensure_one()
data = self.get_shipping_label_values(label)
context_attachment = self.env.context.copy()
Expand All @@ -76,6 +79,7 @@ def _set_a_default_package(self):
"""Pickings using this module must have a package
If not this method put it one silently
"""
# TODO: consider to depends on base_delivery_carrier_label
for picking in self:
move_lines = picking.move_line_ids.filtered(
lambda s: not (s.package_id or s.result_package_id)
Expand Down

0 comments on commit b8a5078

Please sign in to comment.