diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index ba6750ac563..1ef3e9d413b 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3515,7 +3515,9 @@ class AccountMove(models.Model): def _compute_narration(self): use_invoice_terms = self.env['ir.config_parameter'].sudo().get_param('account.use_invoice_terms') for move in self: - if not use_invoice_terms or not move.is_sale_document(include_receipts=True): + if not move.is_sale_document(include_receipts=True): + continue + if not use_invoice_terms: move.narration = False else: lang = move.partner_id.lang or self.env.user.lang diff --git a/addons/account/tests/test_account_bank_statement.py b/addons/account/tests/test_account_bank_statement.py index e200c8224d2..8589cf00b7c 100644 --- a/addons/account/tests/test_account_bank_statement.py +++ b/addons/account/tests/test_account_bank_statement.py @@ -927,3 +927,30 @@ class TestAccountBankStatementLine(TestAccountBankStatementCommon): statement_line = statement.line_ids self.assertRecordValues(statement_line, [{'is_reconciled': True, 'amount_residual': 0.0}]) + + def test_statement_line_note_onchange_partner(self): + """ + Check if narration field stays as it is when changing the partner + in reconciliation widget. + """ + bank_stmt = self.env['account.bank.statement'].create({ + 'company_id': self.env.company.id, + 'journal_id': self.bank_journal_1.id, + 'name': 'test', + }) + + bank_stmt_line = self.env['account.bank.statement.line'].create({ + 'payment_ref': 'testLine', + 'statement_id': bank_stmt.id, + 'narration': 'This is a note', + 'amount': 100, + }) + + bank_stmt_line.partner_id = self.partner_b + + self.assertRecordValues(bank_stmt_line, [{ + 'payment_ref': 'testLine', + 'statement_id': bank_stmt.id, + 'narration': '
This is a note
', + 'amount': 100, + }])