Skip to content

Commit

Permalink
[IMP] returns: use same carrier as the original picking by default
Browse files Browse the repository at this point in the history
  • Loading branch information
duongtq committed Jul 11, 2023
1 parent 5d24c56 commit 8e09b12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions delivery_postlogistics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import models
from . import postlogistics
from . import wizard
1 change: 1 addition & 0 deletions delivery_postlogistics/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_picking_return
12 changes: 12 additions & 0 deletions delivery_postlogistics/wizard/stock_picking_return.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from odoo import models


class ReturnPicking(models.TransientModel):
_inherit = "stock.return.picking"

def _create_returns(self):
new_picking, pick_type_id = super(ReturnPicking, self)._create_returns()
if self.picking_id.delivery_type == "postlogistics":
picking = self.env["stock.picking"].browse(new_picking)
picking.write({"carrier_id": self.picking_id.carrier_id.id})
return new_picking, pick_type_id

0 comments on commit 8e09b12

Please sign in to comment.