[FIX] purchase: Purchase Analysis view was using incorrect JOIN order

The starting table for Purchase Analysis is purchase_order_line
not purchase_order. The previous code was using a wrong JOIN
combination starting from purchase_order, which resulted in
a crash if an empty PO was created.
In order to prevent this an extra  WHERE clause on product_id
being NOT NULL was added, but this was incorrect too as it
prevented PO lines with no product_id value from appearing
in the Purchase Analysis results, while being perfectly valid.
[FIX] stock: `product cost` field in partial picking wizard must respect decimal precision

Without the right precision the default rounding is
applied and causes a possible loss of precision when
the `Product Price` precision is increased.
This can in turn lead to incorrect average price
computations.
[FIX] stock: programming error in average price computation for multiple lines of the same product

While processing a picking we must keep track of
previously processed lines as they modify the
stock on hand but are not yet included in the
`qty_available` function.
Negative stock on hand is handled as if
the stock was zero as far as the average
price computation is concerned.
[FIX] stock: no early currency rounding when computing average price

It is a common need to set a higher decimal precision
for `Product Price` (i.e. the product cost field) for
high volume / low value items. This may typically
require up to 4-6 decimals for e.g. EUR/USD-based
companies where the currency has 2 decimals.
In that case the product cost should be stored with
full precision without applying the currency rounding.
The appropriate currency rounding will be applied
anyway as soon as a transaction actually uses that
product cost (typically in a SO/PO)