[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) <aab@odoo.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<t t-inherit="web.PhoneField" t-inherit-mode="extension">
|
||||
<xpath expr="//*[hasclass('o_phone_link')]" position="after">
|
||||
<t t-if="props.value.length > 0">
|
||||
<SendSMSButton record="props.record" value="props.value"/>
|
||||
<SendSMSButton t-props="props" />
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<a
|
||||
t-att-title="title"
|
||||
t-att-href="'sms:'+props.value"
|
||||
t-on-click.prevent="onClick"
|
||||
t-on-click.prevent.stop="onClick"
|
||||
class="ms-3 d-inline-flex align-items-center o_field_phone_sms"
|
||||
><i class="fa fa-mobile"></i><small class="fw-bold ms-1">SMS</small></a>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user