İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
7441 Görünümler

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

Avatar
Vazgeç

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

En İyi Yanıt

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

Avatar
Vazgeç
Üretici

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

Üretici

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???

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

Üretici

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

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

Üretici

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

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

Üretici

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

Üretici En İyi Yanıt

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

Avatar
Vazgeç

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