diff --git a/coworking_coworker/models/res_partner.py b/coworking_coworker/models/res_partner.py index 83a0ab7..74d11b5 100644 --- a/coworking_coworker/models/res_partner.py +++ b/coworking_coworker/models/res_partner.py @@ -27,6 +27,15 @@ class ResPartner(models.Model): ('volunteer', 'Volunteer'), ('visitor', 'Visitor')]) + full_contact_adress = fields.Char(compute='_compute_full_contact_adress') + + @api.depends('street', 'zip', 'city') + def _compute_full_contact_adress(self): + """Concatènation de l'adresse si les chanps street, czip et city sont renseignés""" + for coworker in self: + coworker.full_contact_adress = u'{} {} {}'.format \ + (coworker.street or u'', coworker.zip or u'', coworker.city or u'').strip() + @api.constrains('contact_date') def _check_contact_date(self): diff --git a/coworking_coworker/views/res_partner_views.xml b/coworking_coworker/views/res_partner_views.xml index 997e180..e7416f5 100644 --- a/coworking_coworker/views/res_partner_views.xml +++ b/coworking_coworker/views/res_partner_views.xml @@ -20,9 +20,24 @@ - - - + + + + res.partner.tree.inherit + res.partner + + + + + + + + + + + + +