**Impacted versions:** 10.0

**Steps to reproduce:**

1. Create a new Stockable Product
2. Set cost price to `2.00`
3. Adjust stock to 10 pcs
4. Enable developer mode
5. Go to Inventory > Reports > Inventory at Date
6. Select current time and retrieve the inventory value

**Current behavior:**
The stock valuation for the product is `0.0`.

**Expected behavior:**
The stock valuation for the product should be `20.0`

**Workaround:**
So, to overcome this issue currently we need to restart odoo and import and export the cost prices for every product.

**Other observations:**
- It seems that `product.price.history` uses [current date without lambda](https://github.com/odoo/odoo/blob/10.0/addons/product/models/product.py#L99) as `datetime`, so the history entry always gets the `datetime` when Odoo was last started up. 
- The second problem is that when product is first created, Odoo creates **two** price history entries with the same `datetime`, `write_date` and `create_date`, but different `cost`. The stock valuation report only takes one of them into account.

**Video/Screenshot link (optional):**
![valuation_issue_workaround](https://cloud.githubusercontent.com/assets/1525066/21567016/63508536-ceb1-11e6-9e1a-0be500f656b9.gif)

.. and the price history in the database:

| id | create_uid | product_id | company_id | datetime                   | cost | write_date                 | create_date                | write_uid | 
|----|------------|------------|------------|----------------------------|------|----------------------------|----------------------------|-----------| 
| 11 | 1          | 5          | 1          | 2016-12-30 10:48:16.000000 | 0    | 2016-12-30 14:52:39.668846 | 2016-12-30 14:52:39.668846 | 1         | 
| 12 | 1          | 5          | 1          | 2016-12-30 10:48:16.000000 | 2    | 2016-12-30 14:52:39.668846 | 2016-12-30 14:52:39.668846 | 1         | 
| 13 | 1          | 5          | 1          | 2016-12-30 10:48:16.000000 | 3    | 2016-12-30 14:53:05.303394 | 2016-12-30 14:53:05.303394 | 1         | 
| 14 | 1          | 5          | 1          | 2016-12-30 14:53:26.000000 | 2    | 2016-12-30 14:53:36.890684 | 2016-12-30 14:53:36.890684 | 1         | 

As you can see, ID's 11 and 12 were created on the exact same millisecond. I changed the price in ID 13 but the `datetime` is still the same. The `datetime` only changes when I restart Odoo.
addons/stock_account/report/stock_history.py
group_lines.setdefault(str(domain), self.search(domain))
                stock_history |= group_lines[str(domain)]
            histories_dict = {}
            not_real_cost_method_products = stock_history.mapped('product_id').filtered(lambda product: product.cost_method != 'real')
            if not_real_cost_method_products:
                self._cr.execute("""SELECT DISTINCT ON (product_id, company_id) product_id, company_id, cost
                    FROM product_price_history
                    WHERE product_id in %s AND datetime <= %s
                    ORDER BY product_id, company_id, datetime DESC""", (tuple(not_real_cost_method_products.ids), date))
                for history in self._cr.dictfetchall():
                    histories_dict[(history['product_id'], history['company_id'])] = history['cost']
            for line in res:
                inv_value = 0.0
                for stock_history in group_lines.get(str(line.get('__domain', domain))):
                    product = stock_history.product_id
                    if product.cost_method == 'real':
                        price = stock_history.price_unit_on_quant
                    else:
                        price = histories_dict.get((product.id, stock_history.company_id.id), 0.0)
                    inv_value += price * stock_history.quantity
                line['inventory_value'] = inv_value
        return res
    @api.one
    def _compute_inventory_value(self):
        if self.product_id.cost_method == 'real':
            self.inventory_value = self.quantity * self.price_unit_on_quant
        else:
            self.inventory_value = self.quantity * self.product_id.get_history_price(self.company_id.id, date=self._context.get('history_date', fields.Datetime.now()))
    @api.model_cr
    def init(self):