In 599bd509 for inline image in a mail the `Content-Id` of the
attachment was used as the file name to avoir an issue of several inline
images with the same name only displaying the first one.
This solved the issue but with it the file name when downloading the
image were lost as well as the extension which can be an issue.
This changeset refactor the code so the behavior stay the same but the
original file names are kept.
opw-725305
Currently check of alias security is directly embedded in mail.thread
routing method. In this commit we move this check in the mail.alias.mixin
class itself. Doing this allows models to extend or improve the behavior
depending on how inheriting models use aliases.
Fix some dead code. This is a fallback for linking mail attachment with
its data. The issue was not reported since a long time since this just
disable a fallback which in my tests was not used anyway.
opw-710502
When computing default recipients to mail on some records, take into
account models having a partner_email field. Indeed this method checks
for some commonly-used partner or email fields to find recipients.
This allows to avoid having custom methods in each model. This commit
adds support for partner_email email field used notably in event and
track management.
Currently if an user mentions someone in an internal note he is not
notified of any reply as replies create internal notes. This commit
ensure the author of the first note is notified of the reply even
if it is still an internal note.
Tests have been updated accordingly.
A couple of places in the processing of bounces only
accepted a single matching partner. But there could
be multiple partners matching an email address, and
we should handle them all.
There might also be no matching `bounced_thread_id`
matched by the regex, so we should guard against a
bounced_thread_id == None.
This partially reverts commits 5d746d0ac6 and
73de86c768.
The tightening of access rights was too strong: regular users need to be able
to read models and fields (to create an email templace, for instance.)
[FIX] ir_values: in `get_actions`, exclude field `code`
Remove unrestricted "read" access. To make code internally using `ir.model`
work, add a private method `_get` on `ir.model` to retrieve the record
corresponding to a model name, without access rights issue.
Change signature of method `get_authorized_fields` to make it use a model name
instead of a model id. This removes the necessity of a search on `ir.model`.
Posting on a document not inheriting from mail_thread was impossible
due to several crashes or wrongly set variables. Some cleaning is planned
in those methods as there are a lot of unnecessary computation. This will
be done in another commit. Probably.
Before this commit, 'select all' into a list view, and use an action that assign
a user_id to all the records will send n² email, because the function send_mail
use active_domain instead of the current record.
Now, we keep mass_mail mode, but simulate the case where we have clicked on
each record one by one and not all the records matching the active_domain.
So we send only one email by record.
How to reproduce:
create a action server "record.write(dict(user_id=env.user_id))"
add this action in context menu
select all records in a list and apply the action server
When you write on user_id in a model, that will automatically send an email
to the new user_id assigned.
In case where it is write in batch, that can be considered as spam.
In some case, the user will be aware from another way that with this email.
When Odoo sends emails their Message-Ids are either generated by Odoo or
use the original Message-Id in the case of an incoming email going through
the mail gateway.
When the mailgateway handles replies to those emails it checks their
References or In-Reply-To in order to find matching Message-Ids and find
the reply's parent. Currently it is limited to Message-Ids matching the Odoo
pattern. However if an external email began a discussion thread, references
will not hold any odoo-like pattern.
Previously to commit 0028c42136 this was hidden due to a bug when
managing private messages. This code was also managing replies to external
emails due to a probably undesired side effect.
Correct way of checking if an incoming email is a reply to a thread is to
check that References or In-Reply-To Message-Ids match some stored Message-Ids
of mail.message. They don't have to match Odoo patterN
ir.needaction_mixin is not used anymore by the webclient.
From 9.0, the concept has changed: this feature is now
available in mail module, with the mail.thread mixin,
and message_neeadction field.
Remove all code handeling needaction bullet and
counter on ir.ui.menu, knowing that since 9.0
webclient does not display the counter anymore.
This code was, thus, useless and some RPC calls
were done for nothing, and adapt accounting
reconcialiation widget.
As this button leads to a void form view without context it is not
really usefull. As creating new records is achieved using aliases
there is no real need for a New Task/Issue/Note button.
mail/new controller is kept for compatibility but should be removed
before v11.
Old versions of Odoo did not correctly manage message_id of mail messages.
Thread formation was based on information present in References and/or in
In-Reply-To of replies to emails. Message-Ids could contain model and
res_id of a record. Thread formation was done using this information.
However commit 8253453d64 fixed that behavior
by correctly checking in existing mail_messages to find matching message-ids.
Message found was set as parent and thread formation was correctly done without
collision or possible issues with badly formatted Message-Ids.
A compatibility mode was introduced at the same time to handle previous versions
of Odoo. This commit removes this compatibility as it was done long enough
to ensure compatibility is not required anymore.
[TESTS] mail: tests updated, compat mode should raise in all cases now
Move code related to redirection in its own class method. This way all
controllers perform their own actions and checks before calling the
redirection itself. Moreover it is necessary for some controllers to be
able to call the redirection independently outside of the mail/view
controller scope.
This commit also fixes some links generated for mail notification email
buttons. Assign and (un)follow buttons now effectively use the link helper
when generating the associated URL instead of manually crafting it.
Custom routes for notification buttons used in HR and CRM are added.
Indeed in order to be able to fine-tune the behavior called by those
buttons, using dedicated controllers is simpler than trying to use
a generic one. As there are few custom buttons in notification emails
using dedicated controllers does not lead to a code overhead.
When changing tracking mecanism in v9 'always' tracked fields lost their meaning.
They were managed like 'onchange' fields. This commit sets the old behavior back.
* 'onchange' fields are displayed in tracking every time they change
* 'always' fields are displayed in tracking every time they change or whenever
other tracking exist; those are used to display some contextual
information
There is now a single method easier to inherit to add specific behavior
for the display of access button as well as actions buttons. All addons
using this mechanism are updated accordingly.
* Assign controller now effectively redirects to mail/assign instead of
mail/assign
* Follow and Unfollow button now uses the helper that generated the link
If the 'To' of an incoming email is an alias on another model we now consider
this emails as a forward to a new alias. A use case for this is an email on
a task that should be considered as an issue and forwarded to another alias.