computed adress if if if if :)

This commit is contained in:
michel 2017-11-07 15:27:21 +01:00
parent a197f65db5
commit 561aa7a49d
1 changed files with 7 additions and 1 deletions

View File

@ -59,5 +59,11 @@ class Coworker(models.Model):
@api.depends('street', 'contact_zip', 'city')
def _compute_full_contact_adress(self):
for coworker in self:
if coworker.city:
coworker.full_contact_adress = u'{}'.format(coworker.city)
if coworker.contact_zip and coworker.city:
coworker.full_contact_adress = u'{} {}'.format(coworker.contact_zip, coworker.city)
if coworker.street and coworker.contact_zip and coworker.city:
coworker.full_contact_adress = u'{} {} {}'.format (coworker.street, coworker.contact_zip, coworker.city)
coworker.full_contact_adress = u'{} {} {}'.format(coworker.street, coworker.contact_zip, coworker.city)