[IMP] stock: group_by WH when multiple WH
The inventory overview should use the 'warehouse' group_by as long as the 'storage locations' setting is on. Task-2428819 Part-of: odoo/odoo#74364
This commit is contained in:
@@ -206,6 +206,16 @@ class PickingType(models.Model):
|
||||
if self.show_operations and self.code != 'incoming':
|
||||
self.show_reserved = True
|
||||
|
||||
@api.model
|
||||
def action_view_picking_type(self):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_picking_type_action")
|
||||
if self.user_has_groups('stock.group_stock_multi_locations'):
|
||||
context = literal_eval(action['context'])
|
||||
context['search_default_groupby_warehouse_id'] = True
|
||||
action['context'] = context
|
||||
|
||||
return action
|
||||
|
||||
def _get_action(self, action_xmlid):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(action_xmlid)
|
||||
if self:
|
||||
|
||||
@@ -97,6 +97,16 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_picking_type_menu_action" model="ir.actions.server">
|
||||
<field name="name">Overview</field>
|
||||
<field name="model_id" ref="stock.model_stock_picking_type"/>
|
||||
<field name="groups_id" eval="[(4, ref('stock.group_stock_user'))]"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = model.action_view_picking_type()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_picking_type_list" model="ir.actions.act_window">
|
||||
<field name="name">Operations Types</field>
|
||||
<field name="res_model">stock.picking.type</field>
|
||||
@@ -113,7 +123,7 @@
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action="stock_picking_type_action"
|
||||
action="stock_picking_type_menu_action"
|
||||
id="stock_picking_type_menu"
|
||||
parent="menu_stock_root" sequence="0"
|
||||
name="Overview"/>
|
||||
|
||||
Reference in New Issue
Block a user