fetchmail_invoice should support multi company
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Therp Addons |
Confirmed
|
High
|
Unassigned |
Bug Description
The fetchmail_invoice module, which creates supplier invoices from incoming mail, should support multi company databases.
At present, when an invoice is created from an incoming mail (because a fetchmail server configuration document has been created tot setup invoices), the from email field is used to lookup the supplier. If the supplier is not found, the invoice will be created for a default supplier, linked to the main company, that has been setup for this purpose.
The above functionality does not support a situation where the database contains multiple companies.
A further limitation is that in not every setup, suppliers send an invoice to a mail address directly linked to OpenERP. Often company workers receive mails, that they should be able to forward to OpenERP if it contains an invoice. In that case a special email account will be setup for this purpose. When the mail arrives in OpenERP, the from email account can not be used, so a link has to be made to the right default supplier for the company.
The same goes when supplier invoices are received by snail mail, scanned and emailed to OpenERP.
To deal with all these setups and scenario's the following is proposed:
1. It should be possible to link a company to a fetchmail server configuration.
2. When an invoice arrives, the following logic will be used, until a supplier is found, or until the possibilities have been exhausted.
- if there is a company on the fetchmail config, suppliers will be searched using the from e-mail, with the same company.
- If there is a company on the fetchmail config, suppliers will be searched withouth company set.
- if there is no company on the fetchmail config suppliers will be searched just using the from email address.
From the above it follows that a supplier will NEVER be selected if both fetchmail config and supplier have a company set, and these are different.
- If no supplier found using the from e-mail address, the search will be repeated using the to email address. This gives users the possibility to forward/send e-mails to a dummy partner for the right company.
If still no supplier found, supplier will be searched that has the 'fetchmail_
The present default supplier created by the fetchmail_invoice module will have the fetchmail_
If a supplier is found in any way withouth company, and the fetchmail config also has no company, the invoice will be linked to the main company. Else either the supplier, or the config has a company - they can never differ - and that company will be used.
Exceptions:
- no supplier found
- no default creditor account for the supplier found can be determined.
Implementation detail:
As a company setting on the fetchmail server config might be usefull for other models than account.invoice, the addition of this attribute will be in a separate module: fetchmail_
Related branches
Changed in therp-addons: | |
status: | New → Confirmed |
importance: | Undecided → High |