diff --git a/contract/models/contract.py b/contract/models/contract.py index 3ee12bf4..b064474f 100644 --- a/contract/models/contract.py +++ b/contract/models/contract.py @@ -453,13 +453,15 @@ class ContractContract(models.Model): even if their next invoicing date is in the future. """ invoice = self._recurring_create_invoice() - self.message_post( - body=_( - 'Contract manually invoiced: ' - 'Invoice' + if invoice: + self.message_post( + body=_( + 'Contract manually invoiced: ' + 'Invoice' + '' + ) + % (invoice._name, invoice.id) ) - % (invoice._name, invoice.id) - ) return invoice @api.multi