[tryton-debian-vcs] tryton-modules-stock branch upstream updated. upstream/3.8.0-1-g4149eb4

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Feb 10 19:55:13 UTC 2016


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.git;a=commitdiff;h=upstream/3.8.0-1-g4149eb4

commit 4149eb4bd8d9ea7c40ac16e51d34c506bbaf0f6c
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Feb 10 18:38:05 2016 +0100

    Adding upstream version 3.8.1.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/CHANGELOG b/CHANGELOG
index 10c4f5f..ee24571 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.8.1 - 2016-02-06
+* Bug fixes (see mercurial logs for details)
+
 Version 3.8.0 - 2015-11-02
 * Bug fixes (see mercurial logs for details)
 * Add drop location type
diff --git a/COPYRIGHT b/COPYRIGHT
index 3a91df4..f5434dd 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
 Copyright (C) 2012 Openlabs Technologies & Consulting (P) LTD.
-Copyright (C) 2008-2015 Cédric Krier.
+Copyright (C) 2008-2016 Cédric Krier.
 Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2015 B2CK SPRL.
+Copyright (C) 2008-2016 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 de99a69..f9748f1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_stock
-Version: 3.8.0
+Version: 3.8.1
 Summary: Tryton module for stock and inventory
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/product.py b/product.py
index 7138a02..17e0d64 100644
--- a/product.py
+++ b/product.py
@@ -2,6 +2,7 @@
 # this repository contains the full copyright notices and license terms.
 import datetime
 from decimal import Decimal
+from collections import defaultdict
 
 from sql import Literal, Null
 from sql.aggregate import Max
@@ -188,28 +189,30 @@ class Product(object, StockMixin):
         pool = Pool()
         Template = pool.get('product.template')
 
-        costs = []
-        for product in products:
-            if product.type == 'service':
-                continue
-            costs.append(getattr(product, 'recompute_cost_price_%s' %
-                product.cost_price_method)())
-
         if hasattr(cls, 'cost_price'):
             digits = cls.cost_price.digits
             write = cls.write
-            records = products
+            record = lambda p: p
         else:
             digits = Template.cost_price.digits
             write = Template.write
-            records = [p.template for p in products]
+            record = lambda p: p.template
+
+        costs = defaultdict(list)
+        for product in products:
+            if product.type == 'service':
+                continue
+            cost = getattr(product,
+                'recompute_cost_price_%s' % product.cost_price_method)()
+            cost = cost.quantize(Decimal(str(10.0 ** -digits[1])))
+            costs[cost].append(record(product))
 
-        costs = [c.quantize(
-            Decimal(str(10.0 ** -digits[1]))) for c in costs]
+        if not costs:
+            return
 
         to_write = []
-        for record, cost in zip(records, costs):
-            to_write.append([record])
+        for cost, records in costs.iteritems():
+            to_write.append(records)
             to_write.append({'cost_price': cost})
 
         # Enforce check access for account_stock*
diff --git a/tryton.cfg b/tryton.cfg
index fb33ff2..3076f98 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.8.0
+version=3.8.1
 depends:
     company
     currency
diff --git a/trytond_stock.egg-info/PKG-INFO b/trytond_stock.egg-info/PKG-INFO
index ee334ea..dfbfd29 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.8.0
+Version: 3.8.1
 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