[tryton-debian-vcs] tryton-modules-stock-supply branch upstream updated. upstream/4.2.0-1-g59a0eef
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Tue Feb 14 10:40:24 UTC 2017
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-stock-supply.git;a=commitdiff;h=upstream/4.2.0-1-g59a0eef
commit 59a0eef48bfe7b32df9d1c7430dfb2ca2edd297b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Feb 8 10:55:02 2017 +0100
Adding upstream version 4.2.1.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 2b2c63d..3f20618 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.2.1 - 2017-02-06
+* Bug fixes (see mercurial logs for details)
+
Version 4.2.0 - 2016-11-28
* Bug fixes (see mercurial logs for details)
* Add configuration for the supply period
diff --git a/COPYRIGHT b/COPYRIGHT
index 4c58e29..ae558b7 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
Copyright (C) 2013-2015 NaN-tic.
-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.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index c2934e3..80a86cd 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond_stock_supply
-Version: 4.2.0
+Version: 4.2.1
Summary: Tryton module for stock supply
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/shipment.py b/shipment.py
index e736572..e6acf3d 100644
--- a/shipment.py
+++ b/shipment.py
@@ -74,6 +74,7 @@ class ShipmentInternal(ModelSQL, ModelView):
('provisioning_location', '!=', None),
])
id2location.update({l.id: l for l in provisioned})
+ location_ids = id2location.keys()
# ordered by ids to speedup reduce_ids in products_by_location
if provisioned:
@@ -85,32 +86,36 @@ class ShipmentInternal(ModelSQL, ModelView):
product_ids = id2product.keys()
product_ids.sort()
+ with Transaction().set_context(forecast=True, stock_date_end=today):
+ pbl = Product.products_by_location(
+ location_ids, product_ids, with_childs=True)
+
shipments = []
date = today
end_date = date + lead_time
+ current_qties = pbl.copy()
while date <= end_date:
- with Transaction().set_context(forecast=True, stock_date_end=date):
- pbl = Product.products_by_location(id2location.keys(),
- product_ids, with_childs=True)
-
# Create a list of moves to create
moves = {}
for location in id2location.itervalues():
for product_id in product_ids:
- qty = pbl.get((location.id, product_id), 0)
+ qty = current_qties.get((location.id, product_id), 0)
op = product2op.get((location.id, product_id))
if op:
min_qty, max_qty = op.min_quantity, op.max_quantity
- provisioning_location = op.provisioning_location
+ prov_location = op.provisioning_location
elif location and location.provisioning_location:
min_qty, max_qty = 0, 0
- provisioning_location = location.provisioning_location
+ prov_location = location.provisioning_location
else:
continue
if qty < min_qty:
- key = (
- provisioning_location.id, location.id, product_id)
+ key = (prov_location.id, location.id, product_id)
moves[key] = max_qty - qty
+ # Update quantities for move to create
+ current_qties[
+ (prov_location.id, product_id)] -= moves[key]
+ current_qties[(location.id, product_id)] += moves[key]
# Group moves by {from,to}_location
to_create = {}
@@ -145,6 +150,17 @@ class ShipmentInternal(ModelSQL, ModelView):
shipment.on_change_with_planned_start_date())
shipments.append(shipment)
date += datetime.timedelta(1)
+
+ # Update quantities with next moves
+ with Transaction().set_context(
+ forecast=True,
+ stock_date_start=date,
+ stock_date_end=date):
+ pbl = Product.products_by_location(
+ location_ids, product_ids, with_childs=True)
+ for key, qty in pbl.iteritems():
+ current_qties[key] += qty
+
cls.save(shipments)
cls.wait(shipments)
return shipments
diff --git a/tryton.cfg b/tryton.cfg
index 79bc1a3..a4f2db8 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=4.2.0
+version=4.2.1
depends:
account
ir
diff --git a/trytond_stock_supply.egg-info/PKG-INFO b/trytond_stock_supply.egg-info/PKG-INFO
index 4004ebe..4d98471 100644
--- a/trytond_stock_supply.egg-info/PKG-INFO
+++ b/trytond_stock_supply.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond-stock-supply
-Version: 4.2.0
+Version: 4.2.1
Summary: Tryton module for stock supply
Home-page: http://www.tryton.org/
Author: Tryton
--
tryton-modules-stock-supply
More information about the tryton-debian-vcs
mailing list