forked from OCA/delivery-carrier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] returns: use same carrier as the original picking by default
- Loading branch information
duongtq
committed
Jul 11, 2023
1 parent
5d24c56
commit 8e09b12
Showing
3 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import models | ||
from . import postlogistics | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_picking_return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |