[FIX] stock: split move
1. Set the Decimal Accuracy of "Product Unit of Measure" to 7. 2. Create a UoM: T-LBS which is the reference for weight and has a precision of 0.01 3. Deactivate KG (which was the previous reference for weight) 4. Create a UoM: T-GT which is BIGGER, with a ratio of 2240.00 and a precision of 0.0000001 (necessary to avoid rounding errors) 5. Set the Product Unit of Measure Decimal Accuracy to 6 digits. 6. Create a Product T-TEST with T-LBS as the UoM ans Tracking as LOTS 7. Create a PO for 60 T-GT 8. Observe a Receipt created for 134,400.0000000 T-LBS 9. Receive 42760 by using LOT SPLIT button, and creating a LOT to hold this amount. 10. Click VALIDATE. 11. Click CREATE BACKORDER. The backorder is created for 91640.01 instead of 91640.00. When the backorder is created, we should make sure to use the same rounding method that was used to compute `product_uom_qty`, in this case 'HALF-UP'. opw-753116
This commit is contained in:
@@ -1836,8 +1836,9 @@ class stock_move(osv.osv):
|
||||
def _quantity_normalize(self, cr, uid, ids, name, args, context=None):
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
res = {}
|
||||
rounding_method = (context or {}).get('rounding_method', 'UP')
|
||||
for m in self.browse(cr, uid, ids, context=context):
|
||||
res[m.id] = uom_obj._compute_qty_obj(cr, uid, m.product_uom, m.product_uom_qty, m.product_id.uom_id, context=context)
|
||||
res[m.id] = uom_obj._compute_qty_obj(cr, uid, m.product_uom, m.product_uom_qty, m.product_id.uom_id, rounding_method=rounding_method, context=context)
|
||||
return res
|
||||
|
||||
def _get_remaining_qty(self, cr, uid, ids, field_name, args, context=None):
|
||||
@@ -2888,9 +2889,11 @@ class stock_move(osv.osv):
|
||||
|
||||
if context.get('source_location_id'):
|
||||
defaults['location_id'] = context['source_location_id']
|
||||
new_move = self.copy(cr, uid, move.id, defaults, context=context)
|
||||
|
||||
ctx = context.copy()
|
||||
ctx['rounding_method'] = 'HALF-UP'
|
||||
new_move = self.copy(cr, uid, move.id, defaults, context=ctx)
|
||||
|
||||
ctx['do_not_propagate'] = True
|
||||
self.write(cr, uid, [move.id], {
|
||||
'product_uom_qty': move.product_uom_qty - uom_qty,
|
||||
|
||||
Reference in New Issue
Block a user