When downloading images from Google, we check the headers of the request
to see if "image/" is defined in `Content-Type`. On some websites,
`Content-Type` is not defined, leading to a traceback because we try to
access the key in the dictionary.
opw-3349774
closesodoo/odoo#130612
X-original-commit: f6ecbbf7f72c61623a1f92571536289ffd6231b3
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
This is mostly a cleaning/refactoring change.
The current API for init hooks (pre, post, uninstall) is to pass
`cr, registry`.
But the first thing which was done by most
post init and uninstall hooks was to create an env using
the cr passed
e.g.
`env = api.Environment(cr, SUPERUSER_ID, {})`
and the `registry` argument was unused in all these hooks,
completely.
By changing the API of hooks to pass `env` instead
of `cr, registry`, we gain in average two lines in every
hooks:
- the line creating the env `env = api.Environment(cr, SUPERUSER_ID, {})`
- the line importing `api` and `SUPERUSER_ID`
Therefore removing ~250 lines of repeated code lines accross odoo/odoo and
odoo/enterprise.
In addition to these lines removed,
it also ease the API of init hooks for Odoo developers,
who are used to that `env` and not so much how to create an `env`
from a cursor.
Part-of: odoo/odoo#108254
before this commit, in the uninstall hook, the key which is trying to remove from the ir.config.parameter is not existing one.
after this commit, the google.pse.id key will get removed from the icp.
closesodoo/odoo#110724
X-original-commit: f7e44f21b99cc363b0ff572ff9a96d6d3569b1cc
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
The UserError was inadvertently removed and replaced by
`google_pse_id_is_set` variable, which is a boolean.
closesodoo/odoo#75298
Signed-off-by: Valentin Chevalier <chevalierv@users.noreply.github.com>
Users will now have a quick way to add images on their products in batches, allowing fast visual identification of them.
task-2518519
closesodoo/odoo#70198
Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>