[IMP] stock_account: merge inventory reports menus
Previously we had 'Inventory at Date' (debug mode) and 'Inventory Valuation' Both have been merged into 'Inventory Valuation' that pops up a wizard asking whether you want the current one or the one from a specific date. Depending on which one you choose you will get either report from the previous menus. (stock.quant or stock.history model)
This commit is contained in:
committed by
Denis Vermylen (dve)
parent
6481ff9d2f
commit
81acd4dee2
@@ -8,23 +8,30 @@ class WizardValuationHistory(models.TransientModel):
|
||||
_name = 'wizard.valuation.history'
|
||||
_description = 'Wizard that opens the stock valuation history table'
|
||||
|
||||
choose_date = fields.Boolean('Inventory at Date')
|
||||
date = fields.Datetime('Date', default=fields.Datetime.now, required=True)
|
||||
compute_at_date = fields.Selection([
|
||||
(0, 'Current Inventory'),
|
||||
(1, 'At a Specific Date')
|
||||
], string="Compute", help="Choose to analyze the current inventory or from a specific date in the past.")
|
||||
date = fields.Datetime('Inventory at Date', help="Choose a date to get the inventory at that date", default=fields.Datetime.now())
|
||||
|
||||
@api.multi
|
||||
def open_table(self):
|
||||
self.ensure_one()
|
||||
ctx = dict(
|
||||
self._context,
|
||||
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,
|
||||
}
|
||||
if self.compute_at_date and self.date:
|
||||
ctx = dict(
|
||||
self._context,
|
||||
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,
|
||||
}
|
||||
else:
|
||||
action = self.env.ref('stock.quantsact').read()[0]
|
||||
return action
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_wizard_valuation_history" model="ir.ui.view">
|
||||
<field name="name">Inventory at Date</field>
|
||||
<field name="name">Inventory Valuation Report</field>
|
||||
<field name="model">wizard.valuation.history</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Choose your date">
|
||||
<p class="oe_gray" attrs="{'invisible': [('choose_date', '=', False)]}">
|
||||
Choose a date in the past to get the inventory at that date.
|
||||
</p>
|
||||
<p class="oe_gray" attrs="{'invisible': [('choose_date', '=', True)]}">
|
||||
Retrieve the curent stock valuation.
|
||||
</p>
|
||||
<group>
|
||||
<field name="choose_date"/>
|
||||
<field name="date" attrs="{'invisible': [('choose_date', '=', False)]}"/>
|
||||
<group>
|
||||
<field name="compute_at_date" widget="radio"/>
|
||||
<field name="date" attrs="{'invisible': [('compute_at_date', '=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="open_table" string="Retrieve the Inventory Value" type="object" class="btn-primary"/>
|
||||
@@ -23,12 +19,12 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_wizard_stock_valuation_history" model="ir.actions.act_window">
|
||||
<field name="name">Inventory at Date</field>
|
||||
<field name="name">Inventory Valuation Report</field>
|
||||
<field name="res_model">wizard.valuation.history</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_wizard_valuation_history"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem id="menu_action_wizard_valuation_history" action="action_wizard_stock_valuation_history" parent="stock.menu_warehouse_report" sequence="1" groups="base.group_no_one"/>
|
||||
<menuitem id="stock.menu_quants" name="Inventory Valuation" parent="stock.menu_warehouse_report" sequence="120" action="action_wizard_stock_valuation_history"/>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user