How to update field values in Odoo 17 using a parent component using JS

165 views Asked by At

I am using Odoo 17 right now, and to update a field value in my version 16 codebase, I used this line:

if (component.props.type === "many2one") { component.props.update([]); }

I discovered that this syntax is no longer valid after migrating to Odoo 17, so if you could kindly advise me on the other way to update field values in Odoo 17?

1

There are 1 answers

0
Kenly On

The props update was removed in [REF] web, * : simplify concrete fields API - remove update prop commit

In this commit we will remove update prop from concrete fields. Now each field will directly use this.props.record.update to make changes, and handle the save in fields that need to (e.g. priority). As a consequence of this, the record props need to be mandatory.

Example:

await component.props.update(val);

Was changed to:

await component.props.record.update({ [component.props.name]: val });