Reference for #4

This commit is contained in:
Deena 2025-08-02 18:44:23 +05:30
parent 0565053d7a
commit de6c275785
14 changed files with 445 additions and 5 deletions

View File

@ -22,8 +22,6 @@ class sos_inside_sales_leads(models.Model):
website_url = fields.Char(string="Website URL")
vertical_domain = fields.Many2many('sos_vertical_domain',string="Domain / Industry", ondelete="cascade")
line_ids_contacts = fields.One2many('sos_leads_contact_lines', 'ref_id', string="Contact Details",copy=True)
remarks=fields.Text(string="Remarks")
linkedin_profile = fields.Char(string="Linkedin profile")
# products = fields.Selection(
# [
# ('BHMS 1.2V', 'BHMS 1.2V'),
@ -148,7 +146,6 @@ class sos_inside_sales_leads(models.Model):
'location':self.location,
'website_url':self.website_url,
'vertical_domain': [(6, 0, self.vertical_domain.ids)],
'linkedin_profile':self.linkedin_profile,
'products_interested':[(6, 0,self.products_interested.ids)],
'source':'inside_sales',
'expo_name':self.expo_name,

View File

@ -66,7 +66,6 @@
</group>
<group>
<field name="website_url"/>
<field name="linkedin_profile"/>
<field name="service"/>
<field name="products_interested"
options="{'no_create': True, 'no_edit': True, 'no_create_edit': True}"
@ -75,7 +74,6 @@
<field name="new_source"/>
<field name="expo_name" invisible="new_source != 2"/>
<field name="meeting_scheduled"/>
<field name="remarks"/>
</group>
</group>
<br> </br>

View File

@ -115,5 +115,12 @@
<field name="category_id"
ref="sos_inventory.module_category_sos_inventory"/>
</record>
<!-- Marketing Group -->
<record id="sos_marketing_user" model="res.groups">
<field name="name">Marketing User</field>
<field name="category_id"
ref="sos_inventory.module_category_sos_inventory"/>
</record>
</data>
</odoo>

4
sos_marketing/__init__.py Executable file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import controllers
from . import models

33
sos_marketing/__manifest__.py Executable file
View File

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
{
'name': "SOS Marketing",
'summary': "Marketing",
'description': """
Long description of module's purpose
""",
'author': "Deena",
'website': "https://sosaley.com",
'category': 'Inventory',
'version': '17.0.1.0.0',
# any module necessary for this one to work correctly
'depends': ['base','web','mail','sos_inventory','sos_sales'],
# always loaded
'data': [
'security/ir.model.access.csv',
'views/menu.xml',
'views/sos_marketing_leads_view.xml'
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
'installable': True,
'application': True,
'license': 'LGPL-3'
}

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# from odoo import http
# class SosMarketing(http.Controller):
# @http.route('/sos_marketing/sos_marketing', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/sos_marketing/sos_marketing/objects', auth='public')
# def list(self, **kw):
# return http.request.render('sos_marketing.listing', {
# 'root': '/sos_marketing/sos_marketing',
# 'objects': http.request.env['sos_marketing.sos_marketing'].search([]),
# })
# @http.route('/sos_marketing/sos_marketing/objects/<model("sos_marketing.sos_marketing"):obj>', auth='public')
# def object(self, obj, **kw):
# return http.request.render('sos_marketing.object', {
# 'object': obj
# })

30
sos_marketing/demo/demo.xml Executable file
View File

@ -0,0 +1,30 @@
<odoo>
<data>
<!--
<record id="object0" model="sos_marketing.sos_marketing">
<field name="name">Object 0</field>
<field name="value">0</field>
</record>
<record id="object1" model="sos_marketing.sos_marketing">
<field name="name">Object 1</field>
<field name="value">10</field>
</record>
<record id="object2" model="sos_marketing.sos_marketing">
<field name="name">Object 2</field>
<field name="value">20</field>
</record>
<record id="object3" model="sos_marketing.sos_marketing">
<field name="name">Object 3</field>
<field name="value">30</field>
</record>
<record id="object4" model="sos_marketing.sos_marketing">
<field name="name">Object 4</field>
<field name="value">40</field>
</record>
-->
</data>
</odoo>

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import sos_marketing_leads

View File

@ -0,0 +1,155 @@
from odoo import models, fields, api
class sos_marketing(models.Model):
_name = 'sos_marketing_leads'
_description = 'Marketing Leads'
_rec_name = 'company_name'
company_name = fields.Char(string="Company Name")
website_url = fields.Char(string="Website URL")
country = fields.Many2one(
'res.country',
string='Country',
default=lambda self: self.env['res.country'].search([('code', '=', 'IN')], limit=1)
)
location = fields.Char(string="City/State")
expo_option=fields.Boolean(string="Expo",default="True")
conference_option=fields.Boolean(string="Conference")
linkedin_groups_option=fields.Boolean(string="LinkedIn Groups")
linkedin_poll_option=fields.Boolean(string="LinkedIn Poll")
direct_company=fields.Boolean(string="Direct Company")
expo_participated_option=fields.Boolean(string="Expo [Paricipated]")
#Expo
expo_name = fields.Char(string="Expo Name")
expo_date_from = fields.Date(string="Expo Date From")
expo_date_to = fields.Date(string="Expo Date To")
expo_Location = fields.Char(string="Expo Location")
#Conference
conference_name = fields.Char(string="Conference Name")
conference_date_from = fields.Date(string="Conference Date From")
conference_date_to = fields.Date(string="Conference Date To")
conference_Location = fields.Char(string="Conference Location")
#Linkedin Group
linkedin_group_name = fields.Char(string="LinkedIn Group Name")
#Linkedin poll
linkedin_post_url = fields.Char(string="LinkedIn Post URL")
vertical_domain = fields.Many2many('sos_vertical_domain',string="Vertical/Domain", ondelete="cascade")
line_ids_contacts = fields.One2many('sos_marketing_leads_contact_lines', 'ref_id', string="Contact Details",copy=True)
move_to_inside_sales = fields.Many2many('res.users',string="Move Lead to", domain=lambda self: [('groups_id', 'in', self.env.ref('sos_inventory.sos_inside_sales_user').ids + self.env.ref('sos_inventory.sos_sales_user').ids)])
cc_mail = fields.Many2one('res.users',string="CC to", domain=lambda self: [('groups_id', 'in', self.env.ref('sos_inventory.sos_sales_user').ids + self.env.ref('sos_inventory.sos_inside_sales_user').ids)])
move_div_display = fields.Boolean(default=False,string="Moved to Sales")
moved_on = fields.Date(string="Moved On")
@api.onchange('expo_option')
def _onchange_expo(self):
if self.expo_option:
self.conference_option = False
self.linkedin_groups_option = False
self.linkedin_poll_option = False
self.direct_company = False
self.expo_participated_option = False
@api.onchange('conference_option')
def _onchange_conference(self):
if self.conference_option:
self.expo_option = False
self.linkedin_groups_option = False
self.linkedin_poll_option = False
self.direct_company = False
self.expo_participated_option = False
@api.onchange('linkedin_groups_option')
def _onchange_linkedin_groups(self):
if self.linkedin_groups_option:
self.expo_option = False
self.conference_option = False
self.linkedin_poll_option = False
self.direct_company = False
self.expo_participated_option = False
@api.onchange('linkedin_poll_option')
def _onchange_linkedin_poll(self):
if self.linkedin_poll_option:
self.expo_option = False
self.conference_option = False
self.linkedin_groups_option = False
self.direct_company = False
self.expo_participated_option = False
@api.onchange('direct_company')
def _onchange_direct_company(self):
if self.direct_company:
self.expo_option = False
self.conference_option = False
self.linkedin_groups_option = False
self.linkedin_poll_option = False
self.expo_participated_option = False
@api.onchange('expo_participated_option')
def _onchange_expo_participated(self):
if self.expo_participated_option:
self.expo_option = False
self.conference_option = False
self.linkedin_groups_option = False
self.linkedin_poll_option = False
self.direct_company = False
def action_move_to_inside_sales(self):
if self.move_to_inside_sales:
for user in self.move_to_inside_sales:
body_html = f"""
<p>Below <b>Lead</b> is moved to Inside-Sales</p>
"""
subject = f"New Lead Received - {self.company_name}"
send_email = self.env['sos_common_scripts']
send_email.send_direct_email(self.env,"sos_marketing_leads",self.id,user.login,subject,body_html,self.cc_mail.login)
new_record = self.env['sos_inside_sales_leads'].create({
'company_name': self.company_name,
'location':self.location,
'website_url':self.website_url,
'vertical_domain': [(6, 0, self.vertical_domain.ids)]
})
if new_record:
if self.line_ids_contacts:
for contact in self.line_ids_contacts:
self.env['sos_leads_contact_lines'].create({
'ref_id': new_record.id,
'name': contact.name,
'dept': contact.dept,
'email': contact.email,
'mobile_number': contact.mobile_number,
'set_as_primary': contact.set_as_primary,
'linkedin_profile': contact.linkedin_profile,
'remarks': contact.remarks
})
self.move_div_display = True
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': "Moved Successfully",
'type': 'success',
'sticky': False
}
}
class SOS__Marketing_Leads_Line(models.Model):
_name = 'sos_marketing_leads_contact_lines'
_description = 'Marketing Leads Contact Lines'
ref_id = fields.Many2one('sos_marketing_leads', string="Marketing Leads", ondelete="cascade")
name = fields.Char(string="Name")
dept = fields.Char(string="Designation")
email = fields.Char(string="Email Id")
mobile_number = fields.Char(string="Contact No")
set_as_primary = fields.Boolean(string="Set Primary")
linkedin_profile = fields.Char(string="LinkedIn Profile")
linkedin_invited_on = fields.Char(string="LinkedIn Conn Invited On")
linkedin_invitation_status = fields.Selection(
[
('Yet To Accept', 'Yet To Accept'),
('Accepted', 'Accepted'),
('No Match', 'No Match'),
('No Requirement', 'No Requirement')
],
string="LinkedIn Conn Invitation Status")
remarks = fields.Text(string="Remarks")

View File

@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sos_marketing_leads,sos_marketing_leads access for all,model_sos_marketing_leads,base.group_user,1,1,1,1
access_sos_marketing_leads_contact_lines,sos_marketing_leads_contact_lines access for all,model_sos_marketing_leads_contact_lines,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sos_marketing_leads sos_marketing_leads access for all model_sos_marketing_leads base.group_user 1 1 1 1
3 access_sos_marketing_leads_contact_lines sos_marketing_leads_contact_lines access for all model_sos_marketing_leads_contact_lines base.group_user 1 1 1 1

4
sos_marketing/views/menu.xml Executable file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<menuitem id="sos_marketing_menu_root" name="Marketing" groups="sos_inventory.sos_marketing_user,sos_inventory.sos_management_user"/>
</odoo>

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="action_marketing_leads_list" model="ir.actions.act_window">
<field name="name">Marketing Leads</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sos_marketing_leads</field>
<field name="view_mode">tree,form,kanban</field>
</record>
<record id="sos_marketing_leads_view_tree" model="ir.ui.view">
<field name="name">sos_marketing_leads.view.tree</field>
<field name="model">sos_marketing_leads</field>
<field name="arch" type="xml">
<tree>
<field name="company_name"/>
<field name="write_uid" string="Last Edited By" optional="hide"/>
<field name="write_date" string="Last Edited On" optional="hide"/>
</tree>
</field>
</record>
<record id="sos_marketing_leads_form_view" model="ir.ui.view">
<field name="name">Form</field>
<field name="model">sos_marketing_leads</field>
<field name="arch" type="xml">
<form string="Model Form">
<sheet>
<h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Marketing Leads</h2><hr></hr><br></br>
<table class="table" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">
<tr>
<td><group><field name="expo_option"/></group></td>
<td><group><field name="conference_option"/></group></td>
<td><group><field name="linkedin_groups_option"/></group></td></tr>
<tr>
<td><group><field name="linkedin_poll_option"/></group></td>
<td><group><field name="direct_company"/></group></td>
<td><group><field name="expo_participated_option"/></group></td></tr>
</table>
<br></br><br></br><br></br>
<h3 style="text-transform: uppercase;
text-decoration: underline;">Company Info</h3>
<group>
<!-- First Column -->
<group>
<field name="move_div_display" invisible="1"/>
<field name="company_name"/>
<field name="country"/>
</group>
<!-- Second Column -->
<group>
<field name="website_url"/>
<field name="location"/>
</group>
</group>
<br></br>
<!--Expo-->
<div invisible="expo_option != True">
<h3 style="text-transform: uppercase;
text-decoration: underline;">Expo Details</h3>
<group>
<group>
<field name="expo_name"/>
<field name="expo_date_from"/>
<field name="expo_date_to"/>
</group>
<group>
<field name="expo_Location"/>
<field name="vertical_domain" widget="many2many_tags"/>
</group>
</group>
</div>
<!--Conference-->
<div invisible="conference_option != True">
<h3 style="text-transform: uppercase;
text-decoration: underline;">Conference Details</h3>
<group>
<group>
<field name="conference_name"/>
<field name="conference_date_from"/>
<field name="conference_date_to"/>
</group>
<group>
<field name="conference_Location"/>
<field name="vertical_domain" widget="many2many_tags"/>
</group>
</group>
</div>
<!--LinkedIn Group-->
<div invisible="linkedin_groups_option != True">
<h3 style="text-transform: uppercase;
text-decoration: underline;">LinkedIn Group Details</h3>
<group>
<group>
<field name="linkedin_group_name"/>
</group>
</group>
</div>
<!--LinkedIn Group-->
<div invisible="linkedin_poll_option != True">
<h3 style="text-transform: uppercase;
text-decoration: underline;">LinkedIn Poll Details</h3>
<group>
<group>
<field name="linkedin_post_url"/>
</group>
</group>
</div>
<!--Expo participated-->
<div invisible="expo_participated_option != True">
<h3 style="text-transform: uppercase;
text-decoration: underline;">Expo[Participated] Details</h3>
<group>
<group>
<field name="expo_name"/>
<field name="expo_date_from"/>
<field name="expo_date_to"/>
</group>
<group>
<field name="expo_Location"/>
<field name="vertical_domain" widget="many2many_tags"/>
</group>
</group>
</div>
<br></br>
<h3 style="text-transform: uppercase;
text-decoration: underline;">Contact Details</h3>
<field name="line_ids_contacts">
<tree editable="bottom">
<field name="set_as_primary"/>
<field name="name"/>
<field name="dept"/>
<field name="email"/>
<field name="mobile_number"/>
<field name="linkedin_profile"/>
<field name="linkedin_invited_on"/>
<field name="linkedin_invitation_status"/>
<field name="remarks"/>
</tree>
</field>
<br></br>
<div class="row" invisible="move_div_display">
<div class="col-6"></div>
<div class="col-6">
<table class="table_custom" style="padding: 30px;box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">
<tr><td class="column">Move Lead To</td><td><field name="move_to_inside_sales" widget="many2many_tags"/></td></tr>
<tr><td class="column">Cc To</td><td><field name="cc_mail"/></td></tr>
<tr><td></td><td><button name="action_move_to_inside_sales" type="object" class="btn btn-primary">Move</button></td></tr>
</table>
</div>
</div>
<div class="row" invisible="move_div_display == False">
<div class="col-6"></div>
<div class="col-6">
<table class="table_custom" style="padding: 30px;box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">
<tr><td class="column">Moved To</td><td><field readonly="1" name="move_to_inside_sales" widget="many2many_tags"/></td></tr>
<tr><td class="column">Moved On</td><td><field readonly="1" name="moved_on"/></td></tr>
</table>
</div>
</div>
</sheet>
</form>
</field>
</record>
<menuitem id="sos_marketing_leads_menu" action="action_marketing_leads_list" name="LEADS" parent="sos_marketing_menu_root" />
</odoo>