Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail route to user alias ends up with ValueError: Mailbox unavailable - model res.users does not accept document update #29298

Closed
Perino01 opened this issue Dec 6, 2018 · 26 comments
Labels
12.0 Services Project, timesheet, helpdesk,...

Comments

@Perino01
Copy link

Perino01 commented Dec 6, 2018

Impacted versions: 12.0-20181204

Steps to reproduce: Creating user aliases according to https://www.odoo.com/de_DE/forum/hilfe-1/question/how-to-setup-email-alias-111570

Current behavior: According to https://www.odoo.com/de_DE/forum/hilfe-1/question/how-to-setup-email-alias-111570 I created aliases for all users. In this case it is firstname.lastname@mycompany.com. I checked userid from the database and did settings for Record Thread ID and Parent Record Thread ID in the alias configuration for the user.

While testing the configuration, no mails are received by the system. The mail will be sent to firstname.lastname@mycompany.com .The message in the inbox at the provider will be touched and set as read message. But the mail does not arrive to Odoo. When I check the logs I see the folloging error:

2018-12-06 05:56:20,732 844 INFO mydomainname odoo.addons.fetchmail.models.fetchmail: start checking for new emails on imap server catchall

2018-12-06 05:56:21,661 844 INFO mydomainname odoo.addons.mail.models.mail_thread: Routing mail with Message-Id <AM4PR0801MB2740F9DCF5C7CAC9311F0916EEA90@AM4PR0801MB2740.eurprd08.prod.outlook.com>: route ('res.users', 18, {}, 2, mail.alias(7,)): model res.users does not accept document update, fall back on document creation

2018-12-06 05:56:21,661 844 INFO mydomainname odoo.addons.mail.models.mail_thread: Routing mail with Message-Id <AM4PR0801MB2740F9DCF5C7CAC9311F0916EEA90@AM4PR0801MB2740.eurprd08.prod.outlook.com>: route ('res.users', 18, {}, 2, mail.alias(7,)): model res.users does not accept document update; skipping

2018-12-06 05:56:21,661 844 INFO mydomainname odoo.addons.fetchmail.models.fetchmail: Failed to process mail from imap server catchall.

Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/odoo/addons/fetchmail/models/fetchmail.py", line 178, in fetch_mail

    res_id = MailThread.with_context(**additionnal_context).message_process(server.object_id.model, data[0][1], save_original=server.original, strip_attachments=(not server.attach))

  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 1418, in message_process

    routes = self.message_route(msg_txt, msg, model, thread_id, custom_values)

  File "/usr/lib/python3/dist-packages/odoo/addons/mass_mailing/models/mail_thread.py", line 33, in message_route

    return super(MailThread, self).message_route(message, message_dict, model, thread_id, custom_values)

  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 1273, in message_route

    update_author=True, assert_model=True, create_fallback=True)

  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 1047, in message_route_verify

    self._routing_warn(_('model %s does not accept document update') % model, _('skipping'), message_id, route, assert_model)

  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 946, in _routing_warn

    raise ValueError(short_message)

ValueError: Mailbox unavailable - model res.users does not accept document update

2018-12-06 05:56:21,778 844 INFO mydomainname odoo.addons.fetchmail.models.fetchmail: Fetched 1 email(s) on imap server catchall; 0 succeeded, 1 failed.

Expected behavior: Mail will be fetched by the system and will be routed to the right user according to the user alias.

Video/Screenshot link (optional):

@Yenthe666 Yenthe666 added Services Project, timesheet, helpdesk,... 12.0 labels Dec 6, 2018
@pedrobaeza
Copy link
Collaborator

Hi @Perino01, you can't make an alias with a model without chatter - res.users in this case -. You should do it to res.partner instead.

Closing this then as no issue, but constraint on the use, and for further questions, please refer to the forums instead.

@Bartii
Copy link

Bartii commented Feb 13, 2019

Hi @pedrobaeza . I think this is not a solutions. AFAIK it is not possible to configure alias to get email in user inbox using res.partner. Configuration described by @Perino01 works well in v11, but not in v12, so I think it should be considered as a bug in v12.
Regards.

@pedrobaeza
Copy link
Collaborator

pedrobaeza commented Feb 14, 2019

As said, a model without chatter can't be the target, so if it was working was due to a series of fortunate coincidences.

@Bartii
Copy link

Bartii commented Feb 28, 2019

@pedrobaeza , sure, you're right from technical point of view. In fact business functionality is affected: users cannot receive emails from outside world, because it is not possible to configure alias for user to handle emails in inbox.

@cod-odoo
Copy link
Contributor

@pedrobaeza your solution is right and its seems working perfectly, but it's cause security issue because any user can see messages from contact's chatter. so how can solve this so any user can not read message of other user from chatter.

@pedrobaeza
Copy link
Collaborator

The approach of Odoo is to not have "private" messages this way, as this is not corporate expected behavior. Anyone that can access the contact should see that messages for following the possible discussions. Any way, it's also an error in my opinion to generate a discussion around the contact itself. Use the proper document for that: lead, sales order, purchase order, task...

@cod-odoo
Copy link
Contributor

@pedrobaeza In real case e.g we have 10 users and all can access contact.
all user have its own alias set. so if anyone send email to alias like user1@mycompnay.com that will directly goes to contact's chatter and that can be read by all users and its not right as concern of security.
as you propose solution like "Use the proper document for that: lead, sales order, purchase order, task..." but we cannot create lead or any of documents because that message directly concern to that user only

@pedrobaeza
Copy link
Collaborator

Then use chat for internal users.

