Skip to content
Snippets Groups Projects
Commit 14e0abd1 authored by Renaud Thiry's avatar Renaud Thiry
Browse files

[FIX] mail: remove suggested recipient


When creating a recipient from composer_suggested_recipient the user
is free to modify the partner form however they want.

This can lead to them inputing data which will create a partner
that does not match the suggested partner data.
In that case the box acts as if the partner was not created.

This aims to remove the partner in such cases and warn the user.

task #3016112

closes odoo/odoo#103596

Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
parent 0e2ea5ff
Branches
Tags
No related merge requests found
......@@ -4675,6 +4675,20 @@ msgstr ""
msgid "Please complete customer's information"
msgstr ""
#. module: mail
#. openerp-web
#: code:addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js:0
#, python-format
msgid "Invalid Partner"
msgstr ""
#. module: mail
#. openerp-web
#: code:addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js:0
#, python-format
msgid "The information you have entered does not match the existing contact information for this record. The partner was not created."
msgstr ""
#. module: mail
#: model_terms:ir.ui.view,arch_db:mail.mail_bounce_catchall
msgid "Please contact us instead using"
......
......@@ -138,13 +138,26 @@ class ComposerSuggestedRecipient extends Component {
/**
* @private
* @param {object} record the newly-created record
*/
_onDialogSaved() {
_onDialogSaved(record) {
const thread = this.suggestedRecipientInfo && this.suggestedRecipientInfo.thread;
if (!thread) {
return;
}
thread.fetchAndUpdateSuggestedRecipients();
if (!this.suggestedRecipientInfo.partner) {
this.env.services.notification.notify({
title: this.env._t('Invalid Partner'),
message: this.env._t('The information you have entered does not match the existing contact information for this record. The partner was not created.'),
type: 'warning'
});
this.env.services.rpc({
args: [record.res_id],
model: 'res.partner',
method: 'unlink',
});
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment