75 lines
2.3 KiB
Markdown
75 lines
2.3 KiB
Markdown
# Google Map Review — Odoo 19 Custom Module
|
|
|
|
**Author:** Suherdy Yacob | **Version:** 19.0.1.0.0
|
|
|
|
## Overview
|
|
|
|
Integrates the Google Business Profile API into Odoo 19 to automatically crawl
|
|
customer reviews for each branch company and display them as structured records.
|
|
|
|
## Features
|
|
|
|
- `google_business_id` field on `res.company` (Google Business Location ID)
|
|
- Hourly scheduled cron fetching reviews via **Google Business Profile API (My Business v4)**
|
|
- Review records with: author, rating (★★★★★), text, owner reply, date, language
|
|
- List / Form / Kanban reporting views
|
|
- Smart button on company form showing review count
|
|
- General Settings section for OAuth2 credentials (Client ID, Client Secret, Refresh Token)
|
|
|
|
## Authentication Strategy
|
|
|
|
Uses **OAuth2 refresh token** stored in Odoo General Settings.
|
|
The cron exchanges the refresh token for a fresh access token on each run — no browser needed.
|
|
|
|
## One-Time Setup
|
|
|
|
### 1. Google Cloud Console
|
|
|
|
1. Create/select a Google Cloud project.
|
|
2. Enable: **My Business API**, **Business Profile API**.
|
|
3. Create an OAuth 2.0 Client ID (Desktop or Web app type).
|
|
4. Note the **Client ID** and **Client Secret**.
|
|
|
|
### 2. Get Refresh Token
|
|
|
|
Run `authorize.py` from the `google_map_review` standalone project on any machine with a browser:
|
|
|
|
```bash
|
|
cd /path/to/google_map_review
|
|
python authorize.py
|
|
```
|
|
|
|
Copy the `refresh_token` value from the generated `token.json`.
|
|
|
|
### 3. Configure Odoo
|
|
|
|
Go to **Settings → General Settings → Google Business Reviews**
|
|
Enter Client ID, Client Secret, and Refresh Token → Save.
|
|
|
|
### 4. Set Place ID on Each Branch
|
|
|
|
Run `list_locations.py` to find location IDs, then:
|
|
**Settings → Companies → [Company] → Google Reviews tab → Google Business Place ID**
|
|
|
|
### 5. Run the Crawler
|
|
|
|
Runs automatically every hour, or trigger manually:
|
|
**Settings → Technical → Scheduled Actions → Google Reviews: Fetch from Business Profile API → Run Manually**
|
|
|
|
## Views
|
|
|
|
| Menu | View |
|
|
|------|------|
|
|
| Google Reviews → All Reviews | List (color-coded by rating) |
|
|
| Google Reviews → By Branch (Kanban) | Kanban grouped by company |
|
|
| Company form → Smart button | Filtered list for that branch |
|
|
|
|
## Dependencies
|
|
|
|
- Odoo modules: `base`, `mail`
|
|
- Python: `requests` (standard in Odoo)
|
|
|
|
## License
|
|
|
|
LGPL-3
|