[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:49 +01:00
parent 68dd9bdb0a
commit 49f5aef548
2 changed files with 22 additions and 10 deletions
@@ -26,15 +26,22 @@ class wizard_valuation_history(osv.osv_memory):
ctx['history_date'] = data['date']
ctx['search_default_group_by_product'] = True
ctx['search_default_group_by_location'] = True
return {
'domain': "[('date', '<=', '" + data['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.pool.get('ir.model.data').xmlid_to_object(cr, uid, 'stock_account.action_stock_history', context=context)
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', '<=', '" + data['date'] + "')]"
action['name'] = _('Stock Value At Date')
action['context'] = ctx
return action
class stock_history(osv.osv):
@@ -92,6 +92,11 @@
</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>
</data>
</openerp>