Hello,
I have Override the unlink function of my class, as follows:
@api.multi
def unlink(self):
#record = self.env['affichage2.pack_stock'].search(['public_serial','=',self.public_serial])
for record in self:
p = self.env['affichage2.pack_stock'].browse(record.id)
if (p.vente != None or p.vente2 != None):
raise osv.except_osv(('Invalid Action!'), ('Le pack est déjà affecté ! Vous ne pouvez pas le supprimer',p.vente2,p.vente))
rec = super(Pack_Stock, self).unlink()
return rec
This function shows a warning if the records "vente" and "vente2" are not empty. The problem is the verification didn't made well. The function didn't run as i want. How i can access to the values of these 2 fields from the Unlink function ?