diff options
| author | Vo Minh Thu <vmt@openerp.com> | 2011-10-03 17:35:09 +0200 |
|---|---|---|
| committer | Vo Minh Thu <vmt@openerp.com> | 2011-10-03 17:35:09 +0200 |
| commit | d9b6f5e2d0d0c30e4e55bc72454b6ec4b720232c (patch) | |
| tree | 14eb229c961e3413abd06b6ad1a86d64d2d3a2ab /tests/addons/test_exceptions/models.py | |
| parent | fbb6e5e56aaf36ff652edbec0181a0fcb95a3601 (diff) | |
| parent | bf3d0d604c89edfd709603c8ca261d020e9ac748 (diff) | |
[MERGE] merged trunk.
bzr revid: vmt@openerp.com-20111003153509-8mbfg1t8hm92pult
Diffstat (limited to 'tests/addons/test_exceptions/models.py')
| -rw-r--r-- | tests/addons/test_exceptions/models.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/addons/test_exceptions/models.py b/tests/addons/test_exceptions/models.py new file mode 100644 index 00000000000..45f0e6dbd47 --- /dev/null +++ b/tests/addons/test_exceptions/models.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +import openerp + +class m(openerp.osv.osv.Model): + """ This model exposes a few methods that will raise the different + exceptions that must be handled by the server (and its RPC layer) + and the clients. + """ + _name = 'test.exceptions.model' + + def generate_except_osv(self, cr, uid, ids, context=None): + # title is ignored in the new (6.1) exceptions + raise openerp.osv.osv.except_osv('title', 'description') + + def generate_except_orm(self, cr, uid, ids, context=None): + # title is ignored in the new (6.1) exceptions + raise openerp.osv.orm.except_orm('title', 'description') + + def generate_warning(self, cr, uid, ids, context=None): + raise openerp.exceptions.Warning('description') + + def generate_access_denied(self, cr, uid, ids, context=None): + raise openerp.exceptions.AccessDenied() + + def generate_access_error(self, cr, uid, ids, context=None): + raise openerp.exceptions.AccessError('description') + + def generate_exc_access_denied(self, cr, uid, ids, context=None): + raise Exception('AccessDenied') + + def generate_undefined(self, cr, uid, ids, context=None): + self.surely_undefined_sumbol +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
