[tryton-debian-vcs] tryton-modules-stock-supply branch debian updated. debian/4.2.0-1-3-ga4c5b7c

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Tue Feb 14 10:40:23 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-supply.git;a=commitdiff;h=debian/4.2.0-1-3-ga4c5b7c

commit a4c5b7c3a0c79aec3631f73bdb374e33ca33fffb
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Feb 8 10:55:03 2017 +0100

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

diff --git a/debian/changelog b/debian/changelog
index 4684dd3..6a975cd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+tryton-modules-stock-supply (4.2.1-1) unstable; urgency=medium
+
+  * Merging upstream version 4.2.1.
+  * Updating copyright file.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Wed, 08 Feb 2017 10:55:03 +0100
+
 tryton-modules-stock-supply (4.2.0-1) unstable; urgency=medium
 
   * Updating to Standards-Version: 3.9.8, no changes needed.
commit bc5540da7e640ec60c938ac208bc7ae406f287e4
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Feb 8 10:55:02 2017 +0100

    Updating copyright file.

diff --git a/debian/copyright b/debian/copyright
index ffcbe35..da24cd1 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: 2013-2015 NaN-tic
-           2008-2016 Cédric Krier
+           2008-2017 Cédric Krier
            2008-2013 Bertrand Chenal
-           2008-2016 B2CK SPRL
+           2008-2017 B2CK SPRL
 License: GPL-3+
 
 Files: debian/*
commit 0f4a8a2237e90ebc98752da0c9ae62a134e57bdd
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Feb 8 10:55:02 2017 +0100

    Merging upstream version 4.2.1.

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