diff --git a/InvenTree/InvenTree/metadata.py b/InvenTree/InvenTree/metadata.py index b78eaa9d8c..ac06f79d3e 100644 --- a/InvenTree/InvenTree/metadata.py +++ b/InvenTree/InvenTree/metadata.py @@ -60,11 +60,11 @@ class InvenTreeMetadata(SimpleMetadata): del actions[method] # Add a 'DELETE' action if we are allowed to delete - if check(user, table, 'delete'): + if 'DELETE' in view.allowed_methods and check(user, table, 'delete'): actions['DELETE'] = True # Add a 'VIEW' action if we are allowed to view - if check(user, table, 'view'): + if 'GET' in view.allowed_methods and check(user, table, 'view'): actions['GET'] = True except AttributeError: diff --git a/InvenTree/InvenTree/test_api.py b/InvenTree/InvenTree/test_api.py index 7a69e9da6f..7581ec4fec 100644 --- a/InvenTree/InvenTree/test_api.py +++ b/InvenTree/InvenTree/test_api.py @@ -186,8 +186,9 @@ class APITests(InvenTreeAPITestCase): actions = self.getActions(url) + self.assertEqual(len(actions), 2) self.assertIn('POST', actions) - self.assertEqual(len(actions), 1) + self.assertIn('GET', actions) def test_detail_endpoint_actions(self): """