Skip to content

Commit

Permalink
Agregando formato a la ciudad en el widget del partner
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayhanJC committed Jun 19, 2020
1 parent c429e1b commit 4ddd17b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions models/l10n_co_res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,3 +484,35 @@ def _check_person_type(self):
if self.personType is False:
msg = _('Error! Please select a person type')
raise exceptions.ValidationError(msg)

@api.multi
def _display_address(self, without_company=False):

'''
The purpose of this function is to build and return an address formatted accordingly to the
standards of the country where it belongs.
:param address: browse record of the res.partner to format
:returns: the address formatted in a display that fit its country habits (or the default ones
if not country is specified)
:rtype: string
'''
# get the information that will be injected into the display format
# get the address format
address_format = self._get_address_format()
args = {
'state_code': self.state_id.code or '',
'state_name': self.state_id.name or '',
'country_code': self.country_id.code or '',
'country_name': self._get_country_name(),
'company_name': self.commercial_company_name or '',
}
for field in self._formatting_address_fields():
args[field] = getattr(self, field) or ''
if without_company:
args['company_name'] = ''
elif self.commercial_company_name:
address_format = '%(company_name)s\n' + address_format

args['city'] = args['city'].capitalize() + ','
return address_format % args

4 comments on commit 4ddd17b

@dkrimmer84
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hola @BrayhanJC este fix que hace? Resulta que la logica de pais -> municipio -> ciudad ya no esta funcionando bien. Pense que este cambio resuelve el bug, pero sigo con el mismo error. Alguna idea? Te funciona?

@BrayhanJC
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hola @dkrimmer84 por favor enviame el error para saber que es lo que sucede

@dkrimmer84
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, te explico los pasos para reproducir el error:

  • Crea un contacto nuevo
  • Escoges "colombia" en el campo país
  • Escoges "amazonas" en el campo "estado"

Lo que se hubiera esperado:
Campo de Municipio contiene solamente municipios del Amazonas (por ejemplo Leticia)

Lo que sucede en realidad:
Campo de Municipio contiene todos los municipios de colombia (incluso los 3 nariños de Colombia)

Hace varios commits eso funciono muy bien. Me gustaria saber si te pasa lo mismo. En el caso que si, alguna idea que podria causar este comportamiento?

@BrayhanJC
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

No veo el error, me funciona bien. Debería revisar en su instancia el código del Amazonas

Please sign in to comment.