From 3841b13cddd7a8f9e333eeddfaf154192b92516d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 28 Sep 2015 21:34:13 +0200 Subject: [PATCH] Keep lines order when creating invoice lines The itervalues introduced in changeset 7d28de2f84e4 doesn't keep the order of the lines so it must loop over the lines to keep the order. issue4794 review23431002 --- purchase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/purchase.py b/purchase.py index 7743558cfb..38fc1673d2 100644 --- a/purchase.py +++ b/purchase.py @@ -708,7 +708,9 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin): return invoice = self._get_invoice_purchase(invoice_type) - invoice.lines = list(chain.from_iterable(invoice_lines.itervalues())) + invoice.lines = list(chain.from_iterable( + invoice_lines[l.id] for l in self.lines + if l.id in invoice_lines)) invoice.save() Invoice.update_taxes([invoice])