How to raise a custom exception in Odoo 10?

maharshi picture maharshi · Dec 5, 2016 · Viewed 7.6k times · Source

Can i have a custom title in validation error/warning in odoo,I don't want Odoo in the title.

I have tried this code

raise odoo.osv.osv.except_osv('title', 'description')

But the title gets ignored.

Answer

Döme picture Döme · Jan 30, 2017

If I know well, by default you can not. However Odoo developers kept backward compatibility. When you use except_orm, then it will show your title text.

In my opinion this is not enough beauty solution.

from odoo import exceptions, _
...
raise exceptions.except_orm(_('My Title), _('My message + lorem ipsum'))

Result popup window: enter image description here