[tryton-debian-vcs] tryton-modules-stock branch upstream-4.0 updated. upstream/4.0.5-1-gf59d8ee
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Thu Aug 17 12:42:17 UTC 2017
The following commit has been merged in the upstream-4.0 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-stock.git;a=commitdiff;h=upstream/4.0.5-1-gf59d8ee
commit f59d8ee34077cefc3a50146c454b751ddc9d7605
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 17 12:17:51 2017 +0200
Adding upstream version 4.0.6.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 1b8178c..d0446e0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.0.6 - 2017-08-08
+* Bug fixes (see mercurial logs for details)
+
Version 4.0.5 - 2016-12-17
* 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 9872713..24cc91f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond_stock
-Version: 4.0.5
+Version: 4.0.6
Summary: Tryton module for stock and inventory
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/location.py b/location.py
index 75e86c7..95c1826 100644
--- a/location.py
+++ b/location.py
@@ -175,15 +175,19 @@ 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([
+ if self.type in invalid_move_types:
+ # Use root to compute for all companies
+ with Transaction().set_user(0):
+ moves = Move.search([
['OR',
('to_location', '=', self.id),
('from_location', '=', self.id),
],
('state', 'not in', ['staging', 'draft']),
- ])):
- self.raise_user_error('invalid_type_for_moves', (self.rec_name,))
+ ])
+ if moves:
+ self.raise_user_error(
+ 'invalid_type_for_moves', (self.rec_name,))
@staticmethod
def default_active():
diff --git a/move.py b/move.py
index 83de17f..02e70f2 100644
--- a/move.py
+++ b/move.py
@@ -82,10 +82,12 @@ class StockMixin(object):
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():
@@ -113,47 +115,35 @@ class StockMixin(object):
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)]
@@ -560,6 +550,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 4bb381e..dce77e3 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=4.0.5
+version=4.0.6
depends:
company
currency
diff --git a/trytond_stock.egg-info/PKG-INFO b/trytond_stock.egg-info/PKG-INFO
index 1725d5e..e16bdec 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: 4.0.5
+Version: 4.0.6
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