Base path: /v1/sales/master/sales-team-customers
Manages the lifecycle of sales_team_customers across Sales Teams and Sales Team Groups (goal-data-db), including automatic PostGIS level-4 territory & portfolio assignment, hierarchical commercial configuration, portfolio-change visit propagation, and immutable audit logging (sales_team_customer_logs).
| Method | Path | Description |
|---|---|---|
GET |
/ |
List sales team customers |
GET |
/{id} |
Show single sales team customer |
POST |
/ |
Create sales team customer (records CREATED audit log) |
PUT |
/{id} |
Update sales team customer (propagates portfolio/schedule changes to seller & future visits + records audit log) |
GET |
/{id}/effective-config |
Resolve hierarchical effective configuration (credit_limit, apply_credit_charge, payment_term_id, portfolio_id, seller_id, sales_schedule_id, frequency_type) with source_level attribution |
GET |
/{id}/logs |
Paginated immutable audit log timeline (sales_team_customer_logs), optional ?event_type= filter |
POST |
/recalculate-geolocation |
Fan-out shipping address coordinates (address_type = 'S') to level-4 route territories across all active sales teams, auto-assigning portfolios while preserving has_custom_portfolio = 'Y' overrides |
POST |
/generate-weekly-visits |
On-demand trigger for rolling next-7-day (or catch-up) portfolio_visits and customer_visits without touching past or locked visits |
POST /recalculate-geolocation){
"business_partner_address_id": 200,
"latitude": -12.0512,
"longitude": -77.0431
}
address_type = 'S') are updated via UpdateBusinessPartnerAddressLocationAction, UpdateBusinessPartnerAddressLocationByCodeAction, or UpdateBusinessPartnerAddressAction.custom_portfolio_id when has_custom_portfolio = 'Y'.America/Lima) via sales:visits:generate-weekly --days=7.fn_generate_portfolio_visits_range and fn_generate_customer_visits_range derive calendar_period = YYYYMM per date).start_date is clamped to >= CURRENT_DATE, and past or locked (seller_id IS NOT NULL / visited_at IS NOT NULL) visits are never modified.