[ADD] stock_account: search view improvement

inventory valuation search view was the product's one. This commit add new filters
to the inventory valuation search view and removes the ones specific to products.

It also rename the search view title to the same label as the menu action

PR:22085
TASK:38933
This commit is contained in:
Prakash Prajapati
2018-07-26 15:22:30 +02:00
committed by Simon Lejeune
parent 16e9f8d46f
commit 6fd5c5a8ea
3 changed files with 22 additions and 2 deletions
+2 -1
View File
@@ -91,7 +91,7 @@
</record>
<record id="product_valuation_action" model="ir.actions.act_window">
<field name="name">Product Valuation</field>
<field name="name">Inventory Valuation</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form</field>
@@ -99,6 +99,7 @@
<field name="view_id" ref="view_stock_product_tree2"/>
<field name="domain">[('type', '=', 'product'), ('qty_available', '!=', 0)]</field>
<field name="context">{'company_owned': True}</field>
<field name="search_view_id" ref="view_inventory_valuation_search"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product valuation
@@ -83,6 +83,23 @@
</tree>
</field>
</record>
<record id="view_inventory_valuation_search" model="ir.ui.view">
<field name="name">product.product</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<search string="Inventory Valuation">
<filter string="Category" name="categ_id" context="{'group_by':'categ_id'}"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<separator/>
<filter name="real_stock_available" string="Available Products" domain="[('qty_at_date','&gt;',0)]"/>
<filter name="real_stock_exhausted" string="Exhausted Stock" domain="[('qty_at_date','&lt;=',0),('type','not in',('service', 'consu'))]"/>
<filter name="real_stock_negative" string="Negative Stock" domain="[('qty_at_date','&lt;',0)]"/>
</search>
</field>
</record>
<record id="action_stock_inventory_valuation" model="ir.actions.act_window">
<field name="name">Valuation Report</field>
<field name="res_model">stock.quantity.history</field>
@@ -15,16 +15,18 @@ class StockQuantityHistory(models.TransientModel):
if self.compute_at_date:
tree_view_id = self.env.ref('stock_account.view_stock_product_tree2').id
form_view_id = self.env.ref('stock.product_form_view_procurement_button').id
search_view_id = self.env.ref('stock_account.view_inventory_valuation_search').id
# We pass `to_date` in the context so that `qty_available` will be computed across
# moves until date.
action = {
'type': 'ir.actions.act_window',
'views': [(tree_view_id, 'tree'), (form_view_id, 'form')],
'view_mode': 'tree,form',
'name': _('Products'),
'name': _('Inventory Valuation'),
'res_model': 'product.product',
'domain': "[('type', '=', 'product'), ('qty_available', '!=', 0)]",
'context': dict(self.env.context, to_date=self.date, company_owned=True),
'search_view_id': search_view_id
}
return action
else: