Начальное наполнение
This commit is contained in:
parent
4f2e3c9765
commit
6ee84adebd
4
__init__.py
Normal file
4
__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
14
__manifest__.py
Normal file
14
__manifest__.py
Normal file
@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': 'Send SMS to Visitor with leads',
|
||||
'category': 'Website/Website',
|
||||
'sequence': 54,
|
||||
'summary': 'Allows to send sms to website visitor that have lead',
|
||||
'version': '1.0',
|
||||
'description': """Allows to send sms to website visitor if the visitor is linked to a lead.""",
|
||||
'depends': ['website_sms', 'crm'],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'license': 'LGPL-3',
|
||||
}
|
23
i18n/ru.po
Normal file
23
i18n/ru.po
Normal file
@ -0,0 +1,23 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_crm_sms
|
||||
#
|
||||
# Translators:
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 17.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-10-26 21:55+0000\n"
|
||||
"PO-Revision-Date: 2024-01-30 15:14+0400\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Russian (https://app.transifex.com/odoo/teams/41243/ru/)\n"
|
||||
"Language: ru\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
|
||||
|
||||
#. module: website_crm_sms
|
||||
#: model:ir.model,name:website_crm_sms.model_website_visitor
|
||||
msgid "Website Visitor"
|
||||
msgstr "Посетитель сайта"
|
21
i18n/website_crm_sms.pot
Normal file
21
i18n/website_crm_sms.pot
Normal file
@ -0,0 +1,21 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_crm_sms
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 17.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-10-26 21:55+0000\n"
|
||||
"PO-Revision-Date: 2023-10-26 21:55+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: website_crm_sms
|
||||
#: model:ir.model,name:website_crm_sms.model_website_visitor
|
||||
msgid "Website Visitor"
|
||||
msgstr ""
|
4
models/__init__.py
Normal file
4
models/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import website_visitor
|
28
models/website_visitor.py
Normal file
28
models/website_visitor.py
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class WebsiteVisitor(models.Model):
|
||||
_inherit = 'website.visitor'
|
||||
|
||||
def _check_for_sms_composer(self):
|
||||
check = super(WebsiteVisitor, self)._check_for_sms_composer()
|
||||
if not check and self.lead_ids:
|
||||
sorted_leads = self.lead_ids.filtered(lambda l: l.mobile == self.mobile or l.phone == self.mobile)._sort_by_confidence_level(reverse=True)
|
||||
if sorted_leads:
|
||||
return True
|
||||
return check
|
||||
|
||||
def _prepare_sms_composer_context(self):
|
||||
if not self.partner_id and self.lead_ids:
|
||||
leads_with_number = self.lead_ids.filtered(lambda l: l.mobile == self.mobile or l.phone == self.mobile)._sort_by_confidence_level(reverse=True)
|
||||
if leads_with_number:
|
||||
lead = leads_with_number[0]
|
||||
return {
|
||||
'default_res_model': 'crm.lead',
|
||||
'default_res_id': lead.id,
|
||||
'number_field_name': 'mobile' if lead.mobile == self.mobile else 'phone',
|
||||
}
|
||||
return super(WebsiteVisitor, self)._prepare_sms_composer_context()
|
Loading…
x
Reference in New Issue
Block a user