From 7e06f1a8edbc8fa69c36cac5e7c65ebb9ce9d6de Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 1 Feb 2019 08:56:12 +0000 Subject: [PATCH] [FIX] account: dates can be datetime.date or strings Open the customers followup report on a line, click on its contextual menu (the down arrow next to invoice name) click change expected payment date Before this commit, there was a traceback, because the new date was a string which has no strftime function from 03c40e310412c62ef83be8e171ddb1aa4153263f we learn that it can either be a string or a date object, as Odoo in v12.0 supports this After this commit, there is no traceback OPW 1933953 OPW 1933979 closes odoo/odoo#30756 --- addons/account/models/account_move.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 9f2b28a7f20..537fb9ba22e 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1124,7 +1124,10 @@ class AccountMoveLine(models.Model): self._update_check() #when we set the expected payment date, log a note on the invoice_id related (if any) if vals.get('expected_pay_date') and self.invoice_id: - msg = _('New expected payment date: ') + fields.Date.to_string(vals['expected_pay_date']) + '.\n' + vals.get('internal_note', '') + str_expected_pay_date = vals['expected_pay_date'] + if isinstance(str_expected_pay_date, date): + str_expected_pay_date = fields.Date.to_string(str_expected_pay_date) + msg = _('New expected payment date: ') + str_expected_pay_date + '.\n' + vals.get('internal_note', '') self.invoice_id.message_post(body=msg) #TODO: check it is an internal note (not a regular email)! #when making a reconciliation on an existing liquidity journal item, mark the payment as reconciled for record in self: