Merge PR #2036 into 14.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2024-05-21 07:45:58 +00:00

View File

@@ -77,7 +77,17 @@ class StockReservation(models.Model):
# If picking_type_id is present and location_id is not, try to find
# default value for location_id
if not res.get("picking_type_id", None):
res["picking_type_id"] = self._default_picking_type_id()
res["picking_type_id"] = (
self.env["stock.picking.type"]
.search(
[
("code", "=", "outgoing"),
("company_id", "=", res.get("company_id")),
],
limit=1,
)
.id
)
picking_type_id = res.get("picking_type_id")
if picking_type_id and not res.get("location_id", False):
@@ -105,11 +115,6 @@ class StockReservation(models.Model):
location_id = False
return location_id
@api.model
def _default_picking_type_id(self):
ref = "stock.picking_type_out"
return self.env.ref(ref, raise_if_not_found=False).id
@api.model
def _default_location_dest_id(self):
ref = "stock_reserve.stock_location_reservation"