[REF] base: replace toggle method by already-existing toggle_active for ir.ui.view
Toggle method defined on ir.ui.view does the same job of toggle_active that is the generic one available on all models. Task ID 2170708 Community PR odoo/odoo#46563
This commit is contained in:
@@ -301,7 +301,7 @@ class Website(Home):
|
||||
|
||||
@http.route('/website/toggle_switchable_view', type='json', auth='user', website=True)
|
||||
def toggle_switchable_view(self, view_key):
|
||||
request.website.viewref(view_key).toggle()
|
||||
request.website.viewref(view_key).toggle_active()
|
||||
|
||||
@http.route('/website/reset_template', type='http', auth='user', methods=['POST'], website=True, csrf=False)
|
||||
def reset_template(self, view_id, mode='soft', redirect='/', **kwargs):
|
||||
|
||||
@@ -511,12 +511,6 @@ actual arch.
|
||||
default = dict(default or {}, key=new_key)
|
||||
return super(View, self).copy(default)
|
||||
|
||||
def toggle(self):
|
||||
""" Switches between enabled and disabled statuses
|
||||
"""
|
||||
for view in self:
|
||||
view.write({'active': not view.active})
|
||||
|
||||
# default view selection
|
||||
@api.model
|
||||
def default_view(self, model, view_type):
|
||||
|
||||
@@ -2634,7 +2634,7 @@ class TestOptionalViews(ViewCase):
|
||||
""" Change active states of v2 and v3, check that the results
|
||||
are as expected
|
||||
"""
|
||||
self.v2.toggle()
|
||||
self.v2.toggle_active()
|
||||
context = {'check_view_ids': self.View.search([]).ids}
|
||||
arch = self.v0.with_context(context).read_combined(['arch'])['arch']
|
||||
self.assertEqual(
|
||||
@@ -2645,7 +2645,7 @@ class TestOptionalViews(ViewCase):
|
||||
)
|
||||
)
|
||||
|
||||
self.v3.toggle()
|
||||
self.v3.toggle_active()
|
||||
context = {'check_view_ids': self.View.search([]).ids}
|
||||
arch = self.v0.with_context(context).read_combined(['arch'])['arch']
|
||||
self.assertEqual(
|
||||
@@ -2657,7 +2657,7 @@ class TestOptionalViews(ViewCase):
|
||||
)
|
||||
)
|
||||
|
||||
self.v2.toggle()
|
||||
self.v2.toggle_active()
|
||||
context = {'check_view_ids': self.View.search([]).ids}
|
||||
arch = self.v0.with_context(context).read_combined(['arch'])['arch']
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user