'''
domain += location and [('location_id', 'child_of', location.id)] or []
domain += [('product_id', '=', product.id)] + domain
+ #don't take into account location that are production, supplier or inventory
+ ignore_location_ids = self.pool.get('stock.location').search(cr, uid, [('usage', 'in', ('production', 'supplier', 'inventory'))], context=context)
+ domain.append(('location_id','not in',ignore_location_ids))
res = []
offset = 0
while quantity > 0:
('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