From c8de9596177fbe23e1abbf1f8471b61a7b076846 Mon Sep 17 00:00:00 2001 From: "Simon Genin (ges)" Date: Tue, 23 Aug 2022 09:15:22 +0000 Subject: [PATCH] [FIX] sms: fix sms button in phone field The sms field extension had been badly converted. The button didn't do anything cause the action wasn't properly configured. closes odoo/odoo#98646 Signed-off-by: Aaron Bohy (aab) --- .../src/components/phone_field/phone_field.xml | 2 +- .../src/components/sms_button/sms_button.js | 17 ++++++++++++++--- .../src/components/sms_button/sms_button.xml | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/addons/sms/static/src/components/phone_field/phone_field.xml b/addons/sms/static/src/components/phone_field/phone_field.xml index 337648d5d23..e73c030b467 100644 --- a/addons/sms/static/src/components/phone_field/phone_field.xml +++ b/addons/sms/static/src/components/phone_field/phone_field.xml @@ -4,7 +4,7 @@ - + diff --git a/addons/sms/static/src/components/sms_button/sms_button.js b/addons/sms/static/src/components/sms_button/sms_button.js index 7165e9bbf4f..b99790dfea8 100644 --- a/addons/sms/static/src/components/sms_button/sms_button.js +++ b/addons/sms/static/src/components/sms_button/sms_button.js @@ -7,16 +7,27 @@ const { Component } = owl; export class SendSMSButton extends Component { setup() { this.action = useService("action"); + this.user = useService("user"); this.title = this.env._t("Send SMS Text Message"); } onClick() { this.action.doAction({ type: "ir.actions.act_window", - name: this.title, - res_id: this.props.record.resId, - res_model: "sms.composer", target: "new", + name: this.title, + res_model: "sms.composer", views: [[false, "form"]], + context: { + ...this.user.context, + default_res_model: this.props.record.resModel, + default_res_id: this.props.record.resId, + default_number_field_name: this.props.name, + default_composition_mode: 'comment', + } + }, { + onClose: () => { + this.props.record.model.load() + }, }); } }; diff --git a/addons/sms/static/src/components/sms_button/sms_button.xml b/addons/sms/static/src/components/sms_button/sms_button.xml index 9a95c863990..2b37bdceac9 100644 --- a/addons/sms/static/src/components/sms_button/sms_button.xml +++ b/addons/sms/static/src/components/sms_button/sms_button.xml @@ -5,7 +5,7 @@ SMS