Use weight from stock_shipment_measurements

issue6157
review31021002
This commit is contained in:
Cédric Krier committed 2017-01-31 16:37:34 +01:00
1 parent b398546ea0
commit b780a4e81d
3 files changed
+4 -14

No files matched your search

+1
View File
@@ -9,6 +9,7 @@ Prerequisites
* trytond_account_stock_landed_cost (http://www.tryton.org/)
* trytond_product (http://www.tryton.org/)
* trytond_product_measurements (http://www.tryton.org/)
* trytond_stock_shipment_measurements (http://www.tryton.org/)
Installation
------------
+2 -14
View File
@@ -2,7 +2,7 @@
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from trytond.pool import PoolMeta, Pool
from trytond.pool import PoolMeta
__all__ = ['LandedCost']
@@ -21,25 +21,13 @@ class LandedCost:
def _get_weight_factors(self):
"Return the factor for each move based on weight"
pool = Pool()
ModelData = pool.get('ir.model.data')
Uom = pool.get('product.uom')
kg = Uom(ModelData.get_id('product', 'uom_kilogram'))
moves = [m for s in self.shipments for m in s.incoming_moves
if m.state != 'cancel']
sum_weight = Decimal(0)
weights = {}
for move in moves:
if not move.product.weight:
weight = 0
else:
weight = Uom.compute_qty(
move.product.weight_uom,
move.product.weight * move.internal_quantity,
kg, round=False)
weight = Decimal(str(weight))
weight = Decimal(str(move.internal_weight or 0))
weights[move.id] = weight
sum_weight += weight
factors = {}
+1
View File
@@ -5,3 +5,4 @@ depends:
ir
product
product_measurements
stock_shipment_measurements