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.

2

Add Some Warning messages

By
abdelwahed chiheb
on 6/8/13, 1:13 PM 7,421 views

Hello communities, I work to add some warning messages (non blocking) in the unit sales as the selling price of a product changes. Any one tell me how can i display a warning message !! thanks

3
Alexander
On 6/8/13, 5:18 PM

Hi! You need to add on_change attribute in your field (xml file)

<field name="price" on_change="price_changed()"/>

and define function in your model:

def price_changed(self,cr,uid,ids,context=None):
    #you can do something here
    return {'value':{},'warning':{'title':'warning','message':'Your message'}}

Thanks Alexander, I tried your example and it didn't work

abdelwahed chiheb
on 6/8/13, 6:01 PM

You can read about on_change event. https://doc.openerp.com/trunk/server/03_module_dev_03/#on-change

Perhaps, in your case, you need to do anything else.

Alexander
on 6/8/13, 6:30 PM
7

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, 4:02 AM

hi yes

in in on change of product you can add the warning message

 def onchange_product(self,cr,uid,ids,context=None):
   #you can do something here
   return {'value':{},'warning':{'title':'warning','message':'Your message'}}

or you can exception message also

  raise osv.except_osv(_('warning'), _(' Your message'))

Thanks
Sandeep

Hello i have two datetime fields that calculated diferenc both of them but sometimes i missed to enter date so it raise the error , but i want some custome message instead of error please help me

Atul Kumar jain
on 4/28/14, 10:23 AM
1

Omal Bastin

--Omal Bastin--
1146
| 6 6 8
Kochi, Kerala, India
--Omal Bastin--

Swiming deep into openERP/ODOO

Omal Bastin
On 6/9/13, 3:10 PM

There is a module module called warning in openerp.. Please check that module. it will be helpful for you.

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/8/13, 1:13 PM
Seen: 7421 times
Last updated: 9/14/15, 1:37 PM