On 27 Feb 08:43, Iasmini - Gmail wrote:
> 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?

Because save is a recent method added for syntactic sugar and so it is
not always (almost never) called.
I think what you are looking for is the validate method:

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

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgpdYhBojIB7i.pgp
Description: PGP signature

Reply via email to