Browse Source

May 20: [FIX] Bug Fixed 'whatsapp_mail_messaging'

13.0
RisvanaCybro 11 months ago
parent
commit
abca5c9b48
  1. 4
      whatsapp_mail_messaging/__manifest__.py
  2. 7
      whatsapp_mail_messaging/doc/changelog.md
  3. 2
      whatsapp_mail_messaging/model/__init__.py
  4. 4
      whatsapp_mail_messaging/model/account_move.py
  5. 32
      whatsapp_mail_messaging/model/res_company.py
  6. 33
      whatsapp_mail_messaging/model/res_config_settings.py
  7. 4
      whatsapp_mail_messaging/model/sale_order.py
  8. BIN
      whatsapp_mail_messaging/static/description/assets/screenshots/20.png
  9. 22
      whatsapp_mail_messaging/static/description/index.html
  10. 16
      whatsapp_mail_messaging/views/res_company_views.xml
  11. 31
      whatsapp_mail_messaging/views/res_config_settings_views.xml

4
whatsapp_mail_messaging/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': 'Odoo Whatsapp Connector', 'name': 'Odoo Whatsapp Connector',
'version': '13.0.1.0.0', 'version': '13.0.1.1.0',
'category': 'Extra Tools', 'category': 'Extra Tools',
'summary': """Odoo Whatsapp Connector For Sales, Invoice, and Floating button in Website""", 'summary': """Odoo Whatsapp Connector For Sales, Invoice, and Floating button in Website""",
'description': """Added options for sending Whatsapp messages and Mails in systray bar,sale order, invoices, 'description': """Added options for sending Whatsapp messages and Mails in systray bar,sale order, invoices,
@ -38,6 +38,8 @@
'views/sale_order_inherited.xml', 'views/sale_order_inherited.xml',
'views/account_move_inherited.xml', 'views/account_move_inherited.xml',
'views/website_inherited.xml', 'views/website_inherited.xml',
'views/res_company_views.xml',
'views/res_config_settings_views.xml',
'wizard/wh_message_wizard.xml', 'wizard/wh_message_wizard.xml',
'wizard/portal_share_inherited.xml', 'wizard/portal_share_inherited.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',

7
whatsapp_mail_messaging/doc/changelog.md

@ -3,8 +3,11 @@
#### 22.06.2021 #### 22.06.2021
#### Version 13.0.1.0.0 #### Version 13.0.1.0.0
#### ADD #### ADD
- Initial commit - Initial commit Odoo Whatsapp Connector
#### 20.05.2024
#### Version 13.0.1.1.0
#### UPDT
- Added whatsapp message template feature.

2
whatsapp_mail_messaging/model/__init__.py

@ -22,3 +22,5 @@
from . import website from . import website
from . import sale_order from . import sale_order
from . import account_move from . import account_move
from . import res_company
from . import res_config_settings

4
whatsapp_mail_messaging/model/account_move.py

@ -29,9 +29,11 @@ class Account(models.Model):
def action_send_whatsapp(self): def action_send_whatsapp(self):
compose_form_id = self.env.ref('whatsapp_mail_messaging.whatsapp_message_wizard_form').id compose_form_id = self.env.ref('whatsapp_mail_messaging.whatsapp_message_wizard_form').id
ctx = dict(self.env.context) ctx = dict(self.env.context)
message = "Hi" + " " + self.partner_id.name + ',' + '\n' + "Here is your invoice" + ' ' + self.name + ' ' + "amounting" + ' ' + str( 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 + ' ' + "from " + self.company_id.name + ". Please remit payment at your earliest convenience. " + '\n' + \ self.amount_total) + self.currency_id.symbol + ' ' + "from " + self.company_id.name + ". Please remit payment at your earliest convenience. " + '\n' + \
"Please use the following communication for your payment" + ' ' + self.name "Please use the following communication for your payment" + ' ' + self.name
message = message_template if message_template else default_message
ctx.update({ ctx.update({
'default_message': message, 'default_message': message,
'default_partner_id': self.partner_id.id, 'default_partner_id': self.partner_id.id,

32
whatsapp_mail_messaging/model/res_company.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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")

33
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(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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)

4
whatsapp_mail_messaging/model/sale_order.py

@ -29,8 +29,10 @@ class Sale(models.Model):
def action_send_whatsapp(self): def action_send_whatsapp(self):
compose_form_id = self.env.ref('whatsapp_mail_messaging.whatsapp_message_wizard_form').id compose_form_id = self.env.ref('whatsapp_mail_messaging.whatsapp_message_wizard_form').id
ctx = dict(self.env.context) ctx = dict(self.env.context)
message = "Hi" + " " + self.partner_id.name + ',' + '\n' + "Your quotation" + ' ' + self.name + ' ' + "amounting" + ' ' + str( 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." 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({ ctx.update({
'default_message': message, 'default_message': message,
'default_partner_id': self.partner_id.id, 'default_partner_id': self.partner_id.id,

BIN
whatsapp_mail_messaging/static/description/assets/screenshots/20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

22
whatsapp_mail_messaging/static/description/index.html

@ -247,6 +247,17 @@
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;"> style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">14</h6> <h6 style="margin-top: 0.6rem; color: #fff !important;">14</h6>
</div> </div>
<h6 class="mt-2 ml-2">Create whatsapp message template for sales orders and invoices.</h6>
</div>
<img src="assets/screenshots/20.png" width="100%" class="img-resposive"
style="border-radius: 10px !important;">
</div>
<div class="col-lg-12" style="background-color: #ffffff !important; padding: 4rem 3rem;">
<div class="d-flex my-3">
<div class="d-flex justify-content-center align-items-center"
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">15</h6>
</div>
<h6 class="mt-2 ml-2">In the website form view we can define the number along with country code required for communicating with the <h6 class="mt-2 ml-2">In the website form view we can define the number along with country code required for communicating with the
website responsible.</h6> website responsible.</h6>
</div> </div>
@ -257,7 +268,7 @@
<div class="d-flex my-3"> <div class="d-flex my-3">
<div class="d-flex justify-content-center align-items-center" <div class="d-flex justify-content-center align-items-center"
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;"> style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">15</h6> <h6 style="margin-top: 0.6rem; color: #fff !important;">16</h6>
</div> </div>
<h6 class="mt-2 ml-2">There will be a whatsapp icon present in the website.</h6> <h6 class="mt-2 ml-2">There will be a whatsapp icon present in the website.</h6>
</div> </div>
@ -268,7 +279,7 @@
<div class="d-flex my-3"> <div class="d-flex my-3">
<div class="d-flex justify-content-center align-items-center" <div class="d-flex justify-content-center align-items-center"
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;"> style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">16</h6> <h6 style="margin-top: 0.6rem; color: #fff !important;">17</h6>
</div> </div>
<h6 class="mt-2 ml-2">By clicking on the whatsapp floating icon it will redirect to whatsapp web with the recipient as the number specified in corresponding website</h6> <h6 class="mt-2 ml-2">By clicking on the whatsapp floating icon it will redirect to whatsapp web with the recipient as the number specified in corresponding website</h6>
</div> </div>
@ -279,7 +290,7 @@
<div class="d-flex my-3"> <div class="d-flex my-3">
<div class="d-flex justify-content-center align-items-center" <div class="d-flex justify-content-center align-items-center"
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;"> style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">17</h6> <h6 style="margin-top: 0.6rem; color: #fff !important;">18</h6>
</div> </div>
<h6 class="mt-2 ml-2">We will have a share menu in documents like sales order, invoices, purchase etc..</h6> <h6 class="mt-2 ml-2">We will have a share menu in documents like sales order, invoices, purchase etc..</h6>
</div> </div>
@ -290,7 +301,7 @@
<div class="d-flex my-3"> <div class="d-flex my-3">
<div class="d-flex justify-content-center align-items-center" <div class="d-flex justify-content-center align-items-center"
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;"> style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">18</h6> <h6 style="margin-top: 0.6rem; color: #fff !important;">19</h6>
</div> </div>
<h6 class="mt-2 ml-2">By clicking on that there will be an additional option 'Whatsapp" in the popup screen where we can add the customer <h6 class="mt-2 ml-2">By clicking on that there will be an additional option 'Whatsapp" in the popup screen where we can add the customer
and additional contents if we need.</h6> and additional contents if we need.</h6>
@ -302,7 +313,7 @@
<div class="d-flex my-3"> <div class="d-flex my-3">
<div class="d-flex justify-content-center align-items-center" <div class="d-flex justify-content-center align-items-center"
style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;"> style="background-color: #3498DB !important; border: 4px solid #d6eaf8 !important; box-shadow: 0px 0px 0px 4px #ebf5fb !important; color: #fff !important; height: 35px; width: 35px; border-radius: 50% !important; font-size: 1.1rem !important;">
<h6 style="margin-top: 0.6rem; color: #fff !important;">19</h6> <h6 style="margin-top: 0.6rem; color: #fff !important;">20</h6>
</div> </div>
<h6 class="mt-2 ml-2">After click on send first it will redirected to then whatsapp web and then to corresponding contact in our whatsapp <h6 class="mt-2 ml-2">After click on send first it will redirected to then whatsapp web and then to corresponding contact in our whatsapp
along with the custom message and link for accessing the document.</h6> along with the custom message and link for accessing the document.</h6>
@ -310,7 +321,6 @@
<img src="assets/screenshots/whatsapp_mail_messaging_19.png" width="100%" class="img-resposive" <img src="assets/screenshots/whatsapp_mail_messaging_19.png" width="100%" class="img-resposive"
style="border-radius: 10px !important;"> style="border-radius: 10px !important;">
</div> </div>
</div> </div>
</section> </section>
<!-- END OF SCREENSHOTS SECTION --> <!-- END OF SCREENSHOTS SECTION -->

16
whatsapp_mail_messaging/views/res_company_views.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="res_company_view_form" model="ir.ui.view">
<field name="name">
res.company.view.form.inherit.whatsapp.mail.messaging
</field>
<field name="model">res.company</field>
<field name="inherit_id"
ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='country_id']" position="after">
<field name="whatsapp_message" invisible="1"/>
</xpath>
</field>
</record>
</odoo>

31
whatsapp_mail_messaging/views/res_config_settings_views.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">
res.config.settings.view.form.inherit.whatsapp.mail.messaging
</field>
<field name="model">res.config.settings</field>
<field name="inherit_id"
ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='integration']" position="after">
<h2>Whatsapp</h2>
<div class="row mt16 o_settings_container" name="whatsapp_message">
<div class="col-12 col-lg-6 o_setting_box" id="whatsapp_message_tempalte">
<label for="whatsapp_message"/>
<field name="whatsapp_message" placeholder="Message..."/>
<div class="text-muted">
This WhatsApp message template is for sales orders and invoices.
</div>
</div>
</div>
<!-- <block title="Whatsapp" id="whatsapp_message">-->
<!-- <setting-->
<!-- help="This WhatsApp message template is for sales orders and invoices.">-->
<!-- <field name="whatsapp_message" placeholder="Message..." widget="text_emojis"/>-->
<!-- </setting>-->
<!-- </block>-->
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save