diff --git a/addons/sms/__manifest__.py b/addons/sms/__manifest__.py index fc445d503da..fb02637a072 100644 --- a/addons/sms/__manifest__.py +++ b/addons/sms/__manifest__.py @@ -44,10 +44,12 @@ The service is provided by the In App Purchase Odoo platform. ], 'mail.assets_discuss_public': [ 'sms/static/src/components/*/*', + ('remove', 'sms/static/src/components/phone_field/*'), ], 'web.assets_backend': [ 'sms/static/src/js/fields_phone_widget.js', 'sms/static/src/js/fields_sms_widget.js', + 'sms/static/src/components/*/*', ], 'web.qunit_suite_tests': [ 'sms/static/tests/sms_widget_test.js', diff --git a/addons/sms/static/src/components/phone_field/phone_field.js b/addons/sms/static/src/components/phone_field/phone_field.js new file mode 100644 index 00000000000..677a335b0c9 --- /dev/null +++ b/addons/sms/static/src/components/phone_field/phone_field.js @@ -0,0 +1,12 @@ +/** @odoo-module **/ + +import { patch } from "@web/core/utils/patch"; +import { PhoneField } from "@web/views/fields/phone/phone_field"; +import { SendSMSButton } from '@sms/components/sms_button/sms_button'; + +patch(PhoneField, "sms.PhoneField", { + components: { + ...PhoneField.components, + SendSMSButton + }, +}); diff --git a/addons/sms/static/src/components/phone_field/phone_field.xml b/addons/sms/static/src/components/phone_field/phone_field.xml new file mode 100644 index 00000000000..337648d5d23 --- /dev/null +++ b/addons/sms/static/src/components/phone_field/phone_field.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/addons/sms/static/src/components/sms_button/sms_button.js b/addons/sms/static/src/components/sms_button/sms_button.js new file mode 100644 index 00000000000..7165e9bbf4f --- /dev/null +++ b/addons/sms/static/src/components/sms_button/sms_button.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ + +import { useService } from "@web/core/utils/hooks"; + +const { Component } = owl; + +export class SendSMSButton extends Component { + setup() { + this.action = useService("action"); + 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", + views: [[false, "form"]], + }); + } +}; +SendSMSButton.template = "sms.SendSMSButton"; diff --git a/addons/sms/static/src/components/sms_button/sms_button.xml b/addons/sms/static/src/components/sms_button/sms_button.xml new file mode 100644 index 00000000000..bb1aab2381e --- /dev/null +++ b/addons/sms/static/src/components/sms_button/sms_button.xml @@ -0,0 +1,13 @@ + + + + + SMS + + +