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 -- Sergi Almacellas Abellana www.koolpi.com Twitter: @pokoli_srk
