Skip to content
Snippets Groups Projects
Commit 5262be0a authored by Hetashree Chauhan's avatar Hetashree Chauhan
Browse files

[IMP] stock: pass tests without demo data for file test_quant_inventory_mode.

pass all test cases without any demo data.
If a user has not installed any demo data, then also test cases must not be break.

task-2024202
closes : https://github.com/odoo/odoo/pull/34258
parent a31ee1c0
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment