diff --git a/addons/stock/models/stock_traceability.py b/addons/stock/models/stock_traceability.py index 89ffdfbc8ec..f43a0977827 100644 --- a/addons/stock/models/stock_traceability.py +++ b/addons/stock/models/stock_traceability.py @@ -51,7 +51,7 @@ class MrpStockReport(models.TransientModel): move_line = self.env['stock.move.line'] if rec_id and model in ('stock.production.lot', 'stock.move.line'): lines = self.env['stock.move.line'].search([ - ('lot_id', '=', context.get('lot_id') or rec_id), + ('lot_id', '=', context.get('lot_name') or rec_id), ('state', '=', 'done'), ('move_id.returned_move_ids', '=', False), ]) @@ -114,7 +114,8 @@ class MrpStockReport(models.TransientModel): 'model_id': move_line.id, 'model':'stock.move.line', 'product_id': move_line.product_id.display_name, - 'lot_id': move_line.lot_id.name, + 'lot_name': move_line.lot_id.name, + 'lot_id': move_line.lot_id.id, 'product_qty_uom': str(move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id, rounding_method='HALF-UP')) + ' ' + move_line.product_id.uom_id.name, 'location_source': move_line.location_id.name, 'location_destination': move_line.location_dest_id.name, @@ -136,7 +137,8 @@ class MrpStockReport(models.TransientModel): 'parent_id': parent_id, 'model': model or 'stock.move.line', 'product_id': move_line.product_id.display_name, - 'lot_id': move_line.lot_id.name, + 'lot_name': move_line.lot_id.name, + 'lot_id': move_line.lot_id.id, 'product_qty_uom': str(move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id, rounding_method='HALF-UP')) + ' ' + move_line.product_id.uom_id.name, 'location_source': move_line.location_id.name if not move_line.lot_id else False, 'location_destination': move_line.location_dest_id.name if not move_line.lot_id else False, @@ -156,16 +158,17 @@ class MrpStockReport(models.TransientModel): 'parent_id': data['parent_id'], 'usage': data.get('usage', False), 'is_used': data.get('is_used', False), + 'lot_name': data.get('lot_name', False), 'lot_id': data.get('lot_id', False), 'type': 'line', 'reference': data.get('reference_id', False), 'res_id': data.get('res_id', False), 'res_model': data.get('res_model', False), - 'name': _(data.get('lot_id', False)), + 'name': _(data.get('lot_name', False)), 'columns': [data.get('reference_id', False), data.get('product_id', False), data.get('date', False), - data.get('lot_id', False), + data.get('lot_name', False), data.get('location_source', False), data.get('location_destination', False), data.get('product_qty_uom', 0)], @@ -223,11 +226,11 @@ class MrpStockReport(models.TransientModel): 'model_id': data['model_id'], 'parent_id': data['parent_id'], 'type': 'line', - 'name': _(data.get('lot_id')), + 'name': _(data.get('lot_name')), 'columns': [data.get('reference_id'), data.get('product_id'), data.get('date'), - data.get('lot_id'), + data.get('lot_name'), data.get('location_source', False), data.get('location_destination', False), data.get('product_qty_uom', 0)], diff --git a/addons/stock/static/src/js/stock_traceability_report_backend.js b/addons/stock/static/src/js/stock_traceability_report_backend.js index 472bd93ff04..553c155e94a 100644 --- a/addons/stock/static/src/js/stock_traceability_report_backend.js +++ b/addons/stock/static/src/js/stock_traceability_report_backend.js @@ -24,7 +24,7 @@ var stock_report_generic = Widget.extend(ControlPanelMixin, { this.given_context.model = action.context.active_model || false; this.given_context.ttype = action.context.ttype || false; this.given_context.auto_unfold = action.context.auto_unfold || false; - this.given_context.lot_id = action.context.lot_id || false; + this.given_context.lot_name = action.context.lot_name || false; return this._super.apply(this, arguments); }, willStart: function() { @@ -42,7 +42,7 @@ var stock_report_generic = Widget.extend(ControlPanelMixin, { self.report_widget.$el.find('.o_report_heading').html('