Only the add_sign from notif_values is usefull for a resend. We can consider
that a mail on resend can be delete in every case, and we can find the
model_description from model since a resend can only be performed on
message linked to a model.
The other notif_values are now parameter in order to ease the understanding
of what can transit through this flow.
Task: #1860054
PR: #25622
Purpose of this commit is to enhance quality of templates proposed by Odoo
and make them use notification layout when send by emails. Those emails
are cleaner and more up to date compared to other emails.
Including
* calls to message_post now use the light notification layout. It is
given as parameter to the message_post process;
* some cleaning in templates;
This commit is related to task ID 51122 (and PR #24052).
update_goals is called through the 'Run Goal Challenge Checker'
cron, potentially on a large amount of goals.
With self containing ~400k records a worker has been observed to use
~3.4 GiB. With sensible memory limits this will probably cause the
worker to be killed.
To avoid this turn of prefetching in this initial loop. Performance
shouldn't be affected too much because in the following loop
prefetching for goals will still take place per definition.
opw-1840666
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.
All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.
Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.
Also removed some dead code or improved the API to remove unnecessary
conversions.
In the curent behaviour, the users of the challenge are ordered
regardless of the goal definition (higher wins or lower wins).
This impacts the report email with the podium of users and always puts higher on top.
This fix changes the ordering depending on the goal definition type.
In Python 3:
* various builtins and dict methods were changed to return
view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
removed altogether
This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).
Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.
issue #8530
The field user_domain allow to get the list of users for which a
challenge is applied. The javascript framework for a char_domain widget
sends a JSON list to the server, but the server saved it as a string in
a Char field.
Hence we can have a list (in values received by write or create) or a
string (when getting the field value of a record).
Since 0c649644db this caused an error when user_domain was not empty.
This commit solves it by having _get_challenger_users always receiving a
string.
opw-708177
Give some details about the badge: its description, its image, who granted
it, ... Otherwise it is quite complicated to understand the email content.
Thanks to @mart-e who reviewed and tested.
If render_template get list and not id, a dict is returned.
Force the param to be a int, allow to don't use the multimode from render_template.
Avoid to get message like:
<p>{1: u'\n </p><p>Congratulation, you have received the badge <strong>Autobiographer</strong> !\n </p>\n\n'}
<p>{2: u'\n </p><p>Congratulation, you have received the badge <strong>Autobiographer</strong> !\n </p>\n\n'}
<p>{3: u'\n </p><p>Congratulation, you have received the badge <strong>Student</strong> !\n </p>\n\n'}
<p>{4: u'\n </p><p>Congratulation, you have received the badge <strong>Supporter</strong> !\n </p>\n\n'}