diff options
| author | Goffin Simon <sig@odoo.com> | 2019-07-22 09:56:02 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2019-07-22 12:02:55 +0000 |
| commit | b6e7af37eb93e08f3bf049bd6eb0c52c13e7b4e8 (patch) | |
| tree | d6f1c53d49752ab90864f90f82b81151d3a7be7f /addons | |
| parent | 9b921dae5e24792eba35218bbea3a0dd8dac2cf5 (diff) | |
[FIX] account: Incorrect due date for credit notes
Fine tuning of this commit: d0f3e896d4d29e60e818b806599421be557556cc
To ensure that the date_invoice is a date object because a comparison is
made with date_due
opw:2033438
closes odoo/odoo#35058
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_invoice.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index a94180f3b04..14075ff0c0d 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1504,8 +1504,10 @@ class AccountInvoice(models.Model): values['type'] = TYPE2REFUND[invoice['type']] values['date_invoice'] = date_invoice or fields.Date.context_today(invoice) - if values.get('date_due', False) and values['date_invoice'] > values['date_due']: - values['date_due'] = values['date_invoice'] + if values.get('date_due', False) and values['date_invoice']: + # To ensure that the date_invoice is a date object + if self._fields['date_invoice'].to_date(values['date_invoice']) > values['date_due']: + values['date_due'] = values['date_invoice'] values['state'] = 'draft' values['number'] = False values['origin'] = invoice.number |
