From 237f1540847e0120c9aa16f8760201ee9b4c0899 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 23 Dec 2019 17:23:33 +0100 Subject: [PATCH] [FIX] - log message for invoice creation only when there is an invoice --- contract/models/contract.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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