[FIX] Post mandate expiration message by register

This commit is contained in:
Aritz Olea
2021-12-09 09:09:26 +01:00
parent 2d87ca0ce0
commit 6f6bccfd7b

View File

@@ -102,16 +102,14 @@ class AccountBankingMandate(models.Model):
)
if expired_mandates:
expired_mandates.write({"state": "expired"})
expired_mandates.message_post(
body=_(
"Mandate automatically set to expired after %d months without use."
for mandate in expired_mandates:
mandate.message_post(
body=_(
"Mandate automatically set to expired after %d months without use."
)
% NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY
)
% NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY
)
logger.info(
"%d SDD Mandate set to expired: IDs %s"
% (len(expired_mandates), expired_mandates.ids)
)
logger.info("SDD Mandate set to expired: ID %s" % (mandate.id))
else:
logger.info("0 SDD Mandates had to be set to Expired")