Search 1.9 billion lines of Odoo code on GitHub

mail_company_domain

Author: Camptocamp,Odoo Community Association (OCA)
License: AGPL-3
Branch: merge-branch-1995-10.11.0
Repository: camptocamp/web
Dependencies: mail
Languages: Python (169, 75.1%), and reStructuredText (56, 24.9%)

<img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> <a name="multi-company-domains"></a> <h2>Multi Company Domains</h2> <p>Allow to have different email aliases for the different companies. This module has not been published because it there is no good way to do that in a safe way. A lof of methods are overriden, and it should work for the addons used in this project. But installing a new addon might add a new uncovered path.</p> <p>Also, there is a limitation for the emails which are received but not accepted, a bounce email is returned, but we have no way to know which alias domain should be used for the returning message, so the alias of the user's company running the fetchmail will be used.</p> <a name="usage"></a> <h3>Usage</h3> <p>The alias domains are stored in a new model <code>mail.catchall.domain</code>. However, there is no menu to configure them: you should edit the parameter in the normal Settings Parameter menu when you are connected with the company you want to configure.</p> <a name="limits"></a> <h3>Limits</h3> <p>There is a lot of places where the domain is used and there no obvious way to find which domain should be used.</p> <p>What this module tries to do is:</p> <ul class="simple"> <li>if there is a related record (mail.message, ...) and this record has a company, then use the domain associated to this company</li> <li>if there is no related record or no company on the related record, it uses the domain of the company associated to the current user</li> <li>for some models which are likely to be used by crons and hence it cannot rely on the current user (mail.message, mail.alias), it adds a company_id field initialized with the company of the user that creates it</li> </ul> <a name="rejected-messages"></a> <h4>Rejected messages</h4> <p>When an email is received and Odoo tries to find a thread to attach it, it might reject the email for different reasons (only the followers can answer for instance). In that case, we don't know which domain should be used. (This is in <code>MailThread.message_route_verify</code> and <code>MailThread._routing_create_bounce_email</code>).</p> <a name="parameter-group"></a> <h4>Parameter group</h4> <p>There is no possibility to set a group on the configuration parameter <code>mail.catchall.domain</code>.</p> <a name="installation"></a> <h4>Installation</h4> <p>This module better be installed at the initialization of the database. Because installing it on an existing database will assign the root company on existing aliases and messages and will wrong their domain aliases.</p> <a name="notes"></a> <h3>Notes</h3> <p>All the work is levered by an inherit of <code>ir.config_parameter</code>. Instead of writing and reading the value of the key <code>mail.catchall.domain`</code> in the <code>ir_config_parameter</code> table, it writes it in a new <code>mail_catchall_domain</code> table alongside the company associated to the domain. When <code>IrConfigParameter.get_param('mail.catchall.domain')</code> is called, it will try to read which domain to use according to keys passed in the context.</p> <p>All the other inherit ensure that we pass the keys and values expected by <code>IrConfigParameter.get_param('mail.catchall.domain')</code> in the context.</p>