This forum is now just an archive. Use the new Q&A website
It is currently Thu Apr 24, 2014 4:02 am

All times are UTC + 2 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: To do a warning
PostPosted: Thu Dec 06, 2012 11:19 am 
Offline

Joined: Mon Oct 15, 2012 5:06 pm
Posts: 5
Location: Belgium
Hello !

I would like to do a "warning" (message box with a warn) but I don't understand why it doesn't work.

I have a fields function :

'tax_final':fields.function(check_tax_prod,method=True,type="char",string="Tva")

And then, the function :

Quote:
def check_tax_prod(self, cr, uid, ids, fields_name=None , arg=None, context=None):


for id in ids:
objet = self.browse(cr,uid,id)
for line in objet.order_line:
for tax in line.tax_id:
tab_tax.append(tax.name)


for i in range(0,len(tab_tax)):
for j in range(1, len(tab_tax)):

if tab_tax[i]== tab_tax[j]: ==> If OK, return res

res[id]=str(tab_tax[i])
return res

else: ==> Else, send the warning

# return {'warning': {'Grrrr !! '}}
return {'value':{}, 'warning':{'title':'warning','message':'Negative margin on this line'}}




The error sent is :
record[f] = res2[record['id']]
KeyError: 13


Thank for your help ;-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP