[tryton-debian-vcs] tryton-modules-stock branch debian-stretch-3.6 updated. debian/3.6.4-1-4-gbd8c1cc

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Thu Aug 17 12:42:08 UTC 2017


The following commit has been merged in the debian-stretch-3.6 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-stock.git;a=commitdiff;h=debian/3.6.4-1-4-gbd8c1cc

commit bd8c1cc06b7d9354c03ba80d91c5056ca01f47c2
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Aug 17 12:13:44 2017 +0200

    Releasing debian version 3.6.5-1.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/debian/changelog b/debian/changelog
index c2c3a3b..5dff0d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+tryton-modules-stock (3.6.5-1) unstable; urgency=medium
+
+  * Add the actual upstream maintainer key to signing-key.asc.
+  * Merging upstream version 3.6.5.
+  * Updating copyright file.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Thu, 17 Aug 2017 12:13:44 +0200
+
 tryton-modules-stock (3.6.4-1) unstable; urgency=medium
 
   * Merging upstream version 3.6.4.
commit 1ebdbab588df324f28b4354ab2193d86a07c2f42
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Aug 17 12:13:43 2017 +0200

    Updating copyright file.

diff --git a/debian/copyright b/debian/copyright
index 043d89f..8358d38 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,9 +2,9 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
 Files: *
 Copyright: 2012 Openlabs Technologies & Consulting (P) LTD
-           2008-2016 Cédric Krier
+           2008-2017 Cédric Krier
            2008-2013 Bertrand Chenal
-           2008-2016 B2CK SPRL
+           2008-2017 B2CK SPRL
            2004-2008 Tiny SPRL
 License: GPL-3+
 
commit a80d6e1d838859251d35d0aca66ecf3cdfa8c5ad
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Aug 17 12:13:43 2017 +0200

    Merging upstream version 3.6.5.

diff --git a/CHANGELOG b/CHANGELOG
index 4e9b489..da1d541 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.6.5 - 2017-08-08
+* Bug fixes (see mercurial logs for details)
+
 Version 3.6.4 - 2016-11-06
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index f5434dd..56796d9 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
 Copyright (C) 2012 Openlabs Technologies & Consulting (P) LTD.
-Copyright (C) 2008-2016 Cédric Krier.
+Copyright (C) 2008-2017 Cédric Krier.
 Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2016 B2CK SPRL.
+Copyright (C) 2008-2017 B2CK SPRL.
 Copyright (C) 2004-2008 Tiny SPRL.
 
 This program is free software: you can redistribute it and/or modify
diff --git a/PKG-INFO b/PKG-INFO
index a7913ce..65cc332 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_stock
-Version: 3.6.4
+Version: 3.6.5
 Summary: Tryton module for stock and inventory
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/location.py b/location.py
index 7de0529..85252ba 100644
--- a/location.py
+++ b/location.py
@@ -163,12 +163,15 @@ class Location(ModelSQL, ModelView):
         """ Check locations with moves have types compatible with moves. """
         invalid_move_types = ['warehouse', 'view']
         Move = Pool().get('stock.move')
-        if (self.type in invalid_move_types
-                and Move.search(['OR',
-                        ('to_location', '=', self.id),
-                        ('from_location', '=', self.id),
-                        ])):
-            self.raise_user_error('invalid_type_for_moves', (self.rec_name,))
+        # Use root to compute for all companies
+        with Transaction().set_user(0):
+            if (self.type in invalid_move_types
+                    and Move.search(['OR',
+                            ('to_location', '=', self.id),
+                            ('from_location', '=', self.id),
+                            ])):
+                self.raise_user_error(
+                    'invalid_type_for_moves', (self.rec_name,))
 
     @staticmethod
     def default_active():
diff --git a/move.py b/move.py
index 601d3dd..9449042 100644
--- a/move.py
+++ b/move.py
@@ -75,10 +75,12 @@ class StockMixin:
             return quantities
 
         product_ids = products and [p.id for p in products] or None
+        with_childs = Transaction().context.get(
+            'with_childs', len(location_ids) == 1)
 
         with Transaction().set_context(cls._quantity_context(name)):
             pbl = Product.products_by_location(location_ids=location_ids,
-                product_ids=product_ids, with_childs=True,
+                product_ids=product_ids, with_childs=with_childs,
                 grouping=grouping)
 
         for key, quantity in pbl.iteritems():
@@ -106,47 +108,35 @@ class StockMixin:
             whose quantity is computed.
         """
         pool = Pool()
-        Location = pool.get('stock.location')
-        Move = pool.get('stock.move')
+        Product = pool.get('product.product')
 
         if not location_ids or not domain:
             return []
-
-        # Skip warehouse location in favor of their storage location
-        # to compute quantities. Keep track of which ids to remove
-        # and to add after the query.
-        if Transaction().context.get('stock_skip_warehouse'):
-            location_ids = set(location_ids)
-            for location in Location.browse(list(location_ids)):
-                if location.type == 'warehouse':
-                    location_ids.remove(location.id)
-                    location_ids.add(location.storage_location.id)
-            location_ids = list(location_ids)
+        with_childs = Transaction().context.get(
+            'with_childs', len(location_ids) == 1)
 
         with Transaction().set_context(cls._quantity_context(name)):
-            query = Move.compute_quantities_query(location_ids,
-                with_childs=True, grouping=grouping,
-                grouping_filter=None)
-            having_domain = getattr(cls, name)._field.convert_domain(domain, {
-                    None: (query, {}),
-                    }, cls)
-            # The last column of 'query' is always the quantity for the 'key'.
-            # It is computed with a SUM() aggregator so in having we have to
-            # use the SUM() expression and not the name of column
-            having_domain.left = query.columns[-1].expression
-            if query.having:
-                query.having &= having_domain
-            else:
-                query.having = having_domain
-            quantities = Move.compute_quantities(query, location_ids,
-                with_childs=True, grouping=grouping,
-                grouping_filter=None)
+            pbl = Product.products_by_location(
+                location_ids=location_ids, with_childs=with_childs,
+                grouping=grouping)
 
+        _, operator_, operand = domain
+        operator_ = {
+            '=': operator.eq,
+            '>=': operator.ge,
+            '>': operator.gt,
+            '<=': operator.le,
+            '<': operator.lt,
+            '!=': operator.ne,
+            'in': lambda v, l: v in l,
+            'not in': lambda v, l: v not in l,
+            }.get(operator_, lambda v, l: False)
         record_ids = []
-        for key, quantity in quantities.iteritems():
-            # pbl could return None in some keys
-            if key[position] is not None:
-                record_ids.append(key[position])
+        for key, quantity in pbl.iteritems():
+            if operator_(quantity, operand):
+                # pbl could return None in some keys
+                if key[position] is not None:
+                    record_ids.append(key[position])
 
         return [('id', 'in', record_ids)]
 
@@ -539,6 +529,7 @@ class Move(Workflow, ModelSQL, ModelView):
         locations = Location.search([
                 ('type', '=', 'storage'),
                 ])
+        context['with_childs'] = False
         context['locations'] = [l.id for l in locations]
         context['stock_date_end'] = Date.today()
         with Transaction().set_context(context):
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..8bfd5a1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/tryton.cfg b/tryton.cfg
index 2bb47e7..ac358b9 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.6.4
+version=3.6.5
 depends:
     company
     currency
diff --git a/trytond_stock.egg-info/PKG-INFO b/trytond_stock.egg-info/PKG-INFO
index c74e471..4115c17 100644
--- a/trytond_stock.egg-info/PKG-INFO
+++ b/trytond_stock.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-stock
-Version: 3.6.4
+Version: 3.6.5
 Summary: Tryton module for stock and inventory
 Home-page: http://www.tryton.org/
 Author: Tryton
-- 
tryton-modules-stock



More information about the tryton-debian-vcs mailing list