-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #414 from multidadosti-erp/feature/res_bank_zip_se…
…arch [NEW] Add zip search in ResBank view and views fixies
- Loading branch information
Showing
21 changed files
with
222 additions
and
96 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
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
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
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,43 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2016 MultidadosTI (http://www.multidadosti.com.br) | ||
# @author Michell Stuttgart <michellstut@gmail.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
import re | ||
|
||
from openerp import models, fields, api | ||
|
||
|
||
class ResBank(models.Model): | ||
|
||
_inherit = 'res.bank' | ||
|
||
district = fields.Char(u'Bairro', size=32) | ||
number = fields.Char(u'Número', size=10) | ||
|
||
country_id = fields.Many2one('res.country', related='country', | ||
string=u'País') | ||
|
||
state_id = fields.Many2one('res.country.state', related='state', | ||
string=u'Estado') | ||
|
||
l10n_br_city_id = fields.Many2one('l10n_br_base.city', u'Municipio', | ||
domain="[('state_id','=',state_id)]") | ||
|
||
@api.onchange('l10n_br_city_id') | ||
def _onchange_l10n_br_city_id(self): | ||
""" Ao alterar o campo l10n_br_city_id que é um campo relacional | ||
com o l10n_br_base.city que são os municípios do IBGE, copia o nome | ||
do município para o campo city que é o campo nativo do módulo base | ||
para manter a compatibilidade entre os demais módulos que usam o | ||
campo city. | ||
""" | ||
if self.l10n_br_city_id: | ||
self.city = self.l10n_br_city_id.name | ||
|
||
@api.onchange('zip') | ||
def _onchange_zip(self): | ||
if self.zip: | ||
val = re.sub('[^0-9]', '', self.zip) | ||
if len(val) == 8: | ||
self.zip = "%s-%s" % (val[0:5], val[5:8]) |
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,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<record id="view_l10n_br_base_bank_form" model="ir.ui.view"> | ||
<field name="name">l10n_br_base.bank.form</field> | ||
<field name="model">res.bank</field> | ||
<field name="inherit_id" ref="base.view_res_bank_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="street2" position="replace"/> | ||
<field name="zip" position="replace"/> | ||
<field name="street" position="replace"> | ||
<field name="zip" placeholder="CEP" style="width:50%" /> | ||
<field name="street" placeholder="Logradouro" /> | ||
<field name="number" placeholder="Número"/> | ||
<field name="street2" placeholder="Complemento"/> | ||
<field name="district" placeholder="Bairro"/> | ||
<field name="country_id" placeholder="País"/> | ||
<field name="state_id" placeholder="Estado"/> | ||
<field name="l10n_br_city_id" placeholder="Cidade"/> | ||
</field> | ||
<field name="state_id" position="attributes"> | ||
<attribute name="domain">[('country_id','=',country_id)]</attribute> | ||
<attribute name="style">width:100%</attribute> | ||
</field> | ||
<field name="country" position="replace"> | ||
<field name="country" invisible="1"/> | ||
</field> | ||
<field name="state" position="replace"> | ||
<field name="state" invisible="1"/> | ||
</field> | ||
<field name="city" position="replace"> | ||
<field name="city" invisible="1"/> | ||
</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 |
---|---|---|
|
@@ -55,4 +55,4 @@ | |
</record> | ||
|
||
</data> | ||
</openerp> | ||
</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
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
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
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
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
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
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
from . import l10n_br_zip | ||
from . import res_company | ||
from . import res_partner | ||
from . import res_bank |
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
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,15 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2016 MultidadosTI (http://www.multidadosti.com.br) | ||
# @author Michell Stuttgart <michellstut@gmail.com.br> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import models, api | ||
|
||
|
||
class ResBank(models.Model): | ||
_inherit = 'res.bank' | ||
|
||
@api.multi | ||
def zip_search(self): | ||
self.ensure_one() | ||
return self.env['l10n_br.zip'].zip_search(self) |
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
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
Oops, something went wrong.