Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

warning message not working

By
Aneesh
on 6/10/13, 2:56 AM 2,391 views

I want to show a warning message in user interface side in my module in a particular condition.For that I have write the code like this.

raise osv.except_osv(('Warning!'), ("Entered Quantity is greater than quantity on source."))

But in that condition in user interface side it just showing the loading image.

At the console I got the error like this.

2013-06-10 09:45:53,612 364 ←[1;31m←[1;49mERROR←[0m None openerp.netsvc: Warning! Entered Quantity is greater than quantity on source. Traceback (most recent call last): File "C:\OpenErp\openerp\openobject-server\openerp\netsvc.py", line 361, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "C:\OpenErp\openerp\openobject-server\openerp\service\web_services.py", line 585, in dispatch res = fn(db, uid, params) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 167, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 121, in wrapper return f(self, dbname, args, *kwargs) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 164, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "C:\OpenErp\openerp\openobject-addons\mat_mgmt\mat_mgmt.py", line 101, in button_confirm raise osv.except_osv(('Warning!'), ("Entered Quantity is greater than quantity on source.")) except_osv: ('Warning!', 'Entered Quantity is greater than quantity on source.')

c:\openerp\openerp\openobject-addons\mat_mgmt\mat_mgmt.py(101)button_confirm() -> raise osv.except_osv(('Warning!'), ("Entered Quantity is greater than quantity on source."))

I want to show the warning message on user interface side.

Please report your bugs at https://bugs.launchpad.net/openobject-addons

Zahin
on 6/10/13, 2:59 AM
6

Sandeep

--Sandeep--
6083
| 6 5 8
Delhi, India
--Sandeep--
Python OpenERP Developer http://in.linkedin.com/pub/sandeep-rana/3b/a16/786/
Sandeep
On 6/10/13, 3:28 AM

Hey you should use the line code like this

raise osv.except_osv(_('Warning'),_('Entered Quantity is greater than quantity on source.'))

plz don't forget to import a module

  from tools.translate import _

Thanks
Sandeep

Yes, I tried this but I got the same error

Aneesh
on 6/10/13, 4:02 AM

please try again the above error should not be same

Sandeep
on 6/10/13, 4:04 AM

2013-06-10 11:32:42,680 5280 ←[1;31m←[1;49mERROR←[0m None openerp.netsvc: Warning Entered Quantity is greater than quantity on source. Traceback (most recent call last): File "C:\OpenErp\openerp\openobject-server\openerp\netsvc.py", line 361, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "C:\OpenErp\openerp\openobject-server\openerp\service\web_services.py", line 585, in dispatch res = fn(db, uid, *params) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 167, in execute_kw return self.execute(db, uid, obj, me

Aneesh
on 6/10/13, 4:46 AM

return f(self, dbname, args, *kwargs) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "C:\OpenErp\openerp\openobject-server\openerp\osv\osv.py", line 164, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "C:\OpenErp\openerp\openobject-addons\mat_mgmt\mat_mgmt.py", line 103, in button_confirm raise osv.except_osv(_('Warning'),_('Entered Quantity is greater than quantity on source.')) xcept_osv: (u'Warning', u'Entered Quantity is greater than quantity on sour

Aneesh
on 6/10/13, 4:47 AM

above given is the error

Aneesh
on 6/10/13, 4:48 AM

Whether I need to install any module for warning messages

Aneesh
on 6/10/13, 4:53 AM
1

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 6/10/13, 3:01 AM

Try this:

raise osv.except_osv('Warning!', "Entered Quantity is greater than quantity on source.")

If you want to translate them then try this:

First import translate:

from openerp.tools.translate import _

Then write this:

raise osv.except_osv(_('Warning!'), _("Entered Quantity is greater than quantity on source."))

I have tried this but got the same error

Aneesh
on 6/10/13, 3:05 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/10/13, 2:56 AM
Seen: 2391 times
Last updated: 3/16/15, 8:10 AM