[FIX] mail: update and re-render the activity view

Before this commit: when props change, the internal state of the widget not
updated for the activity view. So it creating many issues:
    - The count of the progress bar doesn't go to update while scheduling
      the activity of the same type.
    - Date displayed on cell not getting updated while changing the
      due date by clicking on the cell.

This commit will update legacy widget from owl component, one need to override
renderWidget and updateWidget instead of render and update method as this has
been changed from commit https://github.com/odoo/odoo/commit/f2de55322e4d417815e6757517163dd0cff544cc

After this commit: the acivity view will be updated based on activity changes

Task-2238551
PR https://github.com/odoo/odoo/pull/54734

X-original-commit: 02c7d121935ab1b26d896e31eb0c90bf2b7abff8
This commit is contained in:
Hiral Bhavsar
2020-07-22 10:40:13 +00:00
parent b3c8287dc5
commit d8284d84bc
@@ -21,12 +21,12 @@ const { useState } = owl.hooks;
* TODO: Remove this adapter when ActivityRecord is a Component
*/
class ActivityRecordAdapter extends ComponentAdapter {
render() {
renderWidget() {
_.invoke(_.pluck(this.widget.subWidgets, '$el'), 'detach');
this.widget._render();
}
update(nextProps) {
updateWidget(nextProps) {
const state = nextProps.widgetArgs[0];
this.widget._setState(state);
}
@@ -37,11 +37,11 @@ class ActivityRecordAdapter extends ComponentAdapter {
* TODO: Remove this adapter when ActivityCell is a Component
*/
class ActivityCellAdapter extends ComponentAdapter {
render() {
renderWidget() {
this.widget._render();
}
update(nextProps) {
updateWidget(nextProps) {
const record = nextProps.widgetArgs[1];
this.widget._reset(record);
}
@@ -52,11 +52,11 @@ class ActivityCellAdapter extends ComponentAdapter {
* TODO: Remove this adapter when KanbanColumnProgressBar is a Component
*/
class KanbanColumnProgressBarAdapter extends ComponentAdapter {
render() {
renderWidget() {
this.widget._render();
}
update(nextProps) {
updateWidget(nextProps) {
const options = nextProps.widgetArgs[0];
const columnState = nextProps.widgetArgs[1];