[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
This commit is contained in:
William Henrotin
2023-09-27 09:11:48 +00:00
parent 120d69ef4c
commit a366ccdf3d
@@ -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 "";
}
}