summaryrefslogtreecommitdiff
path: root/addons/mail/controllers/main.py
AgeCommit message (Collapse)Author
2019-03-27[IMP] mail: add a different layout for inactive followersJulien Giannone
When displaying the followers of a document, followers who are set as inactive will be displayed in a different layout than the active ones. The purpose is to mark a clear difference between active and inactive followers. Task #1957849 closes odoo/odoo#32084 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2018-12-06[REF] base, *: refactor binary_contentThanhDodeurOdoo
*: tools, web, website, website_forum, mail, im_livechat This commit refactors ir_http to make it more readable and flexible. Move the resize function of web/image to odoo.tools Co-authored-by: XavierDo <xdo@odoo.com> Co-authored-by: Antony Lesuisse <al@openerp.com> closes: #28563 task: #1908896
2018-11-29[REF] *: replace deprecated pycompat helpers for builtinsAdrian Torres
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
2018-08-17[REF] mail,im_livechat,digest: rename 'chat_client_action' to 'Discuss'Alexandre Kühn
Revision on https://github.com/odoo/odoo/commit/02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498#diff-6d76770b1b7cf716d60a4d76a1555c1d The commit above mostly renamed 'Client Action' to 'Discuss', but there were some leftovers.
2018-08-14[MERGE] forward port branch saas-11.4 up to dabe59df9c8Christophe Simonis
2018-08-14[MERGE] forward port branch saas-11.3 up to 27d8daf8a75Christophe Simonis
2018-08-13[FIX] mail: Keep backward compatibility on route /mail/viewToufik Benjaa
- If a database is migrated from an older version to saas-11.3 without this patch, all the links /mail/view with a message_id as parameter will not work. We must keep the backward compatibility for those links.
2018-08-03[IMP] Portal - Share link : Easily share the url of a documentMitali Patel
Purpose ======= - Quickly share the url to someone else (a client, a colleague,...) - Ensure that the recipient can access at least the portal view of the shared record. - Typically used when a client cannot retrieve the mail to access his order. The share link can be used in this case. Specifications ============== For any object inheriting form portal.mixin: - Add a button SHARE (not visible in edit mode) - When clicking on this button, a popup opens with : - A warning message for tasks and projects only (see below) - the link (like in gmail) that can be copied - Recipients - mail composer (with preselected template) ==> see below - button [Send Link] [Copy Link] Discard - After sharing document, put internal note like "Document shared to xyz,...." with template message - Anyone with the link, even anonymous user (not logged in) can have access to the document with the access token provided in the url. Impacted models: - account.invoice (Community) - project.project (Community) - project.task (Community) - purchase.order (Community) - sale.order (Community) - helpdesk.ticket (Enterprise) Warning messages and access rules: Allowed : - SO canceled or draft will be accessible with the link with access_token - If the customer account is B2B (signup not enabled), the recipient will anyway see the document as the user specifically wants the recipient to see the document. Restrictions : - For Project and Task, if the privacy is not public, then, there is a contradiction between the access_token mechanism and the privacy of the document. - A warning message will be displayed in the share wizard to inform the user if the document cannot be visible by the recipients and to ask him to set the privacy to 'Visible by following customer'. The send button will, in that case, be hidden. - To avoid to block the share for a new project, default privacy value is now set to 'Visible by followong customer' Technical implementation ======================== - Move the access_token mechanism (field + methods + mail controller) to the portal.mixin to be able to use it in a generic way for each object inheriting the portal.mixin - Generalise a part of the _*model*_get_page_view_values method into a single one in portal - Generalize the _*model*_check_access into the portal controller of the portal module - Remove the init_column + default value for the access_token > old records have an access_token, > new one won't but it will be generated on demand via the get_access_token Done for performance reasons - Add share button into action menu separately. + kanban view context menu (except for task and project where button not in action menu but 'simple' button for task and project because other modules already provide action to send documents by email, which is not the case for project and task.) - Add a sign_token used to authentify the recipient in the portal view chatter, if any. The message will be posted as if the user was logged in. - Set the _get_share_url as private for security reason - Add a redirect parameter to _get_share_url to get If false : The direct portal view url If True : The redirect url (mail/view/?) - Cleaning up unnecessary code - Bug fix : - Before, if user was not logged and record had partner_id, if partner id was null, post message was done as admin. Now, the post message is done as public user. - If the user had an uid but had no access_token, he could be able to gain the access token of the record. check_access_rights was missing in the get_access_action. Task ID : 30985 Closes #25629
2018-06-07[ADD] mail, mass_mailing: allow a user to resend a mail with failuresXavierDo
When a mail is in failure state, a red envelope appears next to the message in a thread but it was difficult to send the mail again. This tasks will allow users to send mail again easily, or mark notification as cancelled if the user want to ignore this failure. A notification will appear in sender systray while mail are in failure. Task: #46158 PR: #24628
2018-06-06[IMP] mail: add moderation on channelsMathieu Duckaerts-Antoine
Purpose of this commit is to allow moderation on incoming messages in discussion channels. On some channels on which moderation is required messages should be in a pending moderation stage. Moderators can accept or refuse messages as well as always allow or ban messages coming from a given set of emails. Channels now have an option to be moderated. Moderators can be added on channels. They have access to a specific UI in Discuss to see and take action on messages waiting for moderation. Concerning mail.thread message that are pending moderation are not notified. It means nobody receives a notification about them. Moderation process calls the notification once the message is validated. Various features included in this commit : * a model is added to store the decision about emails, allow or ban; * access rights are updated so that only moderators can modify moderation fields on message; * specific bus notifications are send to moderated people as well as to moderators on incoming emails as well as when a decision is taken; * options are added on channels to send explanations to moderated emails; * options are added on channels to write and send guidelines explaining why and how moderation is performed; * a reminder is send daily to moderators with remaining messages to moderate; * discuss UI is adapted and a new channel is added below Inbox and Starred giving access to moderation tools; * chanenl UI is adapted allowing to moderate directly inside channels; This commit is linked to task ID 29521. Closes #21921.
2018-04-09[IMP] im_livechat, mail: replace emoji with unicode.XavierDo
Remove the support to replace emojis by images. Most browser now support colored emoji or at least black and white emojis. The emojis list have been updated to ensure a correct support for most os/browser. Users have the possibility to install fonts localy if their os does not have one of the default emoji font installed. After default os emoji font, one of twemoji, emojione or noto color will be selected. The emoji list is now hardcoded in js in order to reduce the number of records in shortcodes. Also include a small fix for livechat to display message field when rating is bad. Task #36898 PR #23689
2018-04-09[REF] mail, note: move reminder feature from mail to noteDharmang Soni
This commit refactors f488dc58c37fdc7fd49df759165de641e213444b that added reminder feature in activities. After merging it was suggested specifications were not correct and it has been decided to move the whole reminder feature in note. Reminders are now notes instead of activities. Now when having note appµ systray proposes to create a note / reminder. A note.note record is created with info given by the user. If a date is given in the systray quick create then an activity is scheduled on this note. This means user can create records in activity systray that are not activities but notes used as reminders. Those will use the first availableµ note column for the user. As reminders are now notes the support of activities not linked to any document is removed, as well as archiving activities and tests linked to that behavior. This commit has been not carefully tested nor in-depth reviewied. It is considered as too important for the upcoming freeze. This closes task ID 1833628. Closes #24129 . Many thanks to @dpr-odoo for its quick development and good work on this task.
2018-03-27[IMP] mail: take first found reminder activity type as default when creating ↵Thibault Delavallée
reminders If people define several reminders, take first found one based on sequence as default activity type when creating reminders. This commit is linked to the recent merge of reminders done at f488dc58c37fdc7fd49df759165de641e213444b.
2018-03-27[IMP] mail: allow to use stand alone activities as remindersDharmang Soni
This commit allows to create personal reminders and to manage them using activities. It is done using activities not necessarily linked to a record but only to a user. Reminders can be used for example as a personal todo list. Technically we choose to model a reminder as an activity related to no record. This means having a void res_id and model. An activity type is added to classify reminders in it. Settings reminder as done is not done like classic activities. Indeed classic activities are unlinked and a message is logged on the related document. As there is no document for reminders those are archived instead. It means an active field is added as well as an override of toggle_archive to update systray counter. Activities systray widget is improved to display reminders in activities list. This entry leads to a kanban view of activities allowing their management. It is also possible to create them directly from the systray allowing a quick creation of reminders. This commit is related to task ID 41745. Closes #22143 . Co-authored-by: Dharmang Soni <dpr@odoo.com> Co-authored-by: Xavier Dollé <xdo@odoo.com>
2018-03-14[REF] mail: support only model / res_id in mail/view redirection controllerThibault Delavallée
Currently mail/view controller supports either a message_id, either a model/res_id . Using a message_id is just a shortcut to find its model and res_id before redirecting to the record view. If the message has been removed the controller does not work anymore although with model and res_id it still works while the record exists. Same functional behavior can be achieved with only model and res_id. Let us drop support of message_id to lessen code size.
2018-03-14[REM] mail: remove deprecated controllers follow, unfollow and newThibault Delavallée
Mail holds some controllers used notably in notification emails to allow some action directly from email buttons. It is used for example to redirect people to the right view when clicking on 'view document' button. Some deprecated controllers still exist in codebase but are not used anymore. The 'new' controller notably has been removed at df01742fc09989ec830c27427298a99491c9746a . The '(un)follow' controllers have been removed recently at 11d2d30e91758baaa9c6241a86f97ae3dfe52ad2 . Let us remove that dead code.
2018-02-26[REF] mail: rename notification methods related to recipientsThibault Delavallée
This commit renames some internal mail.thread methods linked to the notification process. This is the next commit of a series aiming at improving code readability and method finding through prefixes. See notably cae1c3977ff2777dcb77e4c2a51deb72ee57db22, cdfe479e2e92b8bfc4e4d5bb32c1db8ad5c431d6 and fc1348dd3d73c2a5fbcc043f75b00272fedd6b20. This commit does not change any functional feature. It does only rename notification-related methods, using the _notify prefix to ensure they are private and to mark they are part of the notification process.
2018-02-21[FIX] mail: set view_id in mail/view only if we have one to specifyThibault Delavallée
Currently if get_formview_id does not return a specific view id the mail/view controller produces an url with view_id=False. Due to some unknown reason it is not taken into account as False but as the string False since some time. It generates a traceback and prevent people from using the mail/view controller. While finding why it seems to have changed we can avoid the issue by setting the view_id only if set. It has no impact on the redirection has the default for view is loaded as intended.
2018-02-01[REF][IMP] *: mail js refactoringAaron Bohy
This commit improves the JS code of the mail module, which comes maily from the new coding guidelines and the addition of "JS services". JS services are important objects that do not fit well in the component tree, such as chat_manager or ajax. The benefits of JS services are improved readability of the code, reduced coupling, and more testable modules. In particular, discuss was hard to Summary of the changes: - ClientAction has been renamed into Discuss - Clear instantiation of chatManager - New coding guidelines in most mail modules - JS Services can interact with each other - Chat Manager and Window Manager are services - Window Manager renamed to Chat Window Manager - bus.bus is now encapsulated in Bus Service (a service) - The test infrastructure has been tweaked with JS Services - Chat Mixin has been removed A future improvement would be to translate some 'trigger' into 'trigger_up'.
2018-01-08[REM] mail: remove unnecessary methods from mail.threadThibault Delavallée
* one dead method; * one unnecessary method to inline; * one unnecessary wrapper;
2017-09-11[IMP] mail,*: replace emojis by unicode in chat messagesRohan Patel
*im_livechat,rating. Emojis are now encoded in unicode characters in messages. This allows to copy/paste messages including emojis, ensures that emojis are properly displayed in mail interfaces (at least those that support unicode, e.g. GMAIL, counter-example: outlook), and allows the user to directly use emojis of its smartphone in mobile. This commit also adds several new emojis. PR #11095
2017-09-06[MERGE] forward port branch saas-17 up to b8dd34fcbb8Christophe Simonis
2017-09-06[MERGE] forward port branch saas-16 up to 64d56995e04Christophe Simonis
2017-09-06[MERGE] forward port branch saas-15 up to ef5ac872b81Christophe Simonis
2017-09-05[IMP] mail: Add a preview popup for attachmentsjpr-odoo
Purpose ======= The goal is that when you click on an attachment, you should get a preview of it and then you get the possibility to download it.
2017-09-04[MERGE] forward port branch 10.0 up to abb726d4dfaChristophe Simonis
2017-09-04[MERGE] forward port branch saas-11 up to 431b30b4787Christophe Simonis
2017-09-04[MERGE] forward port branch saas-10 up to aab6bdd54a1Christophe Simonis
2017-08-23[MERGE] forward port branch saas-16 up to aec6248bb37Christophe Simonis
2017-08-23[MERGE] forward port branch saas-15 up to d5f2a38b50cChristophe Simonis
2017-08-22[MERGE] forward port branch 10.0 up to 6dc0f314153Christophe Simonis
2017-08-22[MERGE] forward port branch saas-11 up to 92ec666f8d7Christophe Simonis
2017-08-20[FIX] P3: text model typesXavier Morel
* remove references to basestring & unicode (use relevant pycompat helpers) * remove some str calls (either entirely or replaced by relevant helper, either text or native) * use better API to avoid unnecessary conversions * remove some XML declarations in views
2017-08-20[FIX] P3: fix base64 and StringIO usesXavier Morel
* StringIO removed from stdlib, replace with io * try to correctly handle BytesIO/StringIO (one is for bytes the other is for text) * fix base64: Python 3 removed bytes-encoding and bytes-bytes codecs (via #encode) so replace all calls to str.encode('base64'), also b64encode is a bytes->bytes conversion so attempt to properly handle that issue #8530
2017-08-19[FIX] P3: absolute ordering removedXavier Morel
2017-08-16[FIX] mail, website_(blog/forum/slides): correctly redirect users on ↵Thibault Delavallée
backend/frontend /mail/view controller is a generic controller that redirects to a view on a document either on backend or frontend depending on the module, user and some model specific conditions. However currently url computation is not always correct as you may end up on frontend view even when you are a regular user that should land on backend views. In this stable version we introduced a key in the returned action that indicates the action is a pure front-end (public) action or not. This way people are correctly redirected to the backend or the frontend when going through the controller.
2017-08-10[FIX] mail: Access rights error when reading leavesGoffin Simon
Fine tuning of this commit: b795d69ce8aca2e88182c6d6d6b7af54d536f9dd Steps to reproduce the bug: Leaves > List view > Go into any validated leave > Get Odoo Server Error on access rights opw:693536
2017-07-06[IMP] mail, account, sale: improve sales order mail linkDenis Vermylen
Mail now can handles a generic access_token in /mail/view route. Mail does not do anything with it. Addons can override the controller and add their specific management of this token according to some specific business logic. Sale order emails now contains the access token to grant access from the notification email url without logging in. Sale portal now allow customers to log in using an access token without having to use Online Quote. If the user doesn't have an account yet and signup is allowed (B2C) an extra parameter is added to the url to link the correct partner to the user upon signup. If the user already has an account an extra parameter is added to auto-fill the user's login if he wants to login from that session. Account is also updated to prepare accepting access tokens. However the complete implementation of accounting customer portal will be done in another task coming soon.
2017-04-25[FIX] mail: do not sudo access action fetch in /mail/viewThibault Delavallée
Otherwise it is impossible to know the user trying to access the record. This leads to some incoherent redirection.
2017-01-23[MERGE] forward port branch 10.0 up to 6804085b8ceChristophe Simonis
2017-01-11[FIX] mail: don't check read access if user not connected.Jeremy Kersten
In the worst case, user is not logged in and he will really have no access and will have a perm read error after login. We cannot check if an unknow user has access or not. In most cases, user will be logged in and will see the document directly if he has access or will be redirected to messaging if no access. In the best case, he will be redirected to login page before to see the message. task-22505
2017-01-02[MERGE] forward port branch 10.0 up to c08a590bb1bChristophe Simonis
2017-01-02[MERGE] forward port branch saas-11 up to b844d938890Christophe Simonis
2016-12-21[FIX] mail: Modifying followers in multi companyGoffin Simon
In multi company, some followers of a document could be not readable for a user who has the rights to modify this document. If the user has the rights to write on a document, he is allowed to read and modify the followers of this document. opw:693536
2016-11-04[REF] mail, note, project, project_issue: remove 'new' button in ↵Thibault Delavallée
notification emails As this button leads to a void form view without context it is not really usefull. As creating new records is achieved using aliases there is no real need for a New Task/Issue/Note button. mail/new controller is kept for compatibility but should be removed before v11.
2016-10-10[MERGE] forward port branch saas-12 up to 43cb4acChristophe Simonis
2016-10-04[MERGE] Forward-port 9.0 up to b64b9619f8d6c146e6878a9bab8569ee5c36bb54Olivier Dony
2016-10-03[IMP] mail: separate management of mail routes from redirectionThibault Delavallée
Move code related to redirection in its own class method. This way all controllers perform their own actions and checks before calling the redirection itself. Moreover it is necessary for some controllers to be able to call the redirection independently outside of the mail/view controller scope. This commit also fixes some links generated for mail notification email buttons. Assign and (un)follow buttons now effectively use the link helper when generating the associated URL instead of manually crafting it. Custom routes for notification buttons used in HR and CRM are added. Indeed in order to be able to fine-tune the behavior called by those buttons, using dedicated controllers is simpler than trying to use a generic one. As there are few custom buttons in notification emails using dedicated controllers does not lead to a code overhead.
2016-09-23[FIX][IMP] various: unsudo mail/view controller and get_access_actionThibault Delavallée
mail/view controller is a generic controller that redirects the user to a given view, depending on the record and the user. Users may be redirected to the backend form view, or to a website view. This is done notably by calling get_access_action method that gives the action to perform (act_window or url). Previously this method was called using SUPERUSER. However it was therefore impossible to know who the user was. This method is now called using the current user. Various overrides of get_access_action have been updated to add some logic and access rights check directly in the method allowing more fine-grain behavior of the access action.
2016-09-23[FIX] mail: fix notification buttons url generationThibault Delavallée
* Assign controller now effectively redirects to mail/assign instead of mail/assign * Follow and Unfollow button now uses the helper that generated the link