I would like to know how to raise an error when I open a window in Odoo.
For example, I open Sales window, and it'll raise an error or warning like "Hello" or anything else.
I know to use exception like:
from openerp.osv import osv,fields
from openerp.tools.translate import _
from openerp import pooler
from openerp.exceptions import except_orm`
raise osv.except_osv(_('Hello'), _('Hello World'))
but I don't know where should I put the code to raise that.
Use
default_get
method, It will execute whenever click on theCREATE
button.Add a field in
list/form view
ascompute
field, and addraise osv.except_osv(_('Hello'), _('Hello World'))
in compute function.For a button action. define a function and call it in button definition.
<button name='function_name' type='object'/>