Conversation
5e4462a to
0883fe9
Compare
| modules = _website_dependent_modules(cr) | ||
| if not modules: | ||
| return |
There was a problem hiding this comment.
You can change this html_fiels function has it will impact existing scripts.
You need a new function snippet_fields that return only the field that can contain snippets.
There was a problem hiding this comment.
Yes it will impact existing scripts, but I think, if the list is done properly, it would be better to also improve existing scripts and not only futures one? Or is that too big of a risk ?
There was a problem hiding this comment.
We can change existing scripts to use this new function when needed.
0883fe9 to
f73efd4
Compare
|
@KangOl what do you think about this solution ? |
| def _website_dependent_modules(cr): | ||
| cr.execute( | ||
| """ | ||
| WITH RECURSIVE website_dependent_modules AS ( | ||
| SELECT 'website'::varchar AS name | ||
| UNION | ||
| SELECT m.name | ||
| FROM ir_module_module m | ||
| JOIN ir_module_module_dependency d ON d.module_id = m.id | ||
| JOIN website_dependent_modules w ON w.name = d.name | ||
| WHERE m.state = 'installed' | ||
| ) | ||
| SELECT name | ||
| FROM website_dependent_modules | ||
| """ | ||
| ) | ||
| return [name for (name,) in cr.fetchall()] |
There was a problem hiding this comment.
No need to have a separated function. The CTE can be directly included in the below query.
Other issues:
- you can't always consider
websiteto be installed. - and
installedis not the correct state to check. Useutil.INSTALLED_MODULE_STATES - the starting modules are version dependent. From Odoo 19, it's
html_builder. Before, it waswebsiteandmass_mailing.
| cr, | ||
| converter_callback, | ||
| where_column="IS NOT NULL", | ||
| only_website_snippets=False, |
There was a problem hiding this comment.
Maybe we can be future-proof and use an enum instead of a boolean (this file is python3 only)
FieldScope(Enum):
ALL = 1
SNIPPETS = 2| only_website_snippets=False, | |
| scope=FieldScope.ALL, |
| SELECT model, array_agg(name) | ||
| FROM _fields | ||
| GROUP BY model |
There was a problem hiding this comment.
just for consistent order across runs
| SELECT model, array_agg(name) | |
| FROM _fields | |
| GROUP BY model | |
| SELECT model, array_agg(name ORDER BY name) | |
| FROM _fields | |
| GROUP BY model | |
| ORDER BY model |
| :param str where_column: filtering such as | ||
| - "like '%abc%xyz%'" | ||
| - "~* '\yabc.*xyz\y'" | ||
| :param bool only_website_snippets: when True, only process stored HTML fields |
There was a problem hiding this comment.
The docstring is misaligned with the scope parameter.
Ignore `mail.mail` fields. Outgoing email content doesn't need to be changed.
Sort fields to have a consistent execution across upgrades.
8a46a2c to
3cbbb13
Compare
aj-fuentes
left a comment
There was a problem hiding this comment.
Looks good. Minimal comment.
Add parameter to targetting only snippets fields. This accelerate the update by not searching on fields that cannot contain snippets, like tasks or leads. Co-authored-by: Augustin (duau) <duau@odoo.com>
3cbbb13 to
2b72f80
Compare
|
Merge method set to rebase and fast-forward. |
Ignore `mail.mail` fields. Outgoing email content doesn't need to be changed. Part-of: #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Sort fields to have a consistent execution across upgrades. Part-of: #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Add parameter to targetting only snippets fields. This accelerate the update by not searching on fields that cannot contain snippets, like tasks or leads. closes #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com> Co-authored-by: Augustin (duau) <duau@odoo.com>
Ignore `mail.mail` fields. Outgoing email content doesn't need to be changed. Part-of: #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Sort fields to have a consistent execution across upgrades. Part-of: #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Add parameter to targetting only snippets fields. This accelerate the update by not searching on fields that cannot contain snippets, like tasks or leads. closes #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com> Co-authored-by: Augustin (duau) <duau@odoo.com>
Ignore `mail.mail` fields. Outgoing email content doesn't need to be changed. Part-of: #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Sort fields to have a consistent execution across upgrades. Part-of: #399 Related: odoo/upgrade#9792 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>


No description provided.