[FIX] account: Payments on invoices not in date order

Steps to reproduce the bug:

- Create a customer invoice I with an amount of 100$ and validate it
- Register three payments P1 at 11/10, P2 at 12/10 and P3 at 13/10
- Click on button "Print" and the report displays the payments in the right order
P3, P2, P1
- Click on button "Send by email" and click on the attachment with the report

Bug:

The report didn't display the payments in the same order, it displayed P1, P2, P3

opw:1888251

closes odoo/odoo#27895
This commit is contained in:
Goffin Simon
2018-10-17 13:09:52 +00:00
parent ed5417b71f
commit 492f197c91
+1 -1
View File
@@ -223,7 +223,7 @@ class AccountInvoice(models.Model):
for line in self.move_id.line_ids.filtered(lambda l: l.account_id.id == self.account_id.id):
payment_lines.update(line.mapped('matched_credit_ids.credit_move_id.id'))
payment_lines.update(line.mapped('matched_debit_ids.debit_move_id.id'))
self.payment_move_line_ids = self.env['account.move.line'].browse(list(payment_lines))
self.payment_move_line_ids = self.env['account.move.line'].browse(list(payment_lines)).sorted()
name = fields.Char(string='Reference/Description', index=True,
readonly=True, states={'draft': [('readonly', False)]}, copy=False, help='The name that will be used on account move lines')