[FIX][IMP] stock: product: product_available
[FIX][IMP] stock: product: product_available

When computing the domain to find the product available data, a special case
is currently managed when doing a child_of in locations. Indeed computing
product available data requires to check its related quants. It is possible
through the context to limitate the search to a given set of locations.

The location_id field on stock_quant model is set as auto_join. However the
use of auto_join with the child_of operator is currently not supported by
the ORM. Those parts are converted into (id, in, ids) equivalent domain leaf
that can be costly due to quants table being quite large. The existing code
in product.py therefore tries to manually optimize the quant computation
by computing manually domain with child_of, using parent_left and parent_right.

However there are some cases when parent_left and parent_right can be 0
notably in update mode. However the current code does not correctly take
into account some location not having parent left / right and other having
a parent left / right being still 0 because still not computed. This commit
fixes that, allowing the correct computation of available product data in
update mode.

This limitation has been spotted when migrating stock to the new API. Indeed
unit tests have been added. In those tests product available info was not
correctly computed. Those tests will come when merging the new API version of
stock.

dfang/odoo,hip-odoo/odoo,dfang/odoo,dfang/odoo,hip-odoo/odoo,ygol/odoo,dfang/odoo,hip-odoo/odoo,ygol/odoo,ygol/odoo,hip-odoo/odoo,hip-odoo/odoo,dfang/odoo,hip-odoo/odoo,ygol/odoo,ygol/odoo,ygol/odoo,dfang/odoo,ygol/odoo