From ac67ce4ecc7e04467f3f4e0bdbdb32eef151ab31 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 19 Mar 2015 11:10:51 +0100 Subject: [PATCH] [FIX] stock: quants not being reserved correctly `product_qty` field is not recomputed at record creation. Force field recomputation at any change Removing the trigger on `product.product` should not be a problem as product uom can't be changed once there are move lines. opw:629650 --- addons/stock/stock.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 6b4a5b39442..61391bb2315 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1720,10 +1720,7 @@ class stock_move(osv.osv): 'date': fields.datetime('Date', required=True, select=True, help="Move date: scheduled date until move is done, then date of actual move processing", states={'done': [('readonly', True)]}), 'date_expected': fields.datetime('Expected Date', states={'done': [('readonly', True)]}, required=True, select=True, help="Scheduled date for the processing of this move"), 'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type', '<>', 'service')], states={'done': [('readonly', True)]}), - 'product_qty': fields.function(_quantity_normalize, fnct_inv=_set_product_qty, type='float', digits=0, store={ - 'stock.move': (lambda self, cr, uid, ids, ctx: ids, ['product_id', 'product_uom_qty', 'product_uom'], 20), - 'product.product': (_get_moves_from_prod, ['uom_id'], 20), - }, string='Quantity', + 'product_qty': fields.function(_quantity_normalize, fnct_inv=_set_product_qty, type='float', digits=0, store=True, string='Quantity', help='Quantity in the default UoM of the product'), 'product_uom_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True, states={'done': [('readonly', True)]},