mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
50 lines
2.4 KiB
Diff
50 lines
2.4 KiB
Diff
diff -r 463332839c4e trytond/trytond/modules/stock_lot/stock.py
|
|
--- a/trytond/trytond/modules/stock_lot/stock.py Wed May 11 11:26:49 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock_lot/stock.py Mon May 30 14:50:17 2016 +0200
|
|
@@ -120,16 +120,19 @@
|
|
round=False)
|
|
if quantity < out_quantity:
|
|
outgoing_moves.extend(Move.copy([out_move], default={
|
|
- 'quantity': out_quantity - quantity,
|
|
+ 'quantity': Uom.round(
|
|
+ out_quantity - quantity,
|
|
+ out_move.uom.rounding),
|
|
}))
|
|
Move.write([out_move], {
|
|
- 'quantity': quantity,
|
|
+ 'quantity': Uom.round(
|
|
+ quantity, out_move.uom.rounding),
|
|
})
|
|
Move.write([out_move], {
|
|
'lot': move.lot.id,
|
|
})
|
|
quantity -= out_quantity
|
|
- assert quantity <= 0
|
|
+ assert quantity <= move.product.default_uom.rounding
|
|
|
|
|
|
class ShipmentOutReturn:
|
|
diff -r 95ad0421e638 trytond/trytond/modules/stock/shipment.py
|
|
--- a/trytond/trytond/modules/stock/shipment.py Wed May 11 11:24:37 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/shipment.py Mon May 30 14:51:55 2016 +0200
|
|
@@ -1205,6 +1205,8 @@
|
|
for move in shipment.outgoing_moves:
|
|
if move.state == 'cancel':
|
|
continue
|
|
+ if (outgoing_qty.get(move.product.id, 0.0)
|
|
+ > move.product.default_uom.rounding):
|
|
if outgoing_qty.get(move.product.id, 0.0) > 0.0:
|
|
exc_qty = Uom.compute_qty(move.product.default_uom,
|
|
outgoing_qty[move.product.id], move.uom)
|
|
@@ -1213,7 +1215,9 @@
|
|
round=False)
|
|
if write:
|
|
Move.write([move], {
|
|
- 'quantity': max(0.0, move.quantity - exc_qty),
|
|
+ 'quantity': max(0.0, Uom.round(
|
|
+ move.quantity - exc_qty,
|
|
+ move.uom.rounding)),
|
|
})
|
|
outgoing_qty[move.product.id] -= removed_qty
|
|
|