summaryrefslogtreecommitdiff
path: root/addons/mail/wizard
AgeCommit message (Collapse)Author
2021-05-31[FIX] account, mail: link attachments to invoiceAdrien Widart
When using the "Send & Print" functionality, if the user adds an attachment, the latter won't be linked to the record. To reproduce the error: 1. Open a posted invoice 2. Send & Print 3. Attach a file > Select a file on your device 4. Send the email Error: The invoice's PDF is added to record's attachments, but not the other file (from step 3). When the module selects the attachments that need to be linked to the invoice, it only keeps the ones currently linked to `mail.compose.message`: https://github.com/odoo/odoo/blob/6441ab71cb68648aa735057952bf757677a20ee3/addons/mail/models/mail_thread.py#L1719-L1725 This is correct when the user creates a message directly in the chatter. However, when the mail is created thanks to `Send & Print` functionality, the attachment is linked to `account.invoice.send`. Another flow have a similar issue: from invoices list, select few ones, Action > Send & Print: the generated PDF won't be attached to their invoice. In such a situation, here is the source of the problem: https://github.com/odoo/odoo/blob/05ad6c477f7da2a495e5baf5b4629323b9d11fa0/addons/mail/wizard/mail_compose_message.py#L363-L367 There isn't any information about the invoice, therefore it is not possible to linked the attachment to it. OPW-2438457 closes odoo/odoo#71425 X-original-commit: e87f599d4eb22250b628d650b9f59b54db8d043c Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-26[FIX] mail,test_mass_mailing: unblacklist with mass mailingNicolas Lempereur
The optimization 2ccf0bd0dc does not take into account that to "unblacklist" a user, you have the archive the mail.blacklist record so only mail.blacklist active records need to be taken into account. Added test without the fix fails with: AssertionError: False is not true : MailTrace: email test.record.02@test.example.com (recipient res.partner(), state: sent, record: mailing.test.blacklist(166,)): found 0 records (1 expected) opw-2536304 closes odoo/odoo#71239 X-original-commit: 8ffd82249728b79959cfa61490730991a2b339d6 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-04-13[FIX] {test_}mail: properly handle deletion of mail notif from composerdht-odoo
Before this commit: When someone sends mail with help of mail_composer(mail.compose.message) without having a mail template set, mail is not deleted after being sent (and causes unwanted/unexpected burden on DB). This bug was introduced with commit[1], where auto deletion was disabled if template is not set on the composer. After this commit: If there is no mail template set on the composer, or if the template is set and 'auto_delete' is enabled on that template, the mail sent from composer will be deleted after being sent successfully. A context key is added to allow controlling this behavior. It is notably use to check query counters differences. commit[1] - https://github.com/odoo/odoo/commit/8a026e26c6ae25e3fdb5369a7fa3343d70fab782#diff-898a3d5c08a567c1a7b82c026a213d796e850e376cbdb1c9e7936409f440d37aR257 Task id: 2484915 PR odoo/odoo#68870 Original Pr #68403 X-original-commit: 05ad6c477f7da2a495e5baf5b4629323b9d11fa0 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-29[FIX] mail: prevent use of private addresses for followers, recipients,...Anh Thao Pham (pta)
- Connect with Admin - Go to Contacts, edit himself by adding a Private Address - Create an Internal User without "Access to Private Addresses" right (i.e. User X) - Go to any app implementing chatter (i.e. Sales) - Create a SO - Add the created Private Address as follower - Make sure User X can access the record (i.e. Sales: Administrator) - Connect with User X and open the SO An Access Error is raised while trying to fetch data about the followers. This commit prevents to: - add a private address as follower of a record - add a private address as Recipient in full composer - propose private addresses when adding a mention to a partner opw-2428936 closes odoo/odoo#65933 Task-id: 2463622 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-08[FIX] mail: remove useless custom property from action dictArnaud Baes
The `{'infos': 'mail_sent'}` property returned by `action_send_mail()` was apparently unused, and orginally intended for debugging, according to its author. Since previous commit adds a warning for such unknown properties, removing it entirely keeps the testsuite green. And it's cleaner than explicitly allowing that extra key, since it's unused. closes odoo/odoo#62581 Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-11-27[FIX] *: rephrase, correct typosMartin Trigaux
Courtesy of Transifex's translators for reporting bad/unclear sentences. closes odoo/odoo#62539 Related: odoo/enterprise#15032 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-26[FIX] mail: fix composer default values computationThibault Delavallée
As default is called numerous times with sometimes all fields, sometimes only one field we have to ensure we avoid computing and setting unnecessary or wrong values. We suspect this comes from default_get being called more often at creation time since Odoo v14. Default values for some fields in mail composer are dependent on each other. Especially composition mode and model / res_id(s) are important for some fields as behavior is not the same in comment or mass mail mode (subject set / not set, template values rendered / displayed raw, ...). Especially subject is wrongly computed in mass mail mode. For example use a mass mail composer action on leads without template. Indeed a default_get is called on subject alone. As web client adds active_model / active_id automatically default returns a value for subject while it should not as other values (model, res_id) are not asked and therefore not correctly computed. It makes composer compute values in comment mode while it should stay in mass mode. In this commit we fix that behavior by * computing only requested values (better match returned values and asked fields); * avoid computing values if context values are not given (model, res_id or res_ids, composition_mode); Task ID-2390314 PR odoo/odoo#62061 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-29[FIX] *: correct typos and bad EnglishMartin Trigaux
Courtesy of translators Reexport .pot of modified modules closes odoo/odoo#61002 Related: odoo/enterprise#14485 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-23[FIX] mail: fix sending failures email wizardPriyanka Kakadiya
due to breaking changes in https://github.com/odoo/odoo/commit/bf32b22ce247c19fda94ded74e37f7c6120ce2c4 and especially the part: "NOTE 1. If the default_get within the onchange returns a value for a field that is not in the view, we ignore it, and it won't be saved. Before, that value was kept and sent upon save. This change in behavior may prove problematic, although the overall risk is small. Decision has been made to keep heavy comments and code snippets if we were to revert back somehow to the previous situation." the wizard to sending failures email was broken as the field partner_id which is required was not present in the view and was thus ignored by to web client when calling 'create'. closes odoo/odoo#58299 Task: 2341593 Closes: https://github.com/odoo/odoo/pull/58299 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-05[FIX] mail: speed up filtering out blocked emailsOlivier Dony
For large lists of blocked emails, the time taken to load the records in cache becomes prohibitive. For instance on a sample blocklist of 600k entries, the `search([])` to load them could take 80-90s to run! And this toll is taken every time the mail composer processes an email batch in mass-mailing mode. Technically, most of the time is spent iterating on the list of ids many time, in order to prefetch fields into cache by determining what's missing. Loading the contents of the list in raw SQL takes a fraction of that time (400ms vs 90s). Subsequently using a set for lookups in that blocklist is also much faster (average time complexity O(1) vs O(n)). Example: looking up an item in a 600k-entry blocklist is easily 5 orders of magnitude faster! ``` In [1]: blocklist = set(x[0] for x in self._cr.fetchall()) In [2]: len(blocklist) Out[2]: 634610 In [3]: self._cr.execute("SELECT email from mail_blacklist") In [4]: blocklist = set(x[0] for x in self._cr.fetchall()) In [5]: %timeit "hello@hello.com" in blocklist The slowest run took 35.29 times longer than the fastest. This could mean that an intermediate result is being cached. 10000000 loops, best of 3: 31.6 ns per loop In [6]: self._cr.execute("SELECT email from mail_blacklist") In [7]: blocklist = [x[0] for x in self._cr.fetchall()] In [8]: %timeit "hello@hello.com" in blocklist 100 loops, best of 3: 2.24 ms per loop ``` closes odoo/odoo#57128 X-original-commit: 3b9a85754f30f0bef508d0b576ff679c87ead5da Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-08-27[REF] mail: move generic methods from thread to BaseModelThibault Delavallée
PURPOSE Since v13 some commits added code in mail thread file. This file is already quite long and keeping it organized allow to understand its content. SPECIFICATIONS Some methods defined on mail.thread may actually be called on models not inheriting from mail.thread . Instead of having model methods on mail thread receiving a records parameter it seems better to have those available directly on BaseModel. Move static_message_track on BaseModel in models.py. This method is now called _mail_track, to be coherent with othe rmail-related naming. It is used in accounting to track values in line model that does not inherit from mail. thread. Update accounting accordingly (followup of d862965). Move _message_get_default_recipients_on_records in models.py. Renaming it _message_get_default_recipients() allow to be compatible with current behavior and current override available in some addons (like CRM, event, ...). Move _notify_get_reply_to_on_records in models.py. Renaming it _notify_get_reply_to() allows to be shorter and coherent. Move _alias_check_contact_on_record in models.py. Renaming it _alias_check_contact_() allows to be shorter and coherent. Its override in hr is also moved on BaseModel. Backward compatibility is kept for those methods as this PR target a mostly stable version. LINKS Task ID-2327096 (code cleaning) PR #56631
2020-08-14[IMP] *: wrong any() usageVictor Feyens
Replace wrong usages of any(list|recordset), by any(generator) to speed up computations, avoiding list creations and/or looping twice on a recordset for nothing. any([generator]) => any(generator) any(filtered) => any(generator) closes odoo/odoo#55768 Related: odoo/enterprise#12360 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-08-06[FIX] mail: User following task can't add another followerNasreddin (bon)
Issue - Login as Mitchell Admin - In Projects module, Create a new project - Set Visibility to 'Invited employees' - Create new task and assign it to Mitchell Admin - Edit the task and add Marc Demo as follower - Login as Marc Demo - Go to the task previously created - Add an other follower IrRule Error Solution Use sudo() to find all followers of a document. opw-2303443 closes odoo/odoo#55521 X-original-commit: e0d064ffe4013ed727bdc780a3d0a7c6b16e6e9c Signed-off-by: Simon Goffin (sig) <sig@openerp.com> Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-06-18[IMP] *: use named placeholders in translated messageMartin Trigaux
When more than one parameter is present in a message, it helps the translation to use named placeholder. This way, the order can be changed. It also helps the comprehension of the message.
2020-06-15[REF] mail, *: refactor messaging with OWLSébastien Theys
This commit is a significant rewriting of client-side discuss, chatter, chat window, and messaging menu using OWL. The behavior should be broadly the same, with some slight functional changes here and there. From a technical standpoint, the code of messaging is mainly organized in 2 main groups of modules: - models, which are logical entities that depict the client-side state of messaging as a whole. - components, which are in charge of displaying information from models. This refactoring also introduces new JS guidelines regarding folder structure (/static) and naming rules for JS modules. Community PR: https://github.com/odoo/odoo/pull/39023 Enterprise PR: https://github.com/odoo/enterprise/pull/6249 Task-1914207 This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier, with the precious help of Lucas to speed it up towards the end. closes odoo/odoo#39023 Related: odoo/enterprise#6249 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre Kühn <aku@odoo.com> Co-authored-by: Julien Giannone <jgi@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Sébastien Theys <seb@odoo.com> Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2020-05-19[REF] ir.autovacuum: declarative garbage collector registrationJulien Castiaux
The ir.autovacuum model purpose is to run several garbage collecting operations like removing files from the filestore when no attachment references them anymore. The precedent strategy to register new garbage collection tasks was to override the `power_on` method and to imperatively execute a vacuum cleaning method on a given model. All calls were executed in a single SQL transaction without any error handling, meaning a single fail during any call resulted in a complete failure of the entire vacuum cleaning chain. We introduce a new `@autovacuum` api decorator, its purpose it to register garbage collecting methods that will be safely executed in their own transaction by the vacuum cleaner. In order to ensure this new strategy is used, we deprecate `power_on` extensions. By the way, garbage-collecting methods can be quite heavy and we don't want users to directly call them. We now ensure they are private. closes odoo/odoo#47842 Task: 2154079 Signed-off-by: Raphael Collet (rco) <rco@openerp.com> Co-authored-by: Raphael Collet <rco@odoo.com> Co-authored-by: Olivier Dony <odo@odoo.com>
2020-05-13[FIX] mail: fix cancelling of email failuresAnh Thao Pham (pta)
- Configure your outgoing email server to be sure that a failure will be triggered when trying to send an email - Make sure you don't have enough sms credit to send a sms - Go to a contact page - Send a message to the contact via the chatter - An notification error should appear in the conversations icon in the systray - Send a sms to the contact - An notification error should appear in the conversations icon in the systray - Click on the "Mark as read" icon on the notification error for the email - A "Discard mail delivery failures" wizard will appear - Click on "DISCARD DELIVERY FAILURES" All email and sms delivery failures are discarded. Only the email delivery failures should be discarded. opw-2247617 closes odoo/odoo#51204 X-original-commit: d8c177969239a9bd6dcbd6654a914d40a6ba479f Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-04-17[IMP] mail, sms, snailmail, test_mail_full: adapt mail.notificationSébastien Theys
The purpose is to have more common code for failure and notifications, with less override in `sms` and `snailmail`. task-2176017 closes odoo/odoo#44170 Related: odoo/enterprise#9140 Related: odoo/upgrade#918 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-04-08[REF] base: Remove deprecated exceptions and osvJulien Castiaux
TL;DR: remember `osv` and `except_orm` ? You can forget about them. * Deprecated `except_orm` dropped. * `UserError` elevated as super type of all user-related errors. * Unused `DeferredException` dropped. * Unused `QWebException` dropped (real one is in `qweb.py`). * `MailDeliveryException` made a python exception. * `name` legacy exception attribute made an alias of the python standard `args[0]` attribute and deprecated. * `value` legacy exception attribute dropped. * `exception_type` RPC error response key dropped. * Deprecated `osv` module dropped. * `--osv-memory-age-limit` cli option made an alias of `--transient-age-limit` and deprecated. The `odoo.exceptions.Warning` have long been a deprecated alias to `UserError`. It is going to be removed in a future version but first we explicitly deprecate it with a warning. The `odoo.exceptions.DeferredException` was a very old internal exception, it has been removed without deprecation notice as it is never raised. The `odoo.exceptions.except_orm` has been a deprecated exception type with deprecation warning for 5 years, it has been removed in favor of UserError which becomes the super class of all user-related errors. The `odoo.base.models.ir_mail_server.MailDeliveryException` was inheriting `except_orm`. As it is not related to a user error but is more of a problem an admin much take care of, the exception has been made a Python error. The `exception_type` JSON key in RPC error responses was holding an hardcoded value derived from the exception type. Its usage has been dropped in favor of the `name` JSON key that holds the precise exception name. Again as it was hardly used in the source code (beside the crash manager) it has been dropped without deprecation warning. Since we are here trying to clean odoo custom exceptions, we are also deprecating the `name` exception attribute in favor of the more standard `args[0]` attribute. The `name` (along with `value`) were two attributes used to raise `except_orm` exceptions before the introduction of `UserError`, `AccessError` and related exceptions. The `name` attribute, at the time, was holding the exception type/title. Nowadays it contains the error message. The `value` attribute, at the time, was holding the error message. Nowadays it is no more used. The `osv` module contains very old deprecated aliases. There is no simple way to log a deprecation warning for osv, osv_memory and osv_abstract but as they have not been in use for ages, they have been removed too. To be consistent, the `--osv-memory-age-limit` cli option has been made a deprecated alias to the `--transient-age-limit`. closes odoo/odoo#45723 Task: 2187728 Related: odoo/enterprise#9162 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-26[IMP] mass_mailing_(sms): Add unblacklisting buttonTiffany Chang (tic)
Previously a blacklisted phone number or email address could only be removed from their respective blacklist by going to the corresponding blacklist view [in mass_mailing_(sms)] and manually archiving/deactiviting the entry. All users could see that an email was blacklisted via an fa-ban icon added next to their corresponding field in the modules: crm, mass_mailing, mass_mailing_sms, and contacts (via extension). This commit adds additional fa-ban icons next to blacklisted phone numbers and makes all instances of these icons clickable to remove them from their corresponding blacklist using a wizard. There are several limitations to this implementation including: 1. If both a mobile and phone number field appear within a crm lead instance, then only the mobile field will indicate if it is blacklisted (due to current implementation of PhoneMixin which only checks 1 phone value against the blacklist and "sms" which returns mobile numbers first). I.e. if a phone field value is blacklisted, but a value is typed into the mobile field, then the phone field will never indicate that it is blacklisted. 2. If someone clicks on a unblacklisting icon after changing the corresponding field value without clicking off the field input, then the latest typed in value will be the one submitted for unblacklisting, which may not actually be blacklisted (due to "is_blacklisted" flag being a computed field and it not having a chance to re-compute to hide the button). 3. If someone changes values in the blacklist, then someone who already has a form open will not see icon disappear until something triggers a re-compute of the "phone_sanitized_blacklisted" flag (this was already the case with the icon, but now a user may try to unblacklist a value that is already unblacklisted.) 4. Since the icon needs to be visible by everyone to indicate whether or not a phone/email is blacklisted, users without corresponding unblacklist permissions will be able to click on the icon. When they click on it, they will be informed they do not have permission to unblacklist. A wizard was determined to be the best way to implement this unblacklisting for the following reasons: - A "Unblacklisting Reason" is needed and will not be stored as a field. - A field widget is unable to do this due to security settings + inability to refresh view after unblacklisting with a "Unblacklisting Reason" without wiping unsaved changes. Additionally, to better align with GDPR, the corresponding form view for the phone/email blacklist has been updated to use the same wizard to track "Reason for unblacklisting". Unfortunately there is no straightforward way to prevent direct "Archive" action, so users are still able to bypass unblacklisting without being asked for a "reason for unblacklisting". Supports task: 2117635 Upgrade PR: odoo/upgrade#939 COM PR: odoo/odoo#45315
2020-03-24[MOV] mail: move rendering code to mail render mixinThibault Delavallée
We also have to update code calling directly the rendering itself. Indeed some code bits does some rendering directly on jinja-enabled input and not through templates. Those calls have to be updated accordingly. LINKS Task ID 1963529 Community PR odoo/odoo#32397
2020-03-18[FIX] mail: fix typo in additionalThibault Delavallée
Task ID 2211781 closes odoo/odoo#47937 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-18[IMP] mail: improve the help tooltip of auto_delete fieldIpsita Borisagar
Currently the message for help tooltip of auto_delete field is not sufficiently clear for user to understand. In this commit, improving message for help tooltip by adding some extra details in it so user can easily understand about it for models mail.mail, mail.template and wizard mail_compose_message. Task-2055702 Closes https://github.com/odoo/odoo/pull/45063 closes odoo/odoo#45063 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-02-12[FIX] *: domains should not have as many binary operator as there are termsXavier Morel
* modify client-side domain normalisation to error if the domain is invalid (not enough terms / segments for the number of operators) * add better error reporting to attrs / modifiers parsing * add a few layered error augmentation to provide clearer context e.g. "error: invalid domain <thing>" is helpful but "error while parsing modifiers for field foo: modifier invisible: invalid domain <thing>" is much more helpful * rework _evalModifiers to deduplicate it in order to more easily implement this contextual augmentation * test that improper domains are properly found improper * fix a bunch of incorrect attrs domains * also removed an apparently undefined (& unused) "options" argument to a _applyModifiers call closes odoo/odoo#44642 Related: odoo/enterprise#8175 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-02-11[REF] mail, various: remove user_signature field from mail.templatemcm-odoo
RATIONALE Mail template model holds a field telling odoo mail engine to automatically add the current user's signature to the body. Its use depends on the use case * using the template in the composer on a single record: it is displayed in the rendered template in the composer, meaning people could change it. This behavior is interesting as it allows to see the email content; * using the template in the composer in mass mail mode: it is not displayed as only the raw jinja is displayed. It is therefore not obvious that it will be appended to the body of the mail. People could add it manually and have 2 signatures as a result; A mechanism automatically adding a signature to sent emails when posting a message is already implemented and is based on template existence. If a template has been used when posting, no signature is added in sent emails. Otherwise it is automatically added. This behavior should not change. Behavior will therefore be * use a template -> specify signature usage in it manually through jinja; * do not use a template -> signature added in sent emails; SPECIFICATIONS Remove user_signature. Update template body accordingly. In customer oriented templates that are using it and do not already contain it, manually add a call to user.signature within the jinja code. When set to False, just remove its declaration. Quickly clean some signature integration. LINKS Task ID 2089252 Community PR odoo/odoo#39482 Enterprise PR odoo/enterprise#6459 Upgrade PR odoo/upgrate#761 Related: odoo/enterprise#6459 Related: odoo/upgrade#761 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Co-authored-by: Michaël Mattiello <mcm@odoo.com> Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-01-28[IMP] *: use ast.literal_evalMartin Trigaux
When simply need to parse a domain, it is easier Add .strip() on ir.ui.view as ast.literal_eval produces an syntax error if the node starts with spaces (as done in the xpath of hr_attendance.view_employee_form_inherit_hr_attendance) closes odoo/odoo#43831 Related: odoo/enterprise#7894 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-02[REF] mail: improve and refactor mail template previewryv-odoo
PURPOSE Improve mail template preview wizard by improve its views and displaying more rendered fields. It helps users knowing what will be sent to customers. SPECIFICATIONS Rename template model to mail_template_preview to better match the mail template namespace. Remove _inherit on mail.template and instead choose fields to compute and display. Indeed lot of fields are unnecessary or badly computed. Instead just add fields on the wizard that depends on mail template and will be computed based on mail_template_id field of wizard. Improve error management. LINKS Task 2085912 PR #38708 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-29[FIX] mail: restrict access to mail.mail modelThibault Delavallée
From now on mail.mail is considered as a technical model. Indeed people should not really manually craft mails by hand. Instead various functional flows should either send mails, either craft mails based on some user input. We therefore make mail restricted to admin users. Flows creating mail.mail are updated to use sudo, and ensure it was done in a context that makes sense to delegate this power to the user. Task ID 1853147 PR #32243
2019-11-29[REF] mail, various: improve mail creation calls, notably author and email ↵Thibault Delavallée
from default computation Purpose of this commit is to correctly compute author_id and email_from in mail_message and mail_mail as they depends from each other. Moreover it is a good idea in various flows to specify email and author when giving creation values to avoid default computation that is not always guaranteed to be accurate notably when involving super user. Mail message creation could lead to desynchronized values between author and email_from. This is improved with this commit by correctly inheriting from default_get and computing both of them at the same time instead of having two default values. Indeed they depend on each other. Same thing is done for mail composer. Mail Thread offers a tool method to find email_from / author_id based on having one of those values or current user and it is called whenever necessary. Some calls to mail template send_mail are also cleaned. Task ID 1853147 PR #32243
2019-10-23[REF] mail: remove dead code in composer and lint some code bitsThibault Delavallée
Purpose of this commit is to remove code coming from old features, implementations and that was not completely cleaned. Including * remove support of old "reply" composition mode which is simply a comment with a parent message, and is deprecated; * remove support of old "mail.compose.message.mode" context key that was used in Odoo 6.1; * remove support of message_id default value in context instead of default_parent_id; * remove old redirection of user / partner post. This code come from old age when people were able to post on their "profile" by posting on their user; * remove unnecessary method for selection field; * remove unused imports to clean a bit code; We also make some optional parameters in rendering methods mandatory to ease code understanding and future modifications. Task ID 1853147 PR #39272
2019-10-10[FIX] mail: fix mailing wizard when partners and template specifiedVictor Feyens
if partner_ids and template_id are set, a traceback happens. Indeed, some mail fields are not taken from the res_ids when partner_ids is set. When trying to update the values with the one from the template, the existing values are popped, which raised an error as those keys weren't set. closes odoo/odoo#38434 X-original-commit: c8ad614718674b55e9af5edd062ded958136e7ac Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-10-10[FIX] mail: force empty value on recordChristophe Simonis
closes odoo/odoo#38327 X-original-commit: da9e377ba480a034c5d740a6bcb4325f70e7f9e8 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-10-09[MERGE] forward port branch 13.0 up to f4105eb9c70Christophe Simonis
2019-10-08[FIX] mail: correctly fetch customer data when sending invitefw-bot
Currently when inviting someone on a document all recipients are considered as standard customers. It means access buttons are not displayed and addon specific behavior not really triggered. This commit makes use of ``_get_recipient_data`` tool method allowing to categorize recipients in groups and display buttons and action links like other post on documents. Task ID 1967234 closes odoo/odoo#38111 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-25[FIX] mail: fix email template preview actionRémy Voet
SPECIFICATIONS In the mail template views, remove the contextual action "Template preview" from action dropdown. It was a duplicate of smart button in the template form view and makes no sense in the tree view. Task ID 2075733 closes odoo/odoo#37425 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-17[REF] mail: remove deprecated email formataddrJulien Castiaux
[PEP 594] is going to depreciate the legacy `email.message.Message` API and its related modules. Among them the `email.utils.formataddr` function, this function takes a `(name, email)` pair and returns a string value suitable for From, To and Cc headers. The stdlib function is capable of handling several character encoding and two binary-to-ascii encoding. Odoo only uses `utf-8` which is compatible with the base64 b2a encoding. The re-implementation of that function has been simplified to only support base64-ed utf-8 and ascii. [PEP 594]: https://www.python.org/dev/peps/pep-0594/\#email-lagacy-api
2019-08-21[FIX] mail: add missing importChristophe Simonis
Oversight of previous forward-port.
2019-08-21[MERGE] forward port branch saas-12.4 up to f26de445e55Christophe Simonis
2019-08-20[MERGE] forward port branch saas-12.3 up to 6f55fd65da8Christophe Simonis
2019-08-19[MERGE] forward port branch 12.0 up to 32039b2ab44Christophe Simonis
2019-08-08[MERGE] forward port branch saas-12.3 up to 752b2553c6fChristophe Simonis
2019-08-06[MERGE] forward port branch saas-12.2 up to 9e74730a26bChristophe Simonis
2019-08-06[MERGE] forward port branch 12.0 up to ff9ddfdacc9Christophe Simonis
2019-08-05[FIX] mail: fix model typo in message_notifyHardik Prajapati
Since #32404, the fallback case where we have no recipients and no parent_id on message notify has a typo on mail_message. A user will receive a traceback when using compose message wizard on a record not inheriting from mail_thread if he forgot to add recipients. If the typo should be fixed, notifying the user that no recipients were found and thus, message_notify won't do anything could be interresting. We can raise a UserError to give a more explicit failure reason. We would like to avoid to raise this error on a low level like in message_notify to avoid to break mail_gateway mechanism, but raising it from mail.compose.message send_mail shouldn't have any side effect. We can simply check the output of message_notify to know if something was done to avoid to duplicate logic used to define recipients. task-2046180 closes odoo/odoo#35378 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-08-20[IMP] models: ORM speedupRaphael Collet
This branch is the combination of several optimizations in the ORM: * store field values once in the cache: the cache reflects more faithfully the database, only fields that explicitly depend on the context have an extra indirection in the cache; * delay recomputations by default: use method `recompute` to explicitly flush out pending recomputations; * delay updates in method `write`: updates are stored in a data structure that can be flushed efficiently to the database with method `flush` (which also flush out recomputations); * make method `modified` take advantage of inverse fields to inverse dependencies; * filter records by evaluating a domain on records in Python; * a computed field with `readonly=False` behaves like a normal field with an onchange method; * computed fields are computed in superuser mode by default. Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien Pinckaers. closes odoo/odoo#35659 Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-14[MERGE] forward port branch saas-12.4 up to 98a55917a60Christophe Simonis
2019-08-08[FIX] account,iap,sale,mail,portal: translate error messagesMartin Trigaux
The error were untranslatables Courtesy of Moises Lopez closes odoo/odoo#35573 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-09[REF] mail: remove private discussion support in mail gatewayThibault Delavallée
PURPOSE Add some improvements in mail gateway: remove private discussion, improve bounce management, allow resetting bounce counters, improve automatic set or reset of blacklists and ease mass mailing inheritance. SPECIFICATIONS Private discussion support in mail gateway means having incoming messages not linked to a document. It means having a void model and res_id on related messages. Old private conversations in Odoo were implemented using messages not linked to any document [1]. It was possible to send an email to some people through the UX and they were able to answer it. Messages were not attached to any document and model. There were some limitations to this feature, notably it was limited to replies (no beginning of private discussion through mail gateway). One way of doing it was through the use of res.users aliases [2]. There was also a vaguely twitter-lite use of chatter on HR employee profiles linked to users aliases, then removed with an explicit support of private discussions [3]. It is not supported anymore since discussion between users is now done using chat. Aliases on users have since been removed [4]. Contacting partners or customers can be done on business documents or on channels. Simple email discussion is not supported in Odoo as it is not the purpose of mailgateway. This commit removes code related to private discussion in mail gateway and some specific support in message_post method. LINKS Related to task 1893155 Linked to PR #33340 [1] History is a bit messy, see notably fd90140d7bd05820aeac7bd7e22539893f87319d and commits around [2] User alias addition 052f2ace57e20f06980bc8fadf37b32be1921420 [3] End of employee twitter-like and posting on users = private discussion 89896f32bbf6aeecfbddc0f7e8397781fce2a99c [4] User alias removal 029d1baf359eabb7ed531287f3cb2b3b8d586d39
2019-08-05[IMP] *: remove usage of `oldname` attributeChristophe Simonis
This attribute is misleading as it is insufficient to correctly upgrade the database. It only renames the column in the database, but other operations are needed, like updating the corresponding `ir.model.fields` record (and its xmlid). The default values and the translations are also lost during the upgrade. Moreover, this feature was misused. It was: - left on fields during multiple versions. - used on reports (SQL views). This would be ok if the feature was complete, but, as is, it was useless. - kept unchanged after a second renaming of the field (which can happen versions later the first rename). - used, even when the meaning of the field changed. i.e. the field `archived` has been renamed to the classic `active`, but the value in the database should be switched.
2019-07-25[MERGE] forward port branch 12.0 up to b82df99d7a8Christophe Simonis