changeset fc0e02c01034 in modules/stock:5.0
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=fc0e02c01034
description:
        Avoid duplicate column names in compute quantity when grouping with 
existing columns

        issue7916
        review53491002
        (grafted from 8795daf34917953665e7c950761267c51d2282f9)
diffstat:

 move.py |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 837119fd288f -r fc0e02c01034 move.py
--- a/move.py   Mon Nov 12 23:45:57 2018 +0100
+++ b/move.py   Sat Dec 22 18:16:57 2018 +0100
@@ -985,7 +985,7 @@
             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)
@@ -998,7 +998,7 @@
             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
@@ -1014,7 +1014,8 @@
             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

Reply via email to