Count as quantity to invoice only moves that reach the destination
issue8951 review264961002
This commit is contained in:
1 parent
7a82b36845
commit
528b46706d
1 file changed
+12
-3
@@ -1371,9 +1371,18 @@ class SaleLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
elif self.sale.invoice_method == 'shipment':
|
||||
quantity = 0.0
|
||||
for move in self.moves:
|
||||
if move.state == 'done':
|
||||
quantity += Uom.compute_qty(move.uom, move.quantity,
|
||||
self.unit)
|
||||
if move.state != 'done':
|
||||
continue
|
||||
qty = Uom.compute_qty(move.uom, move.quantity, self.unit)
|
||||
# Test only against to_location
|
||||
# as it is what matters for sale
|
||||
dest_type = self.to_location.type
|
||||
if (move.to_location.type == dest_type
|
||||
and move.from_location.type != dest_type):
|
||||
quantity += qty
|
||||
elif (move.from_location.type == dest_type
|
||||
and move.to_location.type != dest_type):
|
||||
quantity -= qty
|
||||
if self.quantity < 0:
|
||||
quantity *= -1
|
||||
return quantity
|
||||
|
||||
Reference in new issue
Block a user