From ce23b7e78e82a676605460ad830b5eeba2e87f3b Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 27 Nov 2017 16:02:09 +0100 Subject: [PATCH] Tree view and full contact adress --- coworking_coworker/models/res_partner.py | 9 ++++++++ .../views/res_partner_views.xml | 21 ++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) 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 + + + + + + + + + + + + +