[REF] *: adapt codebase to new RelationalModel

This commit adapts the code in addons w.r.t. the introduction of
the RelationalModel.

Main changes that were requested are:
 - record datapoints no longer always have an "id" key in their
 data (they still do if the id field is in the view), so we use
 record.resId instead
 - the new model is based on fined-grained reactivity, so several
 components that previously relied on onWillUpdateProps to update
 their internal state no longer worked. Typically, using the hook
 "observeRecord" is the way to go now.
 - specialdata are no longer handled in the model, so the components
 needing specialData can use the hook "useSpecialData"
 - more generally, all overrides of models (RelationalModel or
 KanbanModel) needed to be reworked.

Part of task~3179751

Part-of: odoo/odoo#114024
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: FrancoisGe <fge@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Pierre Rousseau <pro@odoo.com>
This commit is contained in:
Aaron Bohy
2023-07-24 20:17:50 +02:00
co-authored by FrancoisGe Jorge Pinna Puissant Pierre Rousseau
parent 8723f020c3
commit 218ad8456a
90 changed files with 584 additions and 792 deletions
@@ -55,7 +55,7 @@ export class HrOrgChart extends Component {
async handleComponentUpdate() {
this.employee = this.props.record.data;
// the widget is either dispayed in the context of a hr.employee form or a res.users form
this.state.employee_id = this.employee.employee_ids !== undefined ? this.employee.employee_ids.resIds[0] : this.employee.id;
this.state.employee_id = this.employee.employee_ids !== undefined ? this.employee.employee_ids.resIds[0] : this.props.record.resId;
const manager = this.employee.parent_id || this.employee.employee_parent_id;
const forceReload = this.lastRecord !== this.props.record || this.lastParent != manager;
this.lastParent = manager;