[FIX] account: Incorrect due date for credit notes

Steps to reproduce the bug:

- Create an invoice I
- Set the invoice date in the past and  add payment terms
- Validate I
- Create refund from I

Bug:

The invoice date is set as today but the due date was set in the past.

opw:2033438

closes odoo/odoo#34748

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-07-10 12:14:57 +00:00
parent 01c34a512c
commit bb712ad701
+2
View File
@@ -1076,6 +1076,8 @@ 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']
values['state'] = 'draft'
values['number'] = False
values['origin'] = invoice.number