Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Website

Entity: website.visitor

Compute Method: _compute_email_phone

Inputs Method Outputs
results = self.env['res.partner'].search_read(
            [('id', 'in', self.partner_id.ids)],
            ['id', 'email_normalized', 'phone'],
        )
mapped_data = {
            result['id']: {
                'email_normalized': result['email_normalized'],
                'phone': result['phone']
            } for result in results
        }
for visitor in self:
            visitor.email = mapped_data.get(visitor.partner_id.id, {}).get('email_normalized')
            visitor.mobile = mapped_data.get(visitor.partner_id.id, {}).get('phone')

Back to entity