From 191b26972d8970822fe14fd689dc90d3abdac761 Mon Sep 17 00:00:00 2001 From: Sergio Morillo Date: Sat, 22 Dec 2018 18:16:57 +0100 Subject: [PATCH] Avoid duplicate column names in compute quantity when grouping with existing columns issue7916 review53491002 --- move.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/move.py b/move.py index 6197705460..c0d40ce801 100644 --- a/move.py +++ b/move.py @@ -997,7 +997,7 @@ class Move(Workflow, ModelSQL, ModelView): product = Product.__table__() columns = ['id', 'state', 'effective_date', 'planned_date', 'internal_quantity', 'from_location', 'to_location'] - columns += list(grouping) + columns += [c for c in grouping if c not in columns] columns = [get_column(c, move, product) for c in columns] move = (move .join(product, condition=move.product == product.id) @@ -1010,7 +1010,7 @@ class Move(Workflow, ModelSQL, ModelView): if use_product: product_cache = Product.__table__() columns = ['internal_quantity', 'period', 'location'] - columns += list(grouping) + columns += [c for c in grouping if c not in columns] columns = [get_column(c, period_cache, product_cache) for c in columns] period_cache = (period_cache @@ -1026,7 +1026,8 @@ class Move(Workflow, ModelSQL, ModelView): to_location = Location.__table__() to_parent_location = Location.__table__() columns = ['id', 'state', 'effective_date', 'planned_date', - 'internal_quantity'] + list(grouping) + 'internal_quantity'] + columns += [c for c in grouping if c not in columns] columns = [Column(move, c).as_(c) for c in columns] move_with_parent = (move