[IMP] - use available_quantity to compute contains_unreserved

This commit is contained in:
sbejaoui
2021-06-09 10:25:25 +02:00
parent 0affe055f6
commit c4220b79a8

View File

@@ -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