odoo/odoo#258133
Created by Website, Julien Launois (jula)
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Overridden by @beledouxdenis
- ci/l10n: (runtime 22s)
- label
- odoo-dev:master-AI-website-builder-baar
- head
- 58444f593a00a451b67e9e64694c61ac4865f461
- merged
- 1 day ago by Fun Services, Panagiotis Kyriakou (paky)
| odoo/odoo | odoo/enterprise | |
|---|---|---|
| master | #258133 | #106196 |
[IMP] html_editor, web_unsplash, website: AI Website Builder tweaks
Few tweaks for the AI Website Builder assistant enterprise PR: odoo/enterprise#106196
[IMP] web_unsplash: take Unsplash request out of the controller
In ai_website, we need to make an Unsplash request from inside an
agent tool. However we can't call a controller method from a model.
Fix
- Extract _fetch_unsplash_images into ir.attachment to make it
callable from other models.
- Make the requests.get call safer by adding a timeout, filtering the
payload keys and putting the access key in Authorization header.
- Replace the useless request variable uses with self
- Add some constant for the Unsplash ICP keys
[IMP] website: make defineMailModels optional in defineWebsiteModels
In some case, we need to use defineWebsiteModels without defining the
mail models at the same time.
For example, in ai_website we call defineAIModels which is
defining the mail model DiscussChannel differently.
Fix
A new parameter (i.e.includeMailModels) is added to be able to prevent
the call to defineMailModels when needed.
[IMP] html_editor, *: make attachment_create usable in models
*: web_unsplash
Before commit
_attachment_create was a private method in the HTML_Editor
controller that can only be called within a controller context as it
uses the request variable.
After commit
Make attachment_create a standalone function that can be imported and
used from a model such as AI tools in ai_website.