From 561aa7a49d584cdbed40a413fed1111181cd91a4 Mon Sep 17 00:00:00 2001 From: michel Date: Tue, 7 Nov 2017 15:27:21 +0100 Subject: [PATCH] computed adress if if if if :) --- models/coworker.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/models/coworker.py b/models/coworker.py index f06cc70..a02e502 100644 --- a/models/coworker.py +++ b/models/coworker.py @@ -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)