12 changed files with 219 additions and 73 deletions
			
			
		| @ -0,0 +1,22 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2021-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 . import whatsapp_mail_messaging | |||
| @ -0,0 +1,41 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2021-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 http | |||
| from odoo.http import request | |||
| 
 | |||
| 
 | |||
| class SendMessage(http.Controller): | |||
|     """ Controller for getting 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,33 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2021-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 api, 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,54 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
|     <!-- Tree View  --> | |||
|     <record id="selection_message_view_tree" model="ir.ui.view"> | |||
|         <field name="name">selection.message.view.tree</field> | |||
|         <field name="model">selection.message</field> | |||
|         <field name="arch" type="xml"> | |||
|             <tree> | |||
|                 <field name="name"/> | |||
|                 <field name="message"/> | |||
|             </tree> | |||
|         </field> | |||
|     </record> | |||
|     <!-- Form View--> | |||
|     <record id="selection_message_view_form" model="ir.ui.view"> | |||
|         <field name="name">selection.message.view.form</field> | |||
|         <field name="model">selection.message</field> | |||
|         <field name="arch" type="xml"> | |||
|             <form> | |||
|                 <sheet> | |||
|                     <group> | |||
|                         <group> | |||
|                             <field name="name"/> | |||
|                         </group> | |||
|                     </group> | |||
|                     <notebook> | |||
|                         <page string="Message"> | |||
|                             <group> | |||
|                                 <field colspan="2" name="message" widget="text_emojis" | |||
|                                        nolabel="1" | |||
|                                        placeholder="Write Message here...." | |||
|                                 /> | |||
|                             </group> | |||
|                         </page> | |||
|                     </notebook> | |||
|                 </sheet> | |||
|             </form> | |||
|         </field> | |||
|     </record> | |||
|     <!-- Action of Menu item --> | |||
|     <record id="selection_message_action" model="ir.actions.act_window"> | |||
|         <field name="name">Selection Message</field> | |||
|         <field name="res_model">selection.message</field> | |||
|         <field name="type">ir.actions.act_window</field> | |||
|         <field name="view_mode">tree,form</field> | |||
|         <field name="view_id" ref="selection_message_view_tree"/> | |||
|     </record> | |||
|     <!-- Menu item for message templates --> | |||
|     <menuitem name="Whatsapp Messages" | |||
|               id="menu_website_selection_message" | |||
|               action="selection_message_action" | |||
|               parent="website.menu_website_global_configuration" | |||
|               sequence="50"/> | |||
| </odoo> | |||
					Loading…
					
					
				
		Reference in new issue