From 16cd2270903813016d85a20efd6e11384343fdaf Mon Sep 17 00:00:00 2001 From: fw-bot Date: Mon, 7 Oct 2019 08:59:22 +0000 Subject: [PATCH] [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) --- addons/account/tests/test_account_move_in_invoice.py | 4 ++++ addons/account/tests/test_account_move_out_invoice.py | 4 ++++ addons/account/wizard/account_move_reversal.py | 1 + 3 files changed, 9 insertions(+) diff --git a/addons/account/tests/test_account_move_in_invoice.py b/addons/account/tests/test_account_move_in_invoice.py index f773577d010..9faf050e526 100644 --- a/addons/account/tests/test_account_move_in_invoice.py +++ b/addons/account/tests/test_account_move_in_invoice.py @@ -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', diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py index b37695b2dc4..d76fd555ce7 100644 --- a/addons/account/tests/test_account_move_out_invoice.py +++ b/addons/account/tests/test_account_move_out_invoice.py @@ -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', diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py index 7d4e2fe135e..a5f24cab5f9 100644 --- a/addons/account/wizard/account_move_reversal.py +++ b/addons/account/wizard/account_move_reversal.py @@ -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.