mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] - use available_quantity to compute contains_unreserved
This commit is contained in:
@@ -14,14 +14,13 @@ class StockQuant(models.Model):
|
||||
store=True,
|
||||
)
|
||||
|
||||
@api.depends("product_id", "location_id", "quantity", "reserved_quantity")
|
||||
@api.depends("quantity", "reserved_quantity")
|
||||
def _compute_contains_unreserved(self):
|
||||
for record in self:
|
||||
# Avoid error when adding a new line on manually Update Quantity
|
||||
if isinstance(record.id, models.NewId):
|
||||
record.contains_unreserved = False
|
||||
continue
|
||||
available = record._get_available_quantity(
|
||||
record.product_id, record.location_id
|
||||
record.contains_unreserved = (
|
||||
True if record.available_quantity > 0 else False
|
||||
)
|
||||
record.contains_unreserved = True if available > 0 else False
|
||||
|
||||
Reference in New Issue
Block a user