diff --git a/delivery_postlogistics/__init__.py b/delivery_postlogistics/__init__.py index e4a5777ced..54f68961c1 100644 --- a/delivery_postlogistics/__init__.py +++ b/delivery_postlogistics/__init__.py @@ -1,2 +1,3 @@ from . import models from . import postlogistics +from . import wizard diff --git a/delivery_postlogistics/wizard/__init__.py b/delivery_postlogistics/wizard/__init__.py new file mode 100644 index 0000000000..ad0b47c23f --- /dev/null +++ b/delivery_postlogistics/wizard/__init__.py @@ -0,0 +1 @@ +from . import stock_picking_return diff --git a/delivery_postlogistics/wizard/stock_picking_return.py b/delivery_postlogistics/wizard/stock_picking_return.py new file mode 100644 index 0000000000..708b209d54 --- /dev/null +++ b/delivery_postlogistics/wizard/stock_picking_return.py @@ -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