@kh-badep
Copy link
Contributor

This is related to the commit a6c187a#diff-e10cece4f5d4b42029916523b610477f where the methods that delegated the message posting to the related models were removed.
As @pedrobaeza said, since res.users inherits res.partner and thus mail.thread by delegation, it does not have proper handling of messaging but rather relays the methods to the related partner (or in appropriate cases employee).
This change, although functionally restricting for some of us can easily be reverted by a custom module. What I don't understand however is why alias_id and alias_contact were kept in res.users since they don't have a functional purpose anymore. Shouldn't they be removed altogether? alias_id's help even says:

Email address internally associated with this user. Incoming emails will appear in the user's notifications.

Which is understandably confusing.

@pedrobaeza
Copy link
Collaborator

pedrobaeza commented Jul 17, 2019

They appear due to inheritance by delegation that puts as related fields all the fields from the parent model, so it's only a side effect.

@kh-badep
Copy link
Contributor

@pedrobaeza I was more referring to the explicite definition in the view. I'm not entirely sure but I think it's not needed anymore.

For everyone else that need this behavior I just threw together a small module that restores it in v12. It even adds a button to quickly create an alias with proper parameters. Please be wary that since this commit you have to keep the user notification as 'Inbox'.
Link to module: https://github.com/BADEP/addons/tree/12.0/mail_user_alias

@pedrobaeza
Copy link
Collaborator

Yes, it seems the fields in the view are a remnant that was forgotten to be removed.

@Perino01
Copy link
Author

@pedrobaeza Today I've tried your small module from your last comment in this threat. I cannot see any changes at the moment. I still don't get the email in my Inbox and I do not see the new button to quickly create an alias with proper parameters, where should this button be? What do you mean wiith keep the user notification as 'Inbox'? do you mean the Option Notification 'Handle by Emails' in Users details?

@pedrobaeza
Copy link
Collaborator

Sorry, it's not my module, and I discourage to use it. Use chat for users communication. You must ask or communicate anything in its repo, not here.

@Perino01
Copy link
Author

Perino01 commented Oct 22, 2019

Sorry for that, you are right!
@pedrobaeza: You know that hundreds of users are straggeling with the mail issue of Odoo. Could you explain how the chatter has to be right configured that users messages will arrive direct to the inbox? Or do you have a link where users can read and understand Odoo V12 mail methodology? There are lots of information in the net, but nearly all information explains wrong settings especially for older Versions. Furhermore no solutions available. Thx

@quiero
Copy link

quiero commented Nov 12, 2019

Let me guess it. They made this breaking change so that they can promote their highly valuable piece of enterprise functionality better.
@pedrobaeza This is a shame, Pedro.
I would very appreciate your explaining a way to configure an alias linked to the user's personal inbox if any.

@pedrobaeza
Copy link
Collaborator

They made this breaking change so that they can promote their highly valuable piece of enterprise functionality better.

That's not true, @quiero. I have already explained why in #29298 (comment)

This is not Outlook/Thunderbird/Gmail. This is an enterprise communication system.

Enterprise doesn't have this option as well. There's no way to do it, so no possible explanation.

Not sure if you are Spanish (due to your login), but if so, see also this video of a presentation I made on "Spanish Odoo Days" about the paradigm of communication with Odoo:

https://www.youtube.com/watch?v=3oid-JOeK8M

@quiero
Copy link

quiero commented Nov 12, 2019

@pedrobaeza This is a false statement, Pedro. The fact is you just cut a piece of communication functionality in favor of some fluffy paradigm.

You're cutting it little by little all along the way and this is kinda normal for you as I see. And the fact it is not YET a part of some valuable enterprise addon has to do with your fear, but not vision..

Could you please just fix this issue rather than teaching us paradigms, lol

@pedrobaeza
Copy link
Collaborator

I'm not an Odoo employee, so I don't have nothing to fix, and as said, this is not going to be fixed because of the paradigm. If you don't like it, you can move to Outlook + Excel + Access as your management system 😝

@quiero
Copy link

quiero commented Nov 12, 2019

@pedrobaeza Oh, thanks for collaboration. You're a collaborator, aren't you? What an advice! Bravo!

@Perino01
Copy link
Author

Perino01 commented Nov 12, 2019

@pedrobaeza You know, that's not true, and it has nothing to do with Excel, Access, etc. Most of CRM/ERP Systems provide a full collaboration/communication interface. ;-)

@pedrobaeza
Copy link
Collaborator

And this one does, but without individual mailboxes per se, as it's a nonsense in an enterprise environment.

@quiero
Copy link

quiero commented Nov 12, 2019

@pedrobaeza Tell us by what kind of authority you're here to decide what is nonsense and what is not. Clearly this is a feature many of us used in the previous versions. Who are you to decide for us what we would employ?

This is a bit Microsoftish, isn't it? which makes you a good candidate for an Outlook team, lol
not Odoo

@pasgou
Copy link

pasgou commented Feb 8, 2020

What about click the "discuss" box in the "res.users" model and configure aliases?

@Agacolor
Copy link

Not being able to divert messages to individual mailboxes anymore is not an improvement indeed.
e.g. A client wants the contents of a webform submitted straight to an internal mailbox without having to use an external mail service like gmail for reasons of privacy and security. They are on odoo saas so not able to use a third party module either.
Not every Odoo user is an "enterprise / corporate" user.

@cvinh
Copy link

cvinh commented Dec 30, 2020

cc @LuceEasyPme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
12.0 Services Project, timesheet, helpdesk,...
Projects
None yet
Development

No branches or pull requests

10 participants