multi-company
multi-company copied to clipboard
[16.0][IMP] mail_multicompany: add company field in incoming mail servers
This commit adds a company_id field to the fetchmail.server model. Then uses this field, in the mail.thread message_process overwritten method, to correctly set the company on the environment when fetching mails.
This change is needed because when fetching the mails with an scheduled action, in an odoo database with multiple companies and multiple outgoing and incoming mail servers, the outgoing mail server of the fetched messages is not being correctly chosen, as the self.env.company is not necessarily the same as the company of the record where the message has to be posted to.