diff --git a/addons/stock/tests/test_quant_inventory_mode.py b/addons/stock/tests/test_quant_inventory_mode.py index 6076b8e0964..3cca7ba49e0 100644 --- a/addons/stock/tests/test_quant_inventory_mode.py +++ b/addons/stock/tests/test_quant_inventory_mode.py @@ -197,7 +197,13 @@ class TestEditableQuant(SavepointCase): """ Try to edit a record without the inventory mode. Must raise an error. """ - user_demo = self.env.ref('base.user_demo') + self.demo_user = self.env['res.users'].with_context({'no_reset_password': True, 'mail_create_nosubscribe': True}).create({ + 'name': 'Pauline Poivraisselle', + 'login': 'pauline', + 'email': 'p.p@example.com', + 'notification_type': 'inbox', + 'groups_id': [(6, 0, [self.env.ref('base.group_user').id])] + }) user_admin = self.env.ref('base.user_admin') quant = self.Quant.create({ 'product_id': self.product.id, @@ -207,7 +213,7 @@ class TestEditableQuant(SavepointCase): self.assertEqual(quant.quantity, 12) # Try to write on quant without permission with self.assertRaises(AccessError): - quant.with_user(user_demo).write({'inventory_quantity': 8}) + quant.with_user(self.demo_user).write({'inventory_quantity': 8}) self.assertEqual(quant.quantity, 12) # Try to write on quant with permission