---
# System prepended metadata

title: Reporte determinantes (Ventas - Brenda)
tags: [DataStudio]

---

# Reporte determinantes (Ventas - Brenda)

###### tags: `DataStudio`

###Query

```sql=
select
     rp.id                      as id_partner               ,
     det.parent_id              as parent                   ,
     rp.name                    as name_partner             ,
     det.id                     as id_determ                ,
     det.name                   as name_determ              ,
     det.type                   as type_partner_determ      ,
     det.street                 as street_determ            ,
     det.street2                as street2_determ           ,
     det.city                   as city_determ              ,
     rcs.name                   as state_determ             ,
     det.zip                    as cp_determ                ,
     rc.name                    as country_determ           ,
     det.asn_ok                 as asn_determ               ,
     xbg.x_name                 as grouper_determ           ,
     det.comment                as note_determ              ,
     det.shipping_address_code  as shipping_address_determ  ,
     sw.name                    as outgoing_warehouse       ,
     ct.name                    as sales_team
from
    res_partner rp
left join
    res_partner det
on
    rp.id = det.parent_id and det.type = 'delivery'
left join
    res_country rc
on
    det.country_id = rc.id
left join
    crm_team ct
on
    det.team_id = ct.id
left join
    stock_warehouse sw
on
    det.warehouse_id = sw.id
left join
    x_brand_group xbg
on
    det.x_brandgroup_id = xbg.id
left join
    res_country_state rcs
on
    det.state_id = rcs.id
where
    rp.customer
    and rp.parent_id is null
    and det.type = 'delivery'
    and rp.id = 94632
order by
    rp.id
    ;

select rp.parent_id from res_partner rp limit 1;
```
