Steps:
- Go to Settings > Companies > Manage Companies
- Create a company (1) with a different currency than the one you're in
- Go to inventory > Products > Products > Create a product (2)
- Storable Product
- Cost: 10
- Click Update Quantity
- Create a new quantity line with 1 in On Hand Quantity
- Switch to company (1)
- Go to Inventory > Products > Products > Edit product (2)
- Storable Product
- Cost: 15
- Click Update Quantity
- Create a new quantity line with 1 in On Hand Quantity
- Go back to the product
- Click the "Forecasted" smart button
Bug:
Traceback here:
https://github.com/odoo/odoo/blob/47bfdf0592a5dd93870ca1a9da326351d70087bb/addons/stock_account/report/report_stock_forecasted.py#L17
ValueError: Expected singleton: res.currency(2, 1)
Explanation:
The amount is the sum of the `stock.valuation.layer`s of a product
across all companies and these companies may have different currencies.
This commit scopes the computation of the amount inside the company of
the current warehouse.
Also the `stock.quant` values displayed in the "On Hand" report are not
correct for the other companies when displaying their data by selecting
all the checkboxes in the global company dropdown.
This commit also fixes the amounts in the On Hand view by using the
standard price per company and attributing the correct currency to the
`stock.quant`.
opw:2444593
closesodoo/odoo#65267
X-original-commit: 67d975be75963678d25ae54289b2f1de639c8bed
Signed-off-by: backspac <backspac@users.noreply.github.com>