diff --git a/addons/stock/doc/stock.rst b/addons/stock/doc/stock.rst index 0501d0363cc..42b9c79b8a5 100644 --- a/addons/stock/doc/stock.rst +++ b/addons/stock/doc/stock.rst @@ -515,7 +515,7 @@ Negative stocks It is still possible that upon transferring for an internal shipment or delivery, the necessary quants or stock can not be found. In that case, it will create negative stock (negative quants). -When later on, a move brings in some goods that correspond to this negative stock, the quant can be reconciled with it. This will however not happen if this incoming quant has a chained move to another location. +When later on, a move brings in some goods that correspond to this negative stock, the quant can be reconciled with it. Normally, chained moves have to take from their original moves. Only when you do force assign a move with original moves it can also take from the regular stock that is not chained. It will however not assign this stock before actually doing the transfer. diff --git a/addons/stock/product.py b/addons/stock/product.py index 766ab677d84..54353cd010c 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -90,9 +90,8 @@ class product_product(osv.osv): for w in warehouse_obj.browse(cr, uid, wids, context=context): location_ids.append(w.view_location_id.id) - operator = context.get('compute_child',True) and 'child_of' or 'in' + operator = context.get('compute_child', True) and 'child_of' or 'in' domain = context.get('force_company', False) and ['&', ('company_id', '=', context['force_company'])] or [] - domain += [('product_id', 'in', ids)] return ( domain + [('location_id', operator, location_ids)], domain + ['&', ('location_dest_id', operator, location_ids), '!', ('location_id', operator, location_ids)], diff --git a/addons/stock/report/product_stock.py b/addons/stock/report/product_stock.py index b8994368b70..8122e60e4b2 100644 --- a/addons/stock/report/product_stock.py +++ b/addons/stock/report/product_stock.py @@ -42,8 +42,6 @@ class external_pdf(render): return self.pdf -# FP Note: change to use product_qty instead of product_uom_qty to avoid doing conversions - class report_stock(report_int): def create(self, cr, uid, ids, datas, context=None): if context is None: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 6eea4d3e432..c7cb5772039 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -286,13 +286,12 @@ class stock_quant(osv.osv): 'history_ids': fields.many2many('stock.move', 'stock_quant_move_rel', 'quant_id', 'move_id', 'Moves', help='Moves that operate(d) on this quant'), 'company_id': fields.many2one('res.company', 'Company', help="The company to which the quants belong", required=True), + 'inventory_value': fields.function(_calc_inventory_value, string="Inventory Value", type='float', readonly=True), # Used for negative quants to reconcile after compensated by a new positive one 'propagated_from_id': fields.many2one('stock.quant', 'Linked Quant', help='The negative quant this is coming from'), 'negative_move_id': fields.many2one('stock.move', 'Move Negative Quant', help='If this is a negative quant, this will be the move that caused this negative quant.'), 'negative_dest_location_id': fields.related('negative_move_id', 'location_dest_id', type='many2one', relation='stock.location', string="Negative Destination Location", - help="Technical field used to record the destination location of a move that created a negative quant"), - 'inventory_value': fields.function(_calc_inventory_value, string="Inventory Value", type='float', readonly=True), } _defaults = { @@ -489,7 +488,7 @@ class stock_quant(osv.osv): negative_quant_id = self.create(cr, SUPERUSER_ID, negative_vals, context=context) vals.update({'propagated_from_id': negative_quant_id}) - #create the quant as superuser, because we want to restrict the creation of quant manually: they should always use this method to create quants + #create the quant as superuser, because we want to restrict the creation of quant manually: we should always use this method to create quants quant_id = self.create(cr, SUPERUSER_ID, vals, context=context) return self.browse(cr, uid, quant_id, context=context) @@ -3755,17 +3754,12 @@ class stock_pack_operation(osv.osv): new_lot_id = self.pool.get('stock.production.lot').create(cr, uid, {'product_id': product_id}, context=context) self.write(cr, uid, id, {'lot_id': new_lot_id}, context=context) - def _search_and_increment(self, cr, uid, picking_id, domain, filter_visible=False ,visible_op_ids=False, increment=True, context=None): + def _search_and_increment(self, cr, uid, picking_id, domain, filter_visible=False, visible_op_ids=False, increment=True, context=None): '''Search for an operation with given 'domain' in a picking, if it exists increment the qty (+1) otherwise create it :param domain: list of tuple directly reusable as a domain context can receive a key 'current_package_id' with the package to consider for this operation returns True - - previously: returns the update to do in stock.move one2many field of picking (adapt remaining quantities) and to the list of package in the classic one2many syntax - (0, 0, { values }) link to a new record that needs to be created with the given values dictionary - (1, ID, { values }) update the linked record with id = ID (write *values* on it) - (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) ''' if context is None: context = {}