Tree view and full contact adress

This commit is contained in:
michel 2017-11-27 16:02:09 +01:00
parent 7111308501
commit ce23b7e78e
2 changed files with 27 additions and 3 deletions

View File

@ -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):

View File

@ -20,9 +20,24 @@
<field name="email" position="after">
<field name="url" />
</field>
</field>
</record>
<!-- Tree -->
<record id="view_tree_res_partner" model="ir.ui.view">
<field name="name">res.partner.tree.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref ="base.view_partner_tree" />
<field name="arch" type="xml">
<field name="phone" position="before">
<field name="company_name" />
<field name="full_contact_adress" />
</field>
<field name="phone" position="replace">
<field name="mobile" />
</field>
</field>
</record>
</odoo>