[tryton-debian-vcs] tryton-modules-stock branch debian updated. debian/4.4.1-1-2-g28af4af
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 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-stock.git;a=commitdiff;h=debian/4.4.1-1-2-g28af4af
commit 28af4af3f1cf103f9b528c248ee13d0f0adea88d
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 17 12:11:39 2017 +0200
Releasing debian version 4.4.2-1.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/debian/changelog b/debian/changelog
index 0ef0748..f93aeb8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+tryton-modules-stock (4.4.2-1) unstable; urgency=medium
+
+ * Merging upstream version 4.4.2.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Thu, 17 Aug 2017 12:11:39 +0200
+
tryton-modules-stock (4.4.1-1) unstable; urgency=medium
* Change the maintainer address to tryton-debian at lists.alioth.debian.org
commit 93afa3252b9b30e35f50cf57621eed4b57596550
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 17 12:11:38 2017 +0200
Merging upstream version 4.4.2.
diff --git a/CHANGELOG b/CHANGELOG
index 46fbe8e..d25b87a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.4.2 - 2017-08-08
+* Bug fixes (see mercurial logs for details)
+
Version 4.4.1 - 2017-07-01
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index b49b62b..1976bc1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond_stock
-Version: 4.4.1
+Version: 4.4.2
Summary: Tryton module for stock and inventory
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/inventory.py b/inventory.py
index 875d6ed..17ca0a8 100644
--- a/inventory.py
+++ b/inventory.py
@@ -266,7 +266,6 @@ class Inventory(Workflow, ModelSQL, ModelView):
class InventoryLine(ModelSQL, ModelView):
'Stock Inventory Line'
__name__ = 'stock.inventory.line'
- _rec_name = 'product'
_states = {
'readonly': Eval('inventory_state') != 'draft',
}
@@ -357,6 +356,10 @@ class InventoryLine(ModelSQL, ModelView):
def get_rec_name(self, name):
return self.product.rec_name
+ @classmethod
+ def search_rec_name(cls, name, clause):
+ return [('product',) + tuple(clause[1:])]
+
def get_uom(self, name):
return self.product.default_uom.id
diff --git a/location.py b/location.py
index 9add3c2..fcfd97d 100644
--- a/location.py
+++ b/location.py
@@ -177,15 +177,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 22571aa..19e2a04 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/period.py b/period.py
index 34bf713..c874e44 100644
--- a/period.py
+++ b/period.py
@@ -16,7 +16,6 @@ __all__ = ['Period', 'Cache']
class Period(Workflow, ModelSQL, ModelView):
'Stock Period'
__name__ = 'stock.period'
- _rec_name = 'date'
date = fields.Date('Date', required=True, states={
'readonly': Eval('state') == 'closed',
}, depends=['state'])
@@ -74,6 +73,10 @@ class Period(Workflow, ModelSQL, ModelView):
return pool.get('stock.period.cache')
@classmethod
+ def get_rec_name(self, name):
+ return str(self.date)
+
+ @classmethod
@ModelView.button
@Workflow.transition('draft')
def draft(cls, periods):
diff --git a/tryton.cfg b/tryton.cfg
index 6237a89..66b698c 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=4.4.1
+version=4.4.2
depends:
company
currency
diff --git a/trytond_stock.egg-info/PKG-INFO b/trytond_stock.egg-info/PKG-INFO
index c3d7a8e..62f834b 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.4.1
+Version: 4.4.2
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