The test creates 2 product.product on the same product.template,
which is illegal if they don't have different attribute values.
No error is raised, unless another modules runs a "flush", which
does the INSERT in database and fails with:
psycopg2.IntegrityError: duplicate key value violates unique constraint "product_product_combination_unique"
DETAIL: Key (product_tmpl_id, combination_indices)=(31, ) already exists.
Commit 6c16913 changed the way we compute the immediately_usable_qty: instead of using the virtual stock, we used the sum of quants without reservations. But a quant may actually be reserved and still be available (for example it may be reserved for an internal move).
Fixes https://github.com/OCA/stock-logistics-warehouse/issues/79
Remove loop and use correct decorator
Restore the features of stock_available_immediately
The previous fix restored stock_available but then there was no way to exclude the incomming moves from the count. This belongs in stock_available_immediately, restoring it cleanly.
This commit also takes care to respect the distinction between templates and variants, so it should fix https://github.com/OCA/stock-logistics-warehouse/issues/73 too.
Restore the qty avail. to promise on variant treeview
PEP8