odoo/openerp/addons/base/test/test_ir_values.yml

26 lines
1.1 KiB
YAML

-
Create some default value for some (non-existing) model, for all users.
-
!python {model: ir.values }: |
self.set(cr, uid, 'default', False, 'my_test_ir_value',['unexisting_model'], 'global value')
-
Retrieve it.
-
!python {model: ir.values }: |
# d is a list of triple (id, name, value)
d = self.get(cr, uid, 'default', False, ['unexisting_model'])
assert d[0][1] == u'my_test_ir_value', "Can't retrieve the created default value."
assert d[0][2] == 'global value', "Can't retrieve the created default value."
-
Do it again but for a specific user.
-
!python {model: ir.values }: |
self.set(cr, uid, 'default', False, 'my_test_ir_value',['unexisting_model'], 'specific value', preserve_user=True)
-
Retrieve it and check it is the one for the current user.
-
!python {model: ir.values }: |
d = self.get(cr, uid, 'default', False, ['unexisting_model'])
assert d[0][1] == u'my_test_ir_value', "Can't retrieve the created default value."
assert d[0][2] == 'specific value', "Can't retrieve the created default value."