odoo
odoo copied to clipboard
[IMP] hr,{test_}mail{_group}: warn user when alias model creation fails
Warn user and alias responsible when model creation fails on incoming message.
Alias custom default values that references archived or deleted records can prevent the record to be created when receiving an email. Unfortunately, correcting values on the fly has too many downsides:
- as the value cannot come from nowhere, we would probably end up with corrupted record like a task without a project
- as errors are silent, lots of suboptimal record could be created before it is corrected
- as the code would have to deal with different kind of updates, it would be heavily depend on the framework meaning additional maintenance cost
- the attempt made had also a performance cost by using savepoint which we want to avoid
For all those reasons, we have decided to warm the user rather than trying to solve the problem automatically. The users are warned:
- through a bounce email sent to the sender and alias responsible
- in the alias interface through an alias status present in the list and the form view
Technical notes:
- They are multiple kind of errors: error in the message (ex.: user not authorized to send to a specific alias), error in the alias (ex.: dangling reference in alias_defaults), other error (ex: technical error like a service unavailable when receiving the message). Here, we want only to detect alias error and skip other errors. So rather than doing a big try except around _message_route_process, we have selected the spot where we should detect alias error: -- in _alias_get_error_message where we distinct a message error from an alias error -- in inside _message_route_process where record are created using alias_defaults (custom values with reference to record that might have been deleted since the alias creation)
Task-2675209
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
-- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
@pyduf Hi :)
First batch of comments, good work overall :)
Thanks for the review; I have updated the code following your comments.
@robodoo override=ci/security
Reason: usage of Markup to generate html blobs.used to generate outgoing emails.
@robodoo r+