[FIX] sms: improper reload of form view after sms wizard on new record

**Issue:**

- Install crm (to have a form view with phone field).
- Click crm icon.
- Open list view.
- Create a new record.
- Enter title and phone number.
- Click sms button from the right of phone number field.
- On the wizard (dialog), enter a message and send.
- The wizard is closed but (BUG) the form view returns to the state where
  a new record is being created.

**Solution:**

The record containing the new sms message is properly created, however
the form view is reloaded with undefined `resId`, thus the form reloaded
as if it is "new".

The simplest fix is to specify the `resId` of the newly created record in
the `model.load` call as proposed in this commit.

closes odoo/odoo#108431

X-original-commit: edaf37eeb9244976ecc6c60aec089f9a2b4e3020
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Joseph Caburnay
2022-12-21 13:34:00 +01:00
parent c3f865e1dd
commit 8da3b25b2e
@@ -27,7 +27,7 @@ export class SendSMSButton extends Component {
}
}, {
onClose: () => {
this.props.record.model.load()
this.props.record.model.load({ resId: this.props.record.resId });
},
});
}