[FIX] stock_account: inventory at date

The "Inventory at Date" has several issues:
- graph and pivot views are not available despite their existence
- the views are not linked to an action, thus it is impossible to save
  it on the dashboard.

opw-703649
This commit is contained in:
Nicolas Martinelli
2017-01-23 09:19:23 +01:00
parent 7180d948f0
commit 79bd2f3062
2 changed files with 22 additions and 9 deletions
@@ -58,4 +58,10 @@
</search>
</field>
</record>
<record id="action_stock_history" model="ir.actions.act_window">
<field name="name">Stock History</field>
<field name="res_model">stock.history</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph,pivot</field>
</record>
</odoo>
@@ -19,12 +19,19 @@ class WizardValuationHistory(models.TransientModel):
history_date=self.date,
search_default_group_by_product=True,
search_default_group_by_location=True)
return {
'domain': "[('date', '<=', '" + self.date + "')]",
'name': _('Stock Value At Date'),
'view_type': 'form',
'view_mode': 'tree',
'res_model': 'stock.history',
'type': 'ir.actions.act_window',
'context': ctx,
}
action = self.env['ir.model.data'].xmlid_to_object('stock_account.action_stock_history')
if not action:
action = {
'view_type': 'form',
'view_mode': 'tree,graph,pivot',
'res_model': 'stock.history',
'type': 'ir.actions.act_window',
}
else:
action = action[0].read()[0]
action['domain'] = "[('date', '<=', '" + self.date + "')]"
action['name'] = _('Stock Value At Date')
action['context'] = ctx
return action