From a366ccdf3d3f797c4354d3bb9ddbd0fff60a192c Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Wed, 20 Sep 2023 17:20:28 +0200 Subject: [PATCH] [FIX] stock: do not restrict name to saved record The 'pick from' display name would give a name to the dummy quant only in case of existing stock move line. It's an issue in case of delivery with the use_create_lot setting as we could generate serial number on the fly and thus showing a quant on virtual move line Part-of: odoo/odoo#136067 --- .../static/src/widgets/stock_pick_from.js | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/stock/static/src/widgets/stock_pick_from.js b/addons/stock/static/src/widgets/stock_pick_from.js index 882cd9adc53..a5ff50011a0 100644 --- a/addons/stock/static/src/widgets/stock_pick_from.js +++ b/addons/stock/static/src/widgets/stock_pick_from.js @@ -15,22 +15,20 @@ export class StockPickFrom extends Many2OneField { _quant_display_name() { let name_parts = []; - if (this.props.record.resId) { - // if location group is activated - const data = this.props.record.data; - name_parts.push(data.location_id?.[1]) - if (data.lot_id) { - name_parts.push(data.lot_id?.[1] || data.lot_name) - } - if (data.package_id) { - name_parts.push(data.package_id?.[1]) - } - if (data.owner) { - name_parts.push(data.owner?.[1]) - } - const result = name_parts.join(" - "); - if (result) return result; + // if location group is activated + const data = this.props.record.data; + name_parts.push(data.location_id?.[1]) + if (data.lot_id) { + name_parts.push(data.lot_id?.[1] || data.lot_name) } + if (data.package_id) { + name_parts.push(data.package_id?.[1]) + } + if (data.owner) { + name_parts.push(data.owner?.[1]) + } + const result = name_parts.join(" - "); + if (result) return result; return ""; } }