mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_reserve: Set the correct _default_picking_type_id value
Do not use a fixed value because it will not be compatible with multi-company. TT49168
This commit is contained in:
@@ -77,7 +77,17 @@ class StockReservation(models.Model):
|
|||||||
# If picking_type_id is present and location_id is not, try to find
|
# If picking_type_id is present and location_id is not, try to find
|
||||||
# default value for location_id
|
# default value for location_id
|
||||||
if not res.get("picking_type_id", None):
|
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")
|
picking_type_id = res.get("picking_type_id")
|
||||||
if picking_type_id and not res.get("location_id", False):
|
if picking_type_id and not res.get("location_id", False):
|
||||||
@@ -105,11 +115,6 @@ class StockReservation(models.Model):
|
|||||||
location_id = False
|
location_id = False
|
||||||
return location_id
|
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
|
@api.model
|
||||||
def _default_location_dest_id(self):
|
def _default_location_dest_id(self):
|
||||||
ref = "stock_reserve.stock_location_reservation"
|
ref = "stock_reserve.stock_location_reservation"
|
||||||
|
|||||||
Reference in New Issue
Block a user