From 62f7de632aa7574ccb8daa37f44219156b8545f7 Mon Sep 17 00:00:00 2001 From: "Daniel Kosky (dako)" Date: Wed, 28 Feb 2024 13:21:12 +0100 Subject: [PATCH] [FIX] account: actionable errors widget state The widget for actionable errors does not update when the errors it displays are updated due to, for example, a recomputation of the field. This results in irrelevant errors being displayed in the view, when a particular configuration is correct. The correct errors (or an absence of any errors) will not be displayed until the view is refreshed. This commit adapts the component, such that the record data is accessed directly from the template. This means that the recordObserver, and the method it uses can be removed (as they were redundant) closes odoo/odoo#155914 Task-id: None Signed-off-by: Habib Ayob (ayh) --- .../components/actionable_errors/actionable_errors.js | 10 ---------- .../components/actionable_errors/actionable_errors.xml | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/addons/account/static/src/components/actionable_errors/actionable_errors.js b/addons/account/static/src/components/actionable_errors/actionable_errors.js index 87db1d567fe..5eaa6b741d9 100644 --- a/addons/account/static/src/components/actionable_errors/actionable_errors.js +++ b/addons/account/static/src/components/actionable_errors/actionable_errors.js @@ -3,21 +3,11 @@ import { registry } from "@web/core/registry"; import { Component } from "@odoo/owl"; import { standardFieldProps } from "@web/views/fields/standard_field_props"; -import { useRecordObserver } from "@web/model/relational_model/utils"; export class ActionableErrors extends Component { static props = { ...standardFieldProps }; static template = "account.ActionableErrors"; - setup() { - useRecordObserver(this.formatData.bind(this)); - } - - formatData(record) { - const errorsField = record.data[this.props.name]; - this.errorsData = JSON.parse(JSON.stringify(errorsField)); - } - async handleOnClick(errorData){ this.env.model.action.doAction(errorData.action); } diff --git a/addons/account/static/src/components/actionable_errors/actionable_errors.xml b/addons/account/static/src/components/actionable_errors/actionable_errors.xml index 14d619208e7..3877538c639 100644 --- a/addons/account/static/src/components/actionable_errors/actionable_errors.xml +++ b/addons/account/static/src/components/actionable_errors/actionable_errors.xml @@ -1,9 +1,9 @@ - +