Skip to content

Commit

Permalink
Merge 52b5346 into 1d2709c
Browse files Browse the repository at this point in the history
  • Loading branch information
mbcosta committed May 25, 2016
2 parents 1d2709c + 52b5346 commit dda5a78
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 288 deletions.
3 changes: 0 additions & 3 deletions l10n_br_crm_zip_correios/README.md

This file was deleted.

82 changes: 0 additions & 82 deletions l10n_br_crm_zip_correios/README.rst

This file was deleted.

23 changes: 0 additions & 23 deletions l10n_br_crm_zip_correios/__init__.py

This file was deleted.

39 changes: 0 additions & 39 deletions l10n_br_crm_zip_correios/__openerp__.py

This file was deleted.

23 changes: 0 additions & 23 deletions l10n_br_crm_zip_correios/models/__init__.py

This file was deleted.

35 changes: 0 additions & 35 deletions l10n_br_crm_zip_correios/models/crm_lead.py

This file was deleted.

9 changes: 0 additions & 9 deletions l10n_br_crm_zip_correios/test/crm_zip.yml

This file was deleted.

3 changes: 1 addition & 2 deletions l10n_br_zip_correios/models/__init__.py
Expand Up @@ -20,6 +20,5 @@
#
##############################################################################

from . import res_company
from . import res_partner
from . import webservice_client
from . import l10n_br_zip
36 changes: 36 additions & 0 deletions l10n_br_zip_correios/models/l10n_br_zip.py
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2016 Magno Costa - Akretion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 openerp import models, api
from openerp.addons.l10n_br_zip_correios.models.webservice_client\
import WebServiceClient


class L10nBrZip(models.Model, WebServiceClient):

_inherit = 'l10n_br.zip'

@api.multi
def zip_search_multi(self, country_id=False,
state_id=False, l10n_br_city_id=False,
district=False, street=False, zip_code=False):

self.get_address(zip_code)
return super(L10nBrZip, self).zip_search_multi(
country_id, state_id, l10n_br_city_id, district, street, zip_code)
34 changes: 0 additions & 34 deletions l10n_br_zip_correios/models/res_company.py

This file was deleted.

35 changes: 0 additions & 35 deletions l10n_br_zip_correios/models/res_partner.py

This file was deleted.

6 changes: 3 additions & 3 deletions l10n_br_zip_correios/models/webservice_client.py
Expand Up @@ -31,12 +31,12 @@

class WebServiceClient(object):

def get_address(self):
def get_address(self, zip_code):

if not self.zip:
if not zip_code:
return

zip_str = self.zip.replace('-', '')
zip_str = zip_code.replace('-', '')

if len(zip_str) == 8:
if not self.env['l10n_br.zip'].search([('zip', '=', zip_str)]):
Expand Down

0 comments on commit dda5a78

Please sign in to comment.