Browse Source

May 20: [FIX] Bug Fixed 'whatsapp_mail_messaging'

pull/317/head
RisvanaCybro 11 months ago
parent
commit
687d900b2f
  1. 3
      whatsapp_mail_messaging/__manifest__.py
  2. 2
      whatsapp_mail_messaging/model/__init__.py
  3. 4
      whatsapp_mail_messaging/model/account_move.py
  4. 32
      whatsapp_mail_messaging/model/res_company.py
  5. 33
      whatsapp_mail_messaging/model/res_config_settings.py
  6. 4
      whatsapp_mail_messaging/model/sale_order.py
  7. BIN
      whatsapp_mail_messaging/static/description/assets/screenshots/26.png
  8. 16
      whatsapp_mail_messaging/static/description/index.html
  9. 16
      whatsapp_mail_messaging/views/res_company_views.xml
  10. 21
      whatsapp_mail_messaging/views/res_config_settings_views.xml

3
whatsapp_mail_messaging/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': 'Odoo Whatsapp Connector', 'name': 'Odoo Whatsapp Connector',
'version': '17.0.1.0.0', 'version': '17.0.1.1.0',
'category': 'Extra Tools', 'category': 'Extra Tools',
'summary': """Whatsapp Odoo Integration, Odoo Whatsapp Connector, Odoo Whatsapp, Whatsapp Connector, Whatsapp Integration, Odoo17, Whatsapp, Odoo Apps""", '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 'description': """Added options for sending Whatsapp messages and emails in
@ -40,6 +40,7 @@
'views/account_move_views.xml', 'views/account_move_views.xml',
'views/website_views.xml', 'views/website_views.xml',
'views/selection_message_views.xml', 'views/selection_message_views.xml',
'views/res_config_settings_views.xml',
'wizard/whatsapp_send_message_views.xml', 'wizard/whatsapp_send_message_views.xml',
'wizard/portal_share_views.xml', 'wizard/portal_share_views.xml',
], ],

2
whatsapp_mail_messaging/model/__init__.py

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

4
whatsapp_mail_messaging/model/account_move.py

@ -36,7 +36,8 @@ class AccountMove(models.Model):
compose_form_id = self.env.ref( compose_form_id = self.env.ref(
'whatsapp_mail_messaging.whatsapp_send_message_view_form').id 'whatsapp_mail_messaging.whatsapp_send_message_view_form').id
ctx = dict(self.env.context) ctx = dict(self.env.context)
message = ( message_template = self.company_id.whatsapp_message
default_message = (
"Hi" + " " + self.partner_id.name + ',' + '\n' + "Hi" + " " + self.partner_id.name + ',' + '\n' +
"Here is your invoice" + ' ' + self.name + ' ' + "amounting" + "Here is your invoice" + ' ' + self.name + ' ' + "amounting" +
' ' + str(self.amount_total) + self.currency_id.symbol + ' ' + ' ' + 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 remit payment at your earliest convenience. " + '\n'
+ "Please use the following communication for your payment" + + "Please use the following communication for your payment" +
' ' + self.name) ' ' + 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: 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 <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: 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 <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

@ -36,11 +36,13 @@ class SaleOrder(models.Model):
compose_form_id = self.env.ref( compose_form_id = self.env.ref(
'whatsapp_mail_messaging.whatsapp_send_message_view_form').id 'whatsapp_mail_messaging.whatsapp_send_message_view_form').id
ctx = dict(self.env.context) 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" + ' ' "Your quotation" + ' ' + self.name + ' ' + "amounting" + ' '
+ str(self.amount_total) + self.currency_id.symbol + ' ' + + str(self.amount_total) + self.currency_id.symbol + ' ' +
"is ready for review.Do not hesitate to contact us if you " "is ready for review.Do not hesitate to contact us if you "
"have any questions.") "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/26.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

16
whatsapp_mail_messaging/static/description/index.html

@ -296,6 +296,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/26.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
WhatsApp Message Template.</h4>
<p class="m-0" style="color:#718096">
Create whatsapp message template for sales orders and invoices.
</p>
</div>
</div>
</div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;"> <div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div <div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">

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>

21
whatsapp_mail_messaging/views/res_config_settings_views.xml

@ -0,0 +1,21 @@
<?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="//block[@id='pwa_settings']" position="after">
<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