[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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user