diff --git a/modules/purchase_trade/stock.py b/modules/purchase_trade/stock.py index 37be6a7..a01c771 100755 --- a/modules/purchase_trade/stock.py +++ b/modules/purchase_trade/stock.py @@ -480,6 +480,7 @@ class ShipmentIn(metaclass=PoolMeta): fee.mode = mode fee.currency = curr fee.unit = unit + fee.quantity = self.get_bales() or 1 fee.product = Product.get_by_name('Reweighing') fee.price = price Fee.save([fee]) @@ -859,6 +860,12 @@ class ShipmentIn(metaclass=PoolMeta): def get_quantity(self,name=None): if self.incoming_moves: return sum([(e.quantity if e.quantity else 0) for e in self.incoming_moves]) + + def get_bales(self,name=None): + Lot = Pool().get('lot.lot') + lots = Lot.search(['lot_shipment_in','=',self.id]) + if lots: + return sum([l.lot_qt for l in lots]) def get_unit(self,name=None): if self.incoming_moves: