Skip to content

Commit e22930f

Browse files
committed
[ADD] product_images: add a tutorial to get automatically images for products
task-2558054
1 parent 76cfe25 commit e22930f

File tree

6 files changed

+208
-0
lines changed

6 files changed

+208
-0
lines changed

content/applications/general.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Miscellaneous
1313
general/calendars
1414
general/in_app_purchase
1515
general/developer_mode
16+
general/product_images
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
==============
2+
Product images
3+
==============
4+
5+
The integration with **Google Custom Search API** is a feature that allows finding images
6+
automatically for your product, based on their barcode.
7+
8+
.. _product_images/configuration:
9+
10+
Configuration
11+
=============
12+
13+
This functionnality requires configuration both on Google and on Odoo.
14+
15+
Google includes 100 free requests per day (about 100 images if all of them are found). To enable
16+
up to 10K requests per day, you need to configure your Google account to do so.
17+
18+
.. seealso::
19+
- `Create, modify, or close your Cloud Billing account
20+
<https://cloud.google.com/billing/docs/how-to/manage-billing-account>`_
21+
22+
.. _product_images/google-api-dashboard:
23+
24+
Google API dashboard
25+
--------------------
26+
27+
#. Go to `Google Cloud Platform <https://console.developers.google.com/>`__ API & Services page
28+
to generate Google Custom Search API credentials. Log in with your Google account.
29+
30+
#. Select or create an API project to store the credentials if not yet done
31+
before. Give it an explicit name (e.g. Odoo Images).
32+
33+
#. In the credentials section, click on Create Crendentials and select **API Keys**.
34+
35+
.. image:: product_images/google-images-credentials00.png
36+
:align: center
37+
38+
#. Save it, you'll need it for the next step in Odoo !
39+
40+
#. Use the search bar to find for *Google Custom Search API* and select it.
41+
42+
.. image:: product_images/google-images-credentials01.png
43+
:align: center
44+
45+
#. Enable the API.
46+
47+
.. image:: product_images/google-images-credentials02.png
48+
:align: center
49+
50+
.. _product_images/google-pse-dashboard:
51+
52+
Google Programmable Search dashboard
53+
------------------------------------
54+
55+
#. Go to `Google Programmable Search Engine <https://programmablesearchengine.google.com/>`__ and
56+
click on Get Started. Log in with your Google account.
57+
58+
.. image:: product_images/google-images-credentials03.png
59+
:align: center
60+
61+
#. Fill the language and the name of the search engine. Give it an explicit name
62+
(e.g. Odoo Images).
63+
64+
.. note::
65+
Google doesn't allow to create a search engine without having entered at least one specific
66+
site to search on. You can put any website (e.g. www.google.com) for this step, we will
67+
remove it later.
68+
69+
#. Validate the form by clicking on Create. Then, go to the edition mode of the search engine
70+
that you created (either by clicking on Control Panel button on the confirmation page or by
71+
clicking on the name of your Search Engine on the Home page).
72+
73+
#. In the basics tab, make sure to enable Image search, SafeSearch and Search the entire web.
74+
75+
.. note::
76+
Once Search the entire web enabled, you can safely delete the site that you previously
77+
entered at the previous step.
78+
79+
#. Save your **Search Engine Id**.
80+
81+
.. tip::
82+
You can easily save your Search Engine ID by clicking on the Copy to clipboard button next to
83+
it.
84+
85+
.. _product_images/setup-in-odoo:
86+
87+
Odoo
88+
----
89+
90+
#. Go to :menuselection:`Settings --> General Settings --> Integrations`,
91+
activate **Google Images** and save.
92+
93+
#. Go back to :menuselection:`Settings --> General Settings` and enter your **API Key** and
94+
**Search Engine ID** in Google Images option.
95+
96+
#. The setup is now ready.
97+
98+
.. _product_images/get-product-images:
99+
100+
Automatically get your product images in Odoo
101+
=============================================
102+
103+
The action to automatically get your product images in Odoo appears in any Products or Product
104+
Variants list view. Here is a step-by-step guide from the Inventory app.
105+
106+
#. Go to :menuselection:`Inventory --> Products --> Products` or :menuselection:`Inventory -->
107+
Products --> Product Variants`.
108+
109+
#. On the list view, select the products that needs an image.
110+
111+
.. important::
112+
Only the 10K first products or product variants selected will be processed.
113+
114+
.. note::
115+
Only the products or product variants with a barcode and without an image will be processed.
116+
If you select a product that has one or more variants from the Products view, each variant
117+
matching the previous criteria will be processed.
118+
119+
#. In the action menu, select the option *Get Pictures from Google Images* and validate by clicking
120+
on *Get picture*.
121+
122+
#. You should see your images appearing in the next few minutes.
123+
124+
.. note::
125+
Only the 10 first images are fetched immediatly. If you selected more than 10, the rest will
126+
be fetched as a background job, so you can continue doing your work while illustrating your
127+
products.
128+
129+
The background job process about 100 images in a minute. If you reach the quota authorized
130+
by Google (either with a free or a paid plan), the background job will put itself on hold
131+
for 24 hours and continue right where he stopped the day before. Any other background task
132+
with a more important weight (e.g. payment post-processing job) will be executed in priority
133+
and might extend the processing time.
134+
135+
.. _product_images/faq:
136+
137+
Troubleshooting
138+
===============
139+
140+
Here are the most frequently asked questions about this feature. Feel free to add more questions
141+
(with their answers, of course !) by editing this page on Github.
142+
See :ref:`contributing/github-interface` for additional help.
143+
144+
.. _product_images/less-quality-or-not-found:
145+
146+
Images have less quality than I expected, or are not found
147+
----------------------------------------------------------
148+
149+
* Check if the barcode is correct (Avoid whitespaces, hypen, dots...).
150+
151+
* Do manually a research on Google Images and compare the results. If you find better results than
152+
in Odoo, also check your `Google Programmable Search Engine
153+
<https://programmablesearchengine.google.com/>`__.
154+
155+
.. note::
156+
The first picture found that corresponds with our criteria is saved. No matter how many times
157+
you execute the action, you should get each time the same picture, unless results have changed
158+
on Google's side. There are the criteria used when making a request to Google:
159+
160+
* Safe mode is activated
161+
* Image size is large
162+
* Image type is photo
163+
* Search type is image
164+
165+
Currently, you can't change those variables. They can impact the result for less popular
166+
products but should greatly improve results on a large scale.
167+
168+
.. _product_images/errors:
169+
170+
Possible errors
171+
---------------
172+
173+
Most of the errors that you might encounter are very explicit and should be easy to resolve.
174+
However, here are a few tips on what you can do in those cases.
175+
176+
.. _google-cs-api: https://console.cloud.google.com/marketplace/product/google/customsearch.googleapis.com
177+
178+
+----------------------------+--------------------------------------------------------------------+
179+
| UserError | Solution |
180+
+============================+====================================================================+
181+
| Another task is already | It means that for some reason, the job is scheduled but has been |
182+
| scheduled to pick the | delayed. In that case, your selection is saved and images will be |
183+
| images on Google on *Date*.| fetched on *Date*. If you want to cancel the task, you have to go |
184+
| | into debug mode. Then, go to :menuselection:`Settings --> |
185+
| | Technical --> Scheduled Actions Triggers` and delete it. Keep in |
186+
| | mind that, by deleting the trigger, you will cancel the task but |
187+
| | not erase the selection. If you launch the task again with more |
188+
| | than 10 Products or Product Variants selected, the old selection |
189+
| | will also be processed at the same time. |
190+
+----------------------------+--------------------------------------------------------------------+
191+
| You didn't configure | You may have forgotten to save after entering the parameters in |
192+
| properly your **API Key** | the Settings. |
193+
| or **Search Engine ID**. | |
194+
+----------------------------+--------------------------------------------------------------------+
195+
| There isn't any product | Check your selection of Products. If any Products or their variants|
196+
| without a picture and | already have a picture, they won't be processed. Also, check if you|
197+
| with a barcode. | well entered a barcode. |
198+
+----------------------------+--------------------------------------------------------------------+
199+
| Custom Search API is not | Check that you have enabled the Custom Search API in your Google |
200+
| enabled in your Google | project either by visiting the link displayed in the error in Odoo |
201+
| project. | or by checking the `Google Cloud Platform <google-cs-api_>`_ Custom|
202+
| | Search API page. |
203+
+----------------------------+--------------------------------------------------------------------+
204+
| Your **API Key** or | Check if you properly configured the **API Key** and/or the |
205+
| your **Search Engine ID** | **Search Engine ID** in Odoo. A common mistake is to invert these |
206+
| is incorrect. | variables. |
207+
+----------------------------+--------------------------------------------------------------------+
23.3 KB
Loading
4.6 KB
Loading
9.5 KB
Loading
28.6 KB
Loading

0 commit comments

Comments
 (0)