[FIX] sms: save the record before opening the sms wizard

**Issue:**

- Open crm.
- Open a lead.
- Input a number in the phone field.
- Click everywhere for the input to be recognized.
- Click the sms button that appears when hovering over the phone
  field.
- BUG1: The shown dialog doesn't have the inputted phone number.
- BUG2: When closing the dialog, any changes made in the form
  before clicking the sms button are lost.

**Solution:**

Make sure the changes are saved before calling the action that
shows the wizard.

After this fix:
- The phone number input in the form is now used in the
  wizard.
- When closing the wizard, the "unsaved" changes are kept.

closes odoo/odoo#105862

Task-id: 3056454
X-original-commit: a1bc67d811cab58e6ab336c636a1b1d83fc64446
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Joseph Caburnay
2022-11-16 13:23:37 +01:00
parent 766efc97a4
commit 8b9f0ac264
@@ -10,7 +10,8 @@ export class SendSMSButton extends Component {
this.user = useService("user");
this.title = this.env._t("Send SMS Text Message");
}
onClick() {
async onClick() {
await this.props.record.save();
this.action.doAction({
type: "ir.actions.act_window",
target: "new",