diff --git a/addons/stock/res_config.py b/addons/stock/res_config.py index 338e9728f66..952407f59b3 100644 --- a/addons/stock/res_config.py +++ b/addons/stock/res_config.py @@ -69,7 +69,7 @@ This installs the module product_expiry."""), help="""Allows you to create and manage your packaging dimensions and types you want to be maintained in your system."""), 'group_stock_tracking_lot': fields.boolean("Track serial number on products", implied_group='stock.group_tracking_lot', - help="""This allows you to manage products by using serial numbers. When you select a serial number on product moves, you can get the upstream or downstream traceability of that product."""), + help="""This allows you to manage products by using serial numbers. When you select a serial number on product moves, you can get the traceability of that product."""), 'group_stock_tracking_owner': fields.boolean("Manage owner on stock", implied_group='stock.group_tracking_owner', help="""This way you can receive products attributed to a certain owner. """), diff --git a/addons/stock/stock.py b/addons/stock/stock.py index bc945d7ee06..899d253e70c 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1164,6 +1164,34 @@ class stock_production_lot(osv.osv): ('name_ref_uniq', 'unique (name, ref)', 'The combination of Serial Number and internal reference must be unique !'), ] + def action_traceability(self, cr, uid, ids, context=None): + """ It traces the information of lots + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + @return: A dictionary of values + """ + quant_obj = self.pool.get("stock.quant") + move_obj = self.pool.get("stock.move") + quants = quant_obj.search(cr, uid, [('lot_id', 'in', ids)], context=context) + moves = set() + for quant in quant_obj.browse(cr, uid, quants, context=context): + moves |= {move.id for move in quant.history_ids} + if moves: + return { + 'domain': "[('id','in',["+','.join(map(str, list(moves)))+"])]", + 'name': _('Traceability'), + 'view_mode': 'tree,form', + 'view_type': 'form', + 'context': {'tree_view_ref': 'stock.view_move_tree'}, + 'res_model': 'stock.move', + 'type': 'ir.actions.act_window', + } + return False + + # ---------------------------------------------------- # Move diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index 432e015600a..332c2130d05 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -78,7 +78,7 @@ Warehouse Management application installed! Manage your product inventoy and stock locations: you can control stock moves history and planning, -watch your stock valuation, and track production lots upstream and downstream (based on serial numbers).

]]>
+watch your stock valuation, and track production lots (based on serial numbers).

]]>
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 524773eff2e..f344e9b5ab9 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -191,8 +191,7 @@
-