[IMP] account: Dates on refund must be consistent

When is created a refund from a invoice, the payment term its cleans,
but not the date due.

In the next case:
1. Create an invoice with date 05/26/2019, with payment term "30 days".
2. Create an invoice refund for invoice in 1, with the same date.

In this case, the payment term in the refund is empty, but the date_due
is the same that in the invoice.

With this change, the date due in the refund is the same that invoice
date.

closes odoo/odoo#38212

X-original-commit: 6828454dc3726d85e4d29b9399d6e8ddd1aaac21
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
fw-bot
2019-10-08 13:49:03 +00:00
parent c72cc497e9
commit 16cd227090
3 changed files with 9 additions and 0 deletions
@@ -893,6 +893,7 @@ class TestAccountMoveInInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'date': move_reversal.date,
'state': 'draft',
'ref': 'Reversal of: %s, %s' % (self.invoice.name, move_reversal.reason),
@@ -937,6 +938,7 @@ class TestAccountMoveInInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'date': move_reversal.date,
'state': 'posted',
'ref': 'Reversal of: %s, %s' % (self.invoice.name, move_reversal.reason),
@@ -1003,6 +1005,7 @@ class TestAccountMoveInInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'currency_id': self.currency_data['currency'].id,
'date': move_reversal.date,
'state': 'draft',
@@ -1058,6 +1061,7 @@ class TestAccountMoveInInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'currency_id': self.currency_data['currency'].id,
'date': move_reversal.date,
'state': 'posted',
@@ -878,6 +878,7 @@ class TestAccountMoveOutInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'name': '/',
'date': move_reversal.date,
'state': 'draft',
@@ -923,6 +924,7 @@ class TestAccountMoveOutInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'date': move_reversal.date,
'state': 'posted',
'ref': 'Reversal of: %s, %s' % (self.invoice.name, move_reversal.reason),
@@ -989,6 +991,7 @@ class TestAccountMoveOutInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'currency_id': self.currency_data['currency'].id,
'date': move_reversal.date,
'state': 'draft',
@@ -1044,6 +1047,7 @@ class TestAccountMoveOutInvoiceOnchanges(InvoiceTestCommon):
},
], {
**self.move_vals,
'invoice_payment_term_id': None,
'currency_id': self.currency_data['currency'].id,
'date': move_reversal.date,
'state': 'posted',
@@ -49,6 +49,7 @@ class AccountMoveReversal(models.TransientModel):
'date': self.date or move.date,
'invoice_date': move.is_invoice(include_receipts=True) and (self.date or move.date) or False,
'journal_id': self.journal_id and self.journal_id.id or move.journal_id.id,
'invoice_payment_term_id': None,
})
# Handle reverse method.