Odoo Help

0

warning message not working

By
Aneesh
on 6/10/13, 2:56 AM 3,266 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

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
6143
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
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

ClueLogics Technologies Pvt. Ltd.
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 (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11549
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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