mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-25 08:23:46 +00:00
Post save custom dans la fonction save, pour __original_valid
This commit is contained in:
parent
8062260358
commit
70c54f96c7
1 changed files with 7 additions and 5 deletions
|
@ -233,10 +233,14 @@ class Facture(BaseInvoice):
|
||||||
}
|
}
|
||||||
self.__original_valid = self.valid
|
self.__original_valid = self.valid
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
super(Facture, self).save(*args, **kwargs)
|
||||||
|
if not self.__original_valid and self.valid:
|
||||||
|
send_mail_invoice(self)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.user) + ' ' + str(self.date)
|
return str(self.user) + ' ' + str(self.date)
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=Facture)
|
@receiver(post_save, sender=Facture)
|
||||||
def facture_post_save(**kwargs):
|
def facture_post_save(**kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -245,9 +249,7 @@ def facture_post_save(**kwargs):
|
||||||
facture = kwargs['instance']
|
facture = kwargs['instance']
|
||||||
if facture.valid:
|
if facture.valid:
|
||||||
user = facture.user
|
user = facture.user
|
||||||
if not facture.__original_valid:
|
|
||||||
user.set_active()
|
user.set_active()
|
||||||
send_mail_invoice(facture)
|
|
||||||
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
|
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue