Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Módulo de Cep para o CRM | ||
======================== | ||
ZIP Search Integration for Brazilian Localization of CRM module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################### | ||
# # | ||
# Copyright (C) 2011 Renato Lima - Akretion # | ||
# # | ||
# This program is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU Affero General Public License as published by # | ||
# the Free Software Foundation, either version 3 of the License, or # | ||
# (at your option) any later version. # | ||
# # | ||
# 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 Affero General Public License for more details. # | ||
# # | ||
# You should have received a copy of the GNU Affero General Public License # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
############################################################################### | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################### | ||
# # | ||
# Copyright (C) 2011 Fabio Negrini - Akretion # | ||
# # | ||
# This program is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU Affero General Public License as published by # | ||
# the Free Software Foundation, either version 3 of the License, or # | ||
# (at your option) any later version. # | ||
# # | ||
# 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 Affero General Public License for more details. # | ||
# # | ||
# You should have received a copy of the GNU Affero General Public License # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
############################################################################### | ||
|
||
{ | ||
'name': 'Brazilian Localization CRM Zip', | ||
'category': 'Localization', | ||
'license': 'AGPL-3', | ||
'author': 'Fabio Negrini - OpenERP Brasil', | ||
'website': 'http://openerpbrasil.org', | ||
'version': '8.0', | ||
'depends': [ | ||
'l10n_br_zip', | ||
'l10n_br_crm', | ||
], | ||
'data': [ | ||
'views/crm_lead_view.xml', | ||
'views/crm_opportunity_view.xml', | ||
], | ||
'demo': [], | ||
'installable': True, | ||
'auto_install': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#. module: base | ||
#: model:ir.module.module,shortdesc:base.module_l10n_br_crm_zip | ||
msgid "Brazilian Localization CRM Zip" | ||
msgstr "Localização Brasileira - Módulo de Cep para o CRM" | ||
|
||
#. module: base | ||
#: model:ir.module.module,description:base.module_l10n_br_crm_zip | ||
msgid "ZIP Search Integration for Brazilian Localization of CRM module" | ||
msgstr "Localização Brasileira - Integra a busca de cep ao módulo de CRM" | ||
|
||
#. module: l10n_br_crm_zip | ||
#: model:ir.model,name:l10n_br_crm_zip.model_crm_lead | ||
msgid "Lead/Opportunity" | ||
msgstr "Prospecto/Oportunidade" | ||
|
||
#. module: l10n_br_crm_zip | ||
#: code:addons/l10n_br_crm_zip/models/crm_lead.py:64 | ||
#, python-format | ||
msgid "No records found!" | ||
msgstr "Nenhum registro encontrado!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################### | ||
# # | ||
# Copyright (C) 2015 KMEE - www.kmee.com.br # | ||
# Michell Stuttgart <michell.stuttgart@kmee.com.br> # | ||
# # | ||
# This program is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU Affero General Public License as published by # | ||
# the Free Software Foundation, either version 3 of the License, or # | ||
# (at your option) any later version. # | ||
# # | ||
# 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 General Public License for more details. # | ||
# # | ||
# You should have received a copy of the GNU General Public License # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
# # | ||
############################################################################### | ||
|
||
from . import crm_lead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################### | ||
# # | ||
# Copyright (C) 2012 Renato Lima - Akretion # | ||
# # | ||
# This program is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU Affero General Public License as published by # | ||
# the Free Software Foundation, either version 3 of the License, or # | ||
# (at your option) any later version. # | ||
# # | ||
# 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 Affero General Public License for more details. # | ||
# # | ||
# You should have received a copy of the GNU Affero General Public License # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
############################################################################### | ||
|
||
from openerp import models, api | ||
from openerp.tools.translate import _ | ||
from openerp.exceptions import Warning | ||
|
||
|
||
class CrmLead(models.Model): | ||
""" CRM Lead Case """ | ||
_inherit = "crm.lead" | ||
|
||
@api.multi | ||
def zip_search(self): | ||
self.ensure_one() | ||
obj_zip = self.env['l10n_br.zip'] | ||
|
||
zip_ids = obj_zip.zip_search_multi( | ||
country_id=self.country_id.id, | ||
state_id=self.state_id.id, | ||
l10n_br_city_id=self.l10n_br_city_id.id, | ||
district=self.district, | ||
street=self.street, | ||
zip_code=self.zip, | ||
) | ||
|
||
obj_zip_result = self.env['l10n_br.zip.result'] | ||
zip_ids = obj_zip_result.map_to_zip_result(zip_ids, self._name, | ||
self.id) | ||
if len(zip_ids) == 1: | ||
result = obj_zip.set_result(zip_ids[0]) | ||
self.write(result) | ||
return True | ||
else: | ||
if len(zip_ids) > 1: | ||
return obj_zip.create_wizard( | ||
self._name, | ||
self.id, | ||
country_id=self.country_id.id, | ||
state_id=self.state_id.id, | ||
l10n_br_city_id=self.l10n_br_city_id.id, | ||
district=self.district, | ||
street=self.street, | ||
zip_code=self.zip, | ||
zip_ids=[z.id for z in zip_ids], | ||
) | ||
else: | ||
raise Warning(_('No records found!')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<!-- CRM Lead Form View --> | ||
<record model="ir.ui.view" id="l10n_br_crm_case_form_view_leads1"> | ||
<field name="name">l10n_br_crm.leads1</field> | ||
<field name="model">crm.lead</field> | ||
<field name="inherit_id" ref="crm.crm_case_form_view_leads" /> | ||
<field name="arch" type="xml"> | ||
<field name="zip" position="after"> | ||
<button name="zip_search" type="object" class="oe_inline"> | ||
<i class="fa fa-search"></i> | ||
</button> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<!-- CRM Opportunity Form View --> | ||
<record model="ir.ui.view" id="l10n_br_crm_case_form_view_oppor1"> | ||
<field name="name">l10n_br_crm.opportunities1</field> | ||
<field name="model">crm.lead</field> | ||
<field name="inherit_id" ref="crm.crm_case_form_view_oppor" /> | ||
<field name="arch" type="xml"> | ||
<field name="zip" position="after"> | ||
<button name="zip_search" type="object" class="oe_inline"> | ||
<i class="fa fa-search"></i> | ||
</button> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |