'CRM Lead Report
@param cr: the current row, from the database cursor'

@api.model_cr
def init(self):

    tools.drop_view_if_exists(self._cr, 'crm_partner_report_assign')
    self._cr.execute("\n                                                CREATE    OR    REPLACE    VIEW    crm_partner_report_assign    AS    (\n                                                                SELECT\n                                                                                coalesce(i.id,    p.id    -    1000000000)    as    id,\n                                                                                p.id    as    partner_id,\n                                                                                (SELECT    country_id    FROM    res_partner    a    WHERE    a.parent_id=p.id    AND    country_id    is    not    null    limit    1)    as    country_id,\n                                                                                p.grade_id,\n                                                                                p.activation,\n                                                                                p.date_review,\n                                                                                p.date_partnership,\n                                                                                p.user_id,\n                                                                                p.team_id,\n                                                                                (SELECT    count(id)    FROM    crm_lead    WHERE    partner_assigned_id=p.id)    AS    nbr_opportunities,\n                                                                                i.price_total    as    turnover,\n                                                                                i.date\n                                                                FROM\n                                                                                res_partner    p\n                                                                                left    join    account_invoice_report    i\n                                                                                                on    (i.partner_id=p.id    and    i.type    in    ('out_invoice','out_refund')    and    i.state    in    ('open','paid'))\n                                                )")
