[tryton-debian-vcs] tryton-modules-carrier-weight branch upstream updated. upstream/4.2.0-1-g9b4f16d

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Jun 7 13:33:10 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-carrier-weight.git;a=commitdiff;h=upstream/4.2.0-1-g9b4f16d

commit 9b4f16d20e3bd60587d2c660305089d5bd08c06e
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Jun 7 15:26:04 2017 +0200

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

diff --git a/CHANGELOG b/CHANGELOG
index 0f962c8..fff80d8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 4.4.0 - 2017-05-01
+* Bug fixes (see mercurial logs for details)
+* Use quantity if unit is weight as fallback for missing measurement
+
 Version 4.2.0 - 2016-11-28
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 2d2b387..bf012da 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
-Copyright (C) 2011-2016 Cédric Krier.
+Copyright (C) 2011-2017 Cédric Krier.
 Copyright (C) 2011-2013 Bertrand Chenal.
-Copyright (C) 2011-2016 Nicolas Évrard.
-Copyright (C) 2011-2016 B2CK SPRL.
+Copyright (C) 2011-2017 Nicolas Évrard.
+Copyright (C) 2011-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 997664c..d9eba16 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_carrier_weight
-Version: 4.2.0
+Version: 4.4.0
 Summary: Tryton module to add cost method "on weight" on carrier
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/4.2/
+Download-URL: http://downloads.tryton.org/4.4/
 Description: trytond_carrier_weight
         ======================
         
@@ -52,7 +52,7 @@ Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
 Classifier: Intended Audience :: Manufacturing
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
 Classifier: Natural Language :: Chinese (Simplified)
diff --git a/common.py b/common.py
new file mode 100644
index 0000000..c22a0f1
--- /dev/null
+++ b/common.py
@@ -0,0 +1,27 @@
+# This file is part of Tryton.  The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+from trytond.pool import Pool
+
+
+def parcel_weight(parcel, carrier_uom, uom_field='uom'):
+    pool = Pool()
+    Uom = pool.get('product.uom')
+
+    weight = 0
+    for line in parcel:
+        product = getattr(line, 'product', None)
+        quantity = getattr(line, 'quantity', None)
+        uom = getattr(line, uom_field, None)
+
+        if not all([product, quantity, uom]):
+            continue
+
+        if product.weight is not None:
+            internal_quantity = Uom.compute_qty(
+                uom, quantity, product.default_uom, round=False)
+            weight += Uom.compute_qty(
+                product.weight_uom, internal_quantity * product.weight,
+                carrier_uom, round=False)
+        elif uom.category == carrier_uom.category:
+            weight += Uom.compute_qty(uom, quantity, carrier_uom, round=False)
+    return weight
diff --git a/locale/lo.po b/locale/lo.po
index d2c09b0..909bce5 100644
--- a/locale/lo.po
+++ b/locale/lo.po
@@ -2,76 +2,66 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
-#, fuzzy
 msgctxt "field:carrier,weight_currency:"
 msgid "Currency"
 msgstr "ສະກຸນເງິນ"
 
 msgctxt "field:carrier,weight_currency_digits:"
 msgid "Weight Currency Digits"
-msgstr ""
+msgstr "ນໍ້າໜັກເລກເສດສະກຸນເງິນ"
 
-#, fuzzy
 msgctxt "field:carrier,weight_price_list:"
 msgid "Price List"
 msgstr "ລາຍການລາຄາ"
 
 msgctxt "field:carrier,weight_uom:"
 msgid "Weight Uom"
-msgstr ""
+msgstr "ຫົວໜ່ວຍນໍ້າໜັກ"
 
 msgctxt "field:carrier,weight_uom_digits:"
 msgid "Weight Uom Digits"
-msgstr ""
+msgstr "ເສດຫົວໜ່ວຍນໍ້າໜັກ"
 
 msgctxt "field:carrier.weight_price_list,carrier:"
 msgid "Carrier"
-msgstr ""
+msgstr "ຜູ້ໃຫ້ບໍລິການ"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,create_date:"
 msgid "Create Date"
-msgstr "ສ້າງວັນທີ"
+msgstr "ວັນທີສ້າງ"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,create_uid:"
 msgid "Create User"
