google_map_review/README.rst
2026-06-11 14:13:20 +07:00

109 lines
3.0 KiB
ReStructuredText

Google Map Review
=================
**Author:** Suherdy Yacob
**Version:** 19.0.1.0.0
**Category:** Reporting
Overview
--------
This module integrates the Google Business Profile API into Odoo 19.
It automatically crawls customer reviews for each branch company and
displays them as structured records inside Odoo.
Features
--------
- Google Business Place ID field on each ``res.company`` record
- Hourly scheduled cron (configurable) to fetch reviews via the
Google Business Profile API (My Business API v4)
- Review records stored and linked to each branch company
- Owner reply stored alongside each review
- List, Form, and Kanban reporting views
- Search filters: by branch, rating, date range, reply status
- Group-by: branch, rating, month, language
- Smart button on company form showing review count
- General Settings section for OAuth2 credentials
Authentication Strategy
-----------------------
The module uses OAuth2 with a long-lived **refresh token** stored in
Odoo's General Settings. This allows the headless cron job to obtain
fresh access tokens without any browser interaction.
One-Time Setup
--------------
Step 1 — Google Cloud Console
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Create (or use existing) Google Cloud project.
2. Enable: **My Business API**, **Business Profile API**.
3. Go to **APIs & Services → Credentials → Create OAuth 2.0 Client ID**
(Application type: Desktop app or Web app).
4. Download or note your **Client ID** and **Client Secret**.
Step 2 — Obtain Refresh Token
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run the existing ``authorize.py`` script from the
``google_map_review`` standalone project on any machine with a browser::
cd /path/to/google_map_review
python authorize.py
After completing the OAuth2 flow in the browser, open the generated
``token.json`` file and copy the ``refresh_token`` value.
Step 3 — Configure Odoo
~~~~~~~~~~~~~~~~~~~~~~~~~
1. Go to **Settings → General Settings → Google Business Reviews**.
2. Enter **Client ID**, **Client Secret**, and **Refresh Token**.
3. Click **Save**.
Step 4 — Set Place ID on Each Branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Run ``list_locations.py`` to list all your Google Business locations.
2. Open each company in **Settings → Companies**.
3. Go to the **Google Reviews** tab.
4. Paste the Location ID into **Google Business Place ID**.
5. Save.
Step 5 — Run the Crawler
~~~~~~~~~~~~~~~~~~~~~~~~~
The hourly cron runs automatically. To run it manually:
1. Go to **Settings → Technical → Scheduled Actions**.
2. Find **Google Reviews: Fetch from Business Profile API**.
3. Click **Run Manually**.
Reporting
---------
Access reviews via the **Google Reviews** top-level app menu:
- **All Reviews** — list view with color-coded rows (green=5★, red=1-2★)
- **By Branch (Kanban)** — kanban grouped by company, showing star ratings
Filter and group by rating, branch, month, or language directly from
the search bar.
Dependencies
------------
- ``base``
- ``mail``
- Python ``requests`` library (standard in Odoo environment)
License
-------
LGPL-3