From d3c6e1fbc217cbec311c9b4185cd5251e70508ce Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Wed, 18 Mar 2020 09:48:52 +0000 Subject: [PATCH] [REM] stock: quant default search group Since trying to create a record in a grouped tree view has no effect (previously that opens a new record in form view), this commit removes useless dynamically added default group for the quant list view. task-2217907 --- addons/stock/models/stock_quant.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index ed914734021..fb30f489341 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -218,17 +218,6 @@ class StockQuant(models.Model): @api.model def action_view_quants(self): self = self.with_context(search_default_internal_loc=1) - if self.user_has_groups('stock.group_production_lot,stock.group_stock_multi_locations'): - # fixme: erase the following condition when it'll be possible to create a new record - # from a empty grouped editable list without go through the form view. - if self.search_count([ - ('company_id', '=', self.env.company.id), - ('location_id.usage', 'in', ['internal', 'transit']) - ]): - self = self.with_context( - search_default_productgroup=1, - search_default_locationgroup=1 - ) if not self.user_has_groups('stock.group_stock_multi_locations'): company_user = self.env.company warehouse = self.env['stock.warehouse'].search([('company_id', '=', company_user.id)], limit=1) @@ -632,13 +621,6 @@ class StockQuant(models.Model): if self._is_inventory_mode(): action['view_id'] = self.env.ref('stock.view_stock_quant_tree_editable').id - # fixme: erase the following condition when it'll be possible to create a new record - # from a empty grouped editable list without go through the form view. - if not self.search_count([ - ('company_id', '=', self.env.company.id), - ('location_id.usage', 'in', ['internal', 'transit']) - ]): - action['context'] = dict(action['context'], search_default_productgroup=0, search_default_locationgroup=0) else: action['view_id'] = self.env.ref('stock.view_stock_quant_tree').id # Enables form view in readonly list