-msgstr "ສ້າງຜູ້ໃຊ້ງານ"
+msgstr "ຜູ້ສ້າງ"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,id:"
 msgid "ID"
-msgstr "ເລດລຳດັບ"
+msgstr "ເລກລຳດັບ"
 
 msgctxt "field:carrier.weight_price_list,price:"
 msgid "Price"
-msgstr ""
+msgstr "ລາຄາ"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,rec_name:"
 msgid "Name"
 msgstr "ຊື່"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,weight:"
 msgid "Weight"
 msgstr "ນໍ້າໜັກ"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,write_date:"
 msgid "Write Date"
 msgstr "ວັນທີບັນທຶກ"
 
-#, fuzzy
 msgctxt "field:carrier.weight_price_list,write_uid:"
 msgid "Write User"
-msgstr "ສ້າງຜູ້ໃຊ້"
+msgstr "ຜູ້ບັນທຶກ"
 
 msgctxt "model:carrier.weight_price_list,name:"
 msgid "Carrier Weight Price List"
-msgstr ""
+msgstr "ລາຍການລາຄາຂອງຜູ້ໃຫ້ບໍລິການນໍ້າໜັກ"
 
-#, fuzzy
 msgctxt "selection:carrier,carrier_cost_method:"
 msgid "Weight"
 msgstr "ນໍ້າໜັກ"
diff --git a/sale.py b/sale.py
index c658331..8584c11 100644
--- a/sale.py
+++ b/sale.py
@@ -3,7 +3,9 @@
 from functools import partial
 from itertools import groupby
 
-from trytond.pool import Pool, PoolMeta
+from trytond.pool import PoolMeta
+
+from .common import parcel_weight
 
 __all__ = ['Sale']
 
@@ -19,8 +21,6 @@ class Sale:
         return None
 
     def _get_carrier_context(self):
-        Uom = Pool().get('product.uom')
-
         context = super(Sale, self)._get_carrier_context()
 
         if self.carrier.carrier_cost_method != 'weight':
@@ -34,16 +34,6 @@ class Sale:
         lines = sorted(lines, key=keyfunc)
 
         for key, parcel in groupby(lines, key=keyfunc):
-            weight = 0
-            for line in parcel:
-                if (getattr(line, 'product', None)
-                        and getattr(line, 'quantity', None)
-                        and getattr(line, 'unit', None)):
-                    quantity = Uom.compute_qty(line.unit, line.quantity,
-                        line.product.default_uom, round=False)
-                    if line.product.weight:
-                        weight += Uom.compute_qty(line.product.weight_uom,
-                            line.product.weight * quantity,
-                            self.carrier.weight_uom, round=False)
-            weights.append(weight)
+            weights.append(parcel_weight(
+                    parcel, self.carrier.weight_uom, 'unit'))
         return context
