@ -0,0 +1,52 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Odoo Whatsapp Connector |
||||
|
======================= |
||||
|
Odoo Whatsapp connector for Sales, Invoice, and a floating button on the Website, along with icons for Whatsapp and email in the systray bar. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Lesser General Public License, Version 3 (LGPL v3) |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V13) Nishad@cybrosys, |
||||
|
(V14) Sayooj A O, |
||||
|
(V15) Midilaj V K, |
||||
|
(V16) Pranav T V, |
||||
|
(V17) Aysha Shalin |
||||
|
(V18) Sreerag PM |
||||
|
Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 . import controllers |
||||
|
from . import model |
||||
|
from . import wizard |
@ -0,0 +1,68 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'Odoo Whatsapp Connector', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Extra Tools', |
||||
|
'summary': """Odoo18 Whatsapp, Whatsapp Odoo Integration, Odoo Whatsapp Connector, |
||||
|
Odoo Whatsapp, Whatsapp Connector, Whatsapp Integration, Odoo18, Whatsapp, |
||||
|
Odoo Apps""", |
||||
|
'description': """Added options for sending Whatsapp messages and emails in |
||||
|
the systray bar, sale order, invoices, website portal view and ability to |
||||
|
share access URLs for documents through the share option available in each |
||||
|
record using WhatsApp Web.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['sale', 'account', 'website', 'sale_management'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/website_templates.xml', |
||||
|
'views/sale_order_views.xml', |
||||
|
'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', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_backend': [ |
||||
|
"whatsapp_mail_messaging/static/src/css/icons.css", |
||||
|
"whatsapp_mail_messaging/static/src/js/whatsapp_icon.js", |
||||
|
"whatsapp_mail_messaging/static/src/js/mail_icon.js", |
||||
|
'whatsapp_mail_messaging/static/src/xml/whatsapp_icon_template.xml', |
||||
|
'whatsapp_mail_messaging/static/src/xml/mail_icon_template.xml', |
||||
|
], |
||||
|
'web.assets_frontend': [ |
||||
|
"whatsapp_mail_messaging/static/src/css/whatsapp_icon_website.css", |
||||
|
"whatsapp_mail_messaging/static/src/js/whatsapp_web_icon.js", |
||||
|
"whatsapp_mail_messaging/static/src/js/whatsapp_modal.js", |
||||
|
], |
||||
|
}, |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 . import whatsapp_mail_messaging |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 http |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class SendMessage(http.Controller): |
||||
|
""" Controller for whatsapp message templates """ |
||||
|
@http.route('/whatsapp_message', type='json', auth='public') |
||||
|
def whatsapp_message(self, **kwargs): |
||||
|
""" Whatsapp message templates """ |
||||
|
messages = request.env['selection.message'].sudo().search_read( |
||||
|
fields=['name', 'message']) |
||||
|
return {'messages': messages} |
||||
|
|
||||
|
@http.route('/mobile_number', type='json', auth='public') |
||||
|
def mobile_number(self, **kwargs): |
||||
|
""" Mobile number of website """ |
||||
|
mobile_number = request.env['website'].sudo().search_read( |
||||
|
fields=['mobile_number'] |
||||
|
) |
||||
|
return {'mobile': mobile_number} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <whatsapp_mail_messaging> |
||||
|
|
||||
|
#### 30.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Odoo Whatsapp Connector |
@ -0,0 +1,27 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 . import account_move |
||||
|
from . import res_company |
||||
|
from . import res_config_settings |
||||
|
from . import sale_order |
||||
|
from . import selection_message |
||||
|
from . import website |
@ -0,0 +1,109 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 itertools import groupby |
||||
|
from odoo import models, _ |
||||
|
from odoo.exceptions import UserError |
||||
|
|
||||
|
|
||||
|
class AccountMove(models.Model): |
||||
|
""" |
||||
|
This class extends the 'account.move' model to add custom functionalities |
||||
|
related to WhatsApp messaging. |
||||
|
""" |
||||
|
_inherit = 'account.move' |
||||
|
|
||||
|
def action_send_whatsapp(self): |
||||
|
""" Action for sending whatsapp message.""" |
||||
|
compose_form_id = self.env.ref( |
||||
|
'whatsapp_mail_messaging.whatsapp_send_message_view_form').id |
||||
|
ctx = dict(self.env.context) |
||||
|
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' |
||||
|
+ "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, |
||||
|
'default_mobile': self.partner_id.mobile, |
||||
|
'default_image_1920': self.partner_id.image_1920, |
||||
|
}) |
||||
|
return { |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'whatsapp.send.message', |
||||
|
'views': [(compose_form_id, 'form')], |
||||
|
'view_id': compose_form_id, |
||||
|
'target': 'new', |
||||
|
'context': ctx, |
||||
|
} |
||||
|
|
||||
|
def check_customers(self, partner_ids): |
||||
|
""" Check if the selected invoices belong to the same customer.""" |
||||
|
partners = groupby(partner_ids) |
||||
|
return next(partners, True) and not next(partners, False) |
||||
|
|
||||
|
def action_whatsapp_multi(self): |
||||
|
""" |
||||
|
Initiate WhatsApp messaging for multiple invoices and open a message |
||||
|
composition wizard. |
||||
|
""" |
||||
|
account_move_ids = self.env['account.move'].browse( |
||||
|
self.env.context.get('active_ids')) |
||||
|
partner_ids = [] |
||||
|
for account_move in account_move_ids: |
||||
|
partner_ids.append(account_move.partner_id.id) |
||||
|
partner_check = self.check_customers(partner_ids) |
||||
|
if partner_check: |
||||
|
account_move_numbers = account_move_ids.mapped('name') |
||||
|
account_move_numbers = "\n".join(account_move_numbers) |
||||
|
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' + |
||||
|
"Your Orders are" + '\n' + account_move_numbers + ' ' + |
||||
|
"is ready for review.Do not hesitate to contact us if " |
||||
|
"you have any questions.") |
||||
|
ctx.update({ |
||||
|
'default_message': message, |
||||
|
'default_partner_id': account_move_ids[0].partner_id.id, |
||||
|
'default_mobile': account_move_ids[0].partner_id.mobile, |
||||
|
'default_image_1920': account_move_ids[0].partner_id.image_1920, |
||||
|
}) |
||||
|
return { |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'whatsapp.send.message', |
||||
|
'views': [(compose_form_id, 'form')], |
||||
|
'view_id': compose_form_id, |
||||
|
'target': 'new', |
||||
|
'context': ctx, |
||||
|
} |
||||
|
else: |
||||
|
raise UserError(_( |
||||
|
'It appears that you have selected orders from multiple' |
||||
|
' customers. Please select orders from a single customer.')) |
@ -0,0 +1,32 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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") |
@ -0,0 +1,33 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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) |
@ -0,0 +1,107 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 itertools import groupby |
||||
|
from odoo import models, _ |
||||
|
from odoo.exceptions import UserError |
||||
|
|
||||
|
|
||||
|
class SaleOrder(models.Model): |
||||
|
""" |
||||
|
This class extends the 'sale.order' model to add custom functionalities |
||||
|
related to WhatsApp messaging. |
||||
|
""" |
||||
|
_inherit = 'sale.order' |
||||
|
|
||||
|
def action_send_whatsapp(self): |
||||
|
""" Action for sending whatsapp message.""" |
||||
|
compose_form_id = self.env.ref( |
||||
|
'whatsapp_mail_messaging.whatsapp_send_message_view_form').id |
||||
|
ctx = dict(self.env.context) |
||||
|
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, |
||||
|
'default_mobile': self.partner_id.mobile, |
||||
|
'default_image_1920': self.partner_id.image_1920, |
||||
|
}) |
||||
|
return { |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'whatsapp.send.message', |
||||
|
'views': [(compose_form_id, 'form')], |
||||
|
'view_id': compose_form_id, |
||||
|
'target': 'new', |
||||
|
'context': ctx, |
||||
|
} |
||||
|
|
||||
|
def check_customers(self, partner_ids): |
||||
|
""" Check if the selected sale orders belong to the same customer.""" |
||||
|
partners = groupby(partner_ids) |
||||
|
return next(partners, True) and not next(partners, False) |
||||
|
|
||||
|
def action_whatsapp_multi(self): |
||||
|
""" |
||||
|
Initiate WhatsApp messaging for multiple sale orders and open a message |
||||
|
composition wizard. |
||||
|
""" |
||||
|
sale_order_ids = self.env['sale.order'].browse( |
||||
|
self.env.context.get('active_ids')) |
||||
|
partner_ids = [] |
||||
|
for sale in sale_order_ids: |
||||
|
partner_ids.append(sale.partner_id.id) |
||||
|
partner_check = self.check_customers(partner_ids) |
||||
|
if partner_check: |
||||
|
sale_numbers = sale_order_ids.mapped('name') |
||||
|
sale_numbers = "\n".join(sale_numbers) |
||||
|
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' + |
||||
|
"Your Orders are" + '\n' + sale_numbers + ' ' + '\n' + |
||||
|
"is ready for review.Do not hesitate to contact us if " |
||||
|
"you have any questions.") |
||||
|
ctx.update({ |
||||
|
'default_message': message, |
||||
|
'default_partner_id': sale_order_ids[0].partner_id.id, |
||||
|
'default_mobile': sale_order_ids[0].partner_id.mobile, |
||||
|
'default_image_1920': sale_order_ids[0].partner_id.image_1920, |
||||
|
}) |
||||
|
return { |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'whatsapp.send.message', |
||||
|
'views': [(compose_form_id, 'form')], |
||||
|
'view_id': compose_form_id, |
||||
|
'target': 'new', |
||||
|
'context': ctx, |
||||
|
} |
||||
|
else: |
||||
|
raise UserError(_( |
||||
|
'It appears that you have selected orders from multiple' |
||||
|
' customers. Please select orders from a single customer.')) |
@ -0,0 +1,33 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 SelectionMessage(models.Model): |
||||
|
""" Message Templates """ |
||||
|
_name = 'selection.message' |
||||
|
_description = 'Selection Message' |
||||
|
|
||||
|
name = fields.Char(string="Name", |
||||
|
help="Name of message template") |
||||
|
message = fields.Text(string="Message", required=True, |
||||
|
help="The message to send") |
@ -0,0 +1,29 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sreerag PM (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 Website(models.Model): |
||||
|
""" Inheriting 'website' model to add mobile number.""" |
||||
|
_inherit = 'website' |
||||
|
|
||||
|
mobile_number = fields.Char(string='Mobile Number') |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 501 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 167 KiB |
After Width: | Height: | Size: 300 KiB |