[FIX] account: Incorrect due date for credit notes
Fine tuning of this commit: d0f3e896d4
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user