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

how to add error message in openerp

By
Bulgantamir
on 9/5/13, 2:21 AM 2,942 views

hi I try new dialog box in openerp? and which file I write source .py or .js HELP ME

To "add an error" you just raise an Exception... Can you detail what you want to achieve?

Daniel Reis
on 9/5/13, 6:33 AM
1

raise osv.except_osv(_('Error!'), _('Your error message.'))

from openerp.osv import fields, osv

def approved_update_button(self, cr, uid, ids,context=None):

    temp_line = self.pool.get('bom.template.dummy.line')
    condition='no'
    sum = 0.0    
    for proj in self.browse(cr,uid,ids, context = context):
        project_ids =  temp_line.search(cr,uid,[('product_id','=',proj.product_id.id),('project_id','=',proj.project_id.id)])
        for form in temp_line.browse(cr,uid,project_ids,context=context):
            if proj.product_id == form.product_id:
                sum = proj.qty + form.qty
                temp_line.write(cr, uid, [form.id], {'qty':sum}) 
                self.write(cr, uid, [proj.id], {'state':'Accepted','action_made':'Updated','date_approved': date.today().strftime('%Y-%m-%d')})

    if  temp_line.browse(cr, uid, project_ids, {'state':'Accepted'}):
       condition = 'yes' 
    else:
                raise osv.except_osv(_('Warning!'), _('Selected product is not in BOM or Reference and Product did not match.'))    
    return True

that is my sample code using error message i hope this will help :D

Thank you i use openerp 7.0 I can't find osv.except_osv do you teach me url.....?

Bulgantamir
on 9/6/13, 2:35 AM

OpenERP 7.0 [language skill] how to error message if 2 dropdownlist values are same. For example; if first dropdownlist value: English second dropdownlist value must be different English....dropdownlist1.value =English dropdownlist2.value=English ERROR msg in display,,,,dropdownlist1.value =English dropdownlist2.value=Japan NOTERROR msg in display HELP ME???

Bulgantamir
on 9/10/13, 2:33 AM

you can have if condition.. for example condition = 'no' for m in self.browse(cr,uid,ids, context = context): if m.yourdopdownlist != m.yourdopdownlist condition = 'yes' else: raise osv.except_osv(_('Warning!'), _('Duplicate value in youdropdownlistfield'))
try this if it will or just edit this code..

Lady Sharmane Udtuhan
on 9/10/13, 3:36 AM

i copy this code so i where in paste .py , .osv, and i use def,,,Му source is corect or incorect???????

Bulgantamir
on 9/10/13, 4:35 AM

you will paste this in your .py inside the def that you are using for that dropdownlist..

Lady Sharmane Udtuhan
on 9/10/13, 7:06 AM

def language_shalgah(self, cr, uid, ids, context=None): condition = 'no' for m in self.browse(cr,uid,ids, context = context): if language_language_name != language_second_language_name condition = 'yes' else: raise osv.except_osv(_('Warning!'), _('Select other lanlauge????')) this is correct or incorrect that's error NO HANDLER FOUND help me

Bulgantamir
on 9/10/13, 7:53 AM

def language_shalgah(self, cr, uid, ids, context=None): condition = 'no' for m in self.browse(cr,uid,ids, context = context): if m.language_language_name != m.language_second_language_name condition = 'yes' else: raise osv.except_osv(_('Warning!'), _('Select other lanlauge????')) try this..

Lady Sharmane Udtuhan
on 9/10/13, 8:16 AM

hi paste that source in my .py file but "No handler found." error when I browse to openerp 7 my operation system is windows7 and my web browseer is google chrome what i do help me

Bulgantamir
on 9/11/13, 1:01 AM
0
Bulgantamir
On 9/11/13, 2:38 AM

hi paste that source in my .py file but "No handler found." error when I browse to openerp 7 my operation system is windows7 and my web browseer is google chrome what i do help me

my code is working for me.. i'm using ubuntu and mozilla..

Lady Sharmane Udtuhan
on 9/11/13, 3:15 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

0 follower(s)

Stats

Asked: 9/5/13, 2:21 AM
Seen: 2942 times
Last updated: 3/16/15, 8:10 AM