Em 27/02/2014 08:46, Sergi Almacellas Abellana escreveu:
El 27/02/14 12:43, Iasmini - Gmail ha escrit:
Hi,

I need to do something just before saving. I did this:

class Invoice:
    __name__ = 'account.invoice'
...
    def save(self):
        if self.rps_number == '':
            if not self.create_rps_number():
                self.raise_user_error(u'xxxx!')

        super(Invoice, self).save()

But this function is not called. Why?
You must override create or/and delete methods which get called by save :)

For the code you are raising, you may be interested on validate:

http://doc.tryton.org/3.0/trytond/doc/ref/models/models.html?highlight=validate#trytond.model.ModelStorage.validate

I thought to override the validate() method, but thought it had a way of making it in save() method. Thank you!

--

Iasmini Gomes
Sílex Sistemas
www.silexsistemas.com.br


---
Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus 
está ativa.
http://www.avast.com

Reply via email to