[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
This commit is contained in:
Hetashree Chauhan
2019-07-11 13:12:09 +00:00
parent a31ee1c0c6
commit 5262be0a43
@@ -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