[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) <xbo@odoo.com>
This commit is contained in:
Ritika Rathore
2023-12-28 09:40:09 +00:00
parent 5faa73427f
commit a089b100ea
@@ -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 });
}