diff --git a/setup.py b/setup.py
index 9c976c0..85181f4 100644
--- a/setup.py
+++ b/setup.py
@@ -87,7 +87,7 @@ setup(name=name,
         'Intended Audience :: Financial and Insurance Industry',
         'Intended Audience :: Legal Industry',
         'Intended Audience :: Manufacturing',
-        'License :: OSI Approved :: GNU General Public License (GPL)',
+        'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
         'Natural Language :: Bulgarian',
         'Natural Language :: Catalan',
         'Natural Language :: Chinese (Simplified)',
diff --git a/stock.py b/stock.py
index e8b6286..977c0fc 100644
--- a/stock.py
+++ b/stock.py
@@ -3,7 +3,9 @@
 from itertools import groupby
 from functools import partial
 
-from trytond.pool import Pool, PoolMeta
+from trytond.pool import PoolMeta
+
+from .common import parcel_weight
 
 __all__ = ['ShipmentIn', 'ShipmentOut']
 
@@ -19,8 +21,6 @@ class ShipmentIn:
         return None
 
     def _get_carrier_context(self):
-        Uom = Pool().get('product.uom')
-
         context = super(ShipmentIn, self)._get_carrier_context()
         if not self.carrier:
             return context
@@ -35,18 +35,7 @@ class ShipmentIn:
         lines = sorted(lines, key=keyfunc)
 
         for key, parcel in groupby(lines, key=keyfunc):
-            weight = 0
-            for line in parcel:
-                if (getattr(line, 'product', None)
-                        and getattr(line, 'quantity', None)
-                        and getattr(line, 'uom', None)
-                        and line.product.weight):
-                    quantity = Uom.compute_qty(line.uom, line.quantity,
-                        line.product.default_uom, round=False)
-                    weight += Uom.compute_qty(line.product.weight_uom,
-                        line.product.weight * quantity,
-                        self.carrier.weight_uom, round=False)
-            weights.append(weight)
+            weights.append(parcel_weight(parcel, self.carrier.weight_uom))
         return context
 
 
@@ -61,8 +50,6 @@ class ShipmentOut:
         return None
 
     def _get_carrier_context(self):
-        Uom = Pool().get('product.uom')
-
         context = super(ShipmentOut, self)._get_carrier_context()
         if not self.carrier:
             return context
@@ -77,16 +64,5 @@ class ShipmentOut:
         lines = sorted(lines, key=keyfunc)
 
         for key, parcel in groupby(lines, key=keyfunc):
-            weight = 0
-            for line in parcel:
-                if (line.product
-                        and line.quantity
-                        and line.uom
-                        and line.product.weight):
-                    quantity = Uom.compute_qty(line.uom, line.quantity,
-                        line.product.default_uom, round=False)
-                    weight += Uom.compute_qty(line.product.weight_uom,
-                        line.product.weight * quantity,
-                        self.carrier.weight_uom, round=False)
-            weights.append(weight)
+            weights.append(parcel_weight(parcel, self.carrier.weight_uom))
         return context
diff --git a/tryton.cfg b/tryton.cfg
index 48fa93a..6b4ad34 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.2.0
+version=4.4.0
 depends:
     carrier
     company
diff --git a/trytond_carrier_weight.egg-info/PKG-INFO b/trytond_carrier_weight.egg-info/PKG-INFO
index ff94188..08fc748 100644
--- a/trytond_carrier_weight.egg-info/PKG-INFO
+++ b/trytond_carrier_weight.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-carrier-weight
-Version: 4.2.0
+Version: 4.4.0
 Summary: Tryton module to add cost method "on weight" on carrier
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/4.2/
+Download-URL: http://downloads.tryton.org/4.4/
 Description: trytond_carrier_weight
         ======================
         
@@ -52,7 +52,7 @@ Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
 Classifier: Intended Audience :: Manufacturing
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
 Classifier: Natural Language :: Chinese (Simplified)
diff --git a/trytond_carrier_weight.egg-info/SOURCES.txt b/trytond_carrier_weight.egg-info/SOURCES.txt
index e3c0461..4a9caf7 100644
--- a/trytond_carrier_weight.egg-info/SOURCES.txt
+++ b/trytond_carrier_weight.egg-info/SOURCES.txt
@@ -10,6 +10,7 @@ tryton.cfg
 ./__init__.py
 ./carrier.py
 ./carrier.xml
+./common.py
 ./sale.py
 ./stock.py
 ./tryton.cfg
diff --git a/trytond_carrier_weight.egg-info/requires.txt b/trytond_carrier_weight.egg-info/requires.txt
index 27b79c6..25463e7 100644
--- a/trytond_carrier_weight.egg-info/requires.txt
+++ b/trytond_carrier_weight.egg-info/requires.txt
@@ -1,6 +1,6 @@
-trytond_carrier >= 4.2, < 4.3
-trytond_company >= 4.2, < 4.3
-trytond_currency >= 4.2, < 4.3
-trytond_product >= 4.2, < 4.3
-trytond_product_measurements >= 4.2, < 4.3
-trytond >= 4.2, < 4.3
+trytond_carrier >= 4.4, < 4.5
+trytond_company >= 4.4, < 4.5
+trytond_currency >= 4.4, < 4.5
+trytond_product >= 4.4, < 4.5
+trytond_product_measurements >= 4.4, < 4.5
+trytond >= 4.4, < 4.5
-- 
tryton-modules-carrier-weight



More information about the tryton-debian-vcs mailing list