From a089b100ea5e43a161409dcb42dcce4f5479f467 Mon Sep 17 00:00:00 2001 From: Ritika Rathore Date: Mon, 18 Dec 2023 18:13:46 +0530 Subject: [PATCH] [FIX] sale_timesheet: fix traceback while set empty in timesheet notebook Steps to reproduce: ------------------------- - Install project and sale_timesheet module - Open the Project module - Go to task's timesheet notebook - Add a new line - Set empty in so_line field, raises traceback Issue: -------- - In timesheet notebook, when we set so_line as an empty .it will raises traceback. Cause: --------- - #145821 when set empty so_line field there is undefined value read. Fix: ------- - On a field change, compare the so_line field value with proper record id check with new value. task-3642371 closes odoo/odoo#147546 X-original-commit: ed2417225975001dd7b6ec1d3655fe880fe2c108 Signed-off-by: Xavier Bol (xbo) --- .../static/src/components/so_line_field/so_line_field.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/static/src/components/so_line_field/so_line_field.js b/addons/sale_timesheet/static/src/components/so_line_field/so_line_field.js index 01f6d41cde5..f780d466eda 100644 --- a/addons/sale_timesheet/static/src/components/so_line_field/so_line_field.js +++ b/addons/sale_timesheet/static/src/components/so_line_field/so_line_field.js @@ -13,7 +13,7 @@ export class SoLineField extends Many2OneField { update(value, params); if ( // field is unset AND the old & new so_lines are different !this.props.record.data.is_so_line_edited && - this.props.value[0] != (value[0] && value[0].id) + this.value[0] != value[0]?.id ) { this.props.record.update({ is_so_line_edited: true }); }