diff --git a/whatsapp_mail_messaging/__manifest__.py b/whatsapp_mail_messaging/__manifest__.py index 09974f4d2..5a4a4458f 100644 --- a/whatsapp_mail_messaging/__manifest__.py +++ b/whatsapp_mail_messaging/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Odoo Whatsapp Connector', - 'version': '17.0.1.0.0', + 'version': '17.0.1.1.0', 'category': 'Extra Tools', 'summary': """Whatsapp Odoo Integration, Odoo Whatsapp Connector, Odoo Whatsapp, Whatsapp Connector, Whatsapp Integration, Odoo17, Whatsapp, Odoo Apps""", 'description': """Added options for sending Whatsapp messages and emails in @@ -40,6 +40,7 @@ 'views/account_move_views.xml', 'views/website_views.xml', 'views/selection_message_views.xml', + 'views/res_config_settings_views.xml', 'wizard/whatsapp_send_message_views.xml', 'wizard/portal_share_views.xml', ], diff --git a/whatsapp_mail_messaging/model/__init__.py b/whatsapp_mail_messaging/model/__init__.py index aec83d75a..8b38b8d7c 100644 --- a/whatsapp_mail_messaging/model/__init__.py +++ b/whatsapp_mail_messaging/model/__init__.py @@ -23,3 +23,5 @@ from . import account_move from . import sale_order from . import selection_message from . import website +from . import res_config_settings +from . import res_company diff --git a/whatsapp_mail_messaging/model/account_move.py b/whatsapp_mail_messaging/model/account_move.py index 994184d0f..4476a8a9a 100644 --- a/whatsapp_mail_messaging/model/account_move.py +++ b/whatsapp_mail_messaging/model/account_move.py @@ -36,7 +36,8 @@ class AccountMove(models.Model): compose_form_id = self.env.ref( 'whatsapp_mail_messaging.whatsapp_send_message_view_form').id ctx = dict(self.env.context) - message = ( + message_template = self.company_id.whatsapp_message + default_message = ( "Hi" + " " + self.partner_id.name + ',' + '\n' + "Here is your invoice" + ' ' + self.name + ' ' + "amounting" + ' ' + str(self.amount_total) + self.currency_id.symbol + ' ' + @@ -44,6 +45,7 @@ class AccountMove(models.Model): ". Please remit payment at your earliest convenience. " + '\n' + "Please use the following communication for your payment" + ' ' + self.name) + message = message_template if message_template else default_message ctx.update({ 'default_message': message, 'default_partner_id': self.partner_id.id, diff --git a/whatsapp_mail_messaging/model/res_company.py b/whatsapp_mail_messaging/model/res_company.py new file mode 100644 index 000000000..98c2440f2 --- /dev/null +++ b/whatsapp_mail_messaging/model/res_company.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class ResCompany(models.Model): + """ + Extends the 'res.company' model to include WhatsApp message template. + """ + _inherit = 'res.company' + + whatsapp_message = fields.Text(string="Message Template", + help="whatsapp message template") diff --git a/whatsapp_mail_messaging/model/res_config_settings.py b/whatsapp_mail_messaging/model/res_config_settings.py new file mode 100644 index 000000000..04411c5d8 --- /dev/null +++ b/whatsapp_mail_messaging/model/res_config_settings.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """ + Extends the 'res.config.settings' model to include additional configuration settings. + """ + _inherit = 'res.config.settings' + + whatsapp_message = fields.Text(string="Message Template", + related='company_id.whatsapp_message', + readonly=False) diff --git a/whatsapp_mail_messaging/model/sale_order.py b/whatsapp_mail_messaging/model/sale_order.py index d338c9817..e343fe37c 100644 --- a/whatsapp_mail_messaging/model/sale_order.py +++ b/whatsapp_mail_messaging/model/sale_order.py @@ -36,11 +36,13 @@ class SaleOrder(models.Model): compose_form_id = self.env.ref( 'whatsapp_mail_messaging.whatsapp_send_message_view_form').id ctx = dict(self.env.context) - message = ("Hi" + " " + self.partner_id.name + ',' + '\n' + + message_template = self.company_id.whatsapp_message + default_message = ("Hi" + " " + self.partner_id.name + ',' + '\n' + "Your quotation" + ' ' + self.name + ' ' + "amounting" + ' ' + str(self.amount_total) + self.currency_id.symbol + ' ' + "is ready for review.Do not hesitate to contact us if you " "have any questions.") + message = message_template if message_template else default_message ctx.update({ 'default_message': message, 'default_partner_id': self.partner_id.id, diff --git a/whatsapp_mail_messaging/static/description/assets/screenshots/26.png b/whatsapp_mail_messaging/static/description/assets/screenshots/26.png new file mode 100644 index 000000000..d120c0a48 Binary files /dev/null and b/whatsapp_mail_messaging/static/description/assets/screenshots/26.png differ diff --git a/whatsapp_mail_messaging/static/description/index.html b/whatsapp_mail_messaging/static/description/index.html index 9b63c0039..b29f64b2e 100644 --- a/whatsapp_mail_messaging/static/description/index.html +++ b/whatsapp_mail_messaging/static/description/index.html @@ -296,6 +296,22 @@ +
+
+
+ +
+
+

+ WhatsApp Message Template.

+

+ Create whatsapp message template for sales orders and invoices. +

+
+
+
diff --git a/whatsapp_mail_messaging/views/res_company_views.xml b/whatsapp_mail_messaging/views/res_company_views.xml new file mode 100644 index 000000000..81e741fa1 --- /dev/null +++ b/whatsapp_mail_messaging/views/res_company_views.xml @@ -0,0 +1,16 @@ + + + + + res.company.view.form.inherit.whatsapp.mail.messaging + + res.company + + + + + + + + \ No newline at end of file diff --git a/whatsapp_mail_messaging/views/res_config_settings_views.xml b/whatsapp_mail_messaging/views/res_config_settings_views.xml new file mode 100644 index 000000000..82fcf918c --- /dev/null +++ b/whatsapp_mail_messaging/views/res_config_settings_views.xml @@ -0,0 +1,21 @@ + + + + + res.config.settings.view.form.inherit.whatsapp.mail.messaging + + res.config.settings + + + + + + + + + + + +