Skip to content

Commit

Permalink
[IMP] Print return label in status Ready
Browse files Browse the repository at this point in the history
  • Loading branch information
duongtq committed Jul 11, 2023
1 parent cf85d18 commit 8b70b5d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions delivery_postlogistics/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,15 @@ def verify_credentials(self):
},
}
return message

def _compute_can_generate_return(self):
res =super(DeliveryCarrier, self)._compute_can_generate_return()
for carrier in self:
if carrier.delivery_type == "postlogistics":
carrier.can_generate_return = True
return res

def postlogistics_get_return_label(
self, picking, tracking_number=None, origin_date=None
):
return self.postlogistics_send_shipping(picking)
8 changes: 7 additions & 1 deletion delivery_postlogistics/views/stock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
<button
name="action_generate_carrier_label"
help="Create Shipping Label 🚚"
attrs="{'invisible': ['|', ('state', '!=', 'done'), ('delivery_type', '!=', 'postlogistics')]}"
attrs="{'invisible': ['|', '|', ('state', '!=', 'done'), ('delivery_type', '!=', 'postlogistics'), ('picking_type_code', '=', 'incoming')]}"
string="Create Shipping Label 🚚"
type="object"
/>
</field>

<button name="print_return_label" position="attributes">
<attribute
name="attrs"
>{'invisible':['|', ('is_return_picking', '=', False),('picking_type_code', '!=', 'incoming')]}</attribute>
</button>

<xpath expr="//page//group[@name='carrier_data']/.." position="after">
<separator
string="Delivery instructions"
Expand Down

0 comments on commit 8b70b5d

Please sign in to comment.