summaryrefslogtreecommitdiff
path: root/addons/mass_mailing_sms/models/mailing_mailing.py
AgeCommit message (Collapse)Author
2021-05-21[FIX] sale, mass_mailing_sms, test_mail_full: correctly support partner-only ↵Thibault Delavallée
records When performing an sms marketing on a model having only a ``partner_id`` field available (aka no ``phone`` or ``mobile``) it crashes due to seen list computation (aka already contacted recipients). This is due to an SQL query not taking into account those models as it works only for those with a phone field. We fix it as done in ``mass_mailìng`` app, aka fetching information on the related partner if available. Some tests for models using a 2many relationships towards recipients are added. Note that this kind of model does not really support complete SMS notification, as only the first found partner is notified. Mass SMS on this kind of model is currently not possible as seen list is not supported. There is no standard use case of this in Odoo codebase. Correctly support sms marketing on sale model by defining the necessary methods. As sale order has only a partner_id field available we have to correctly override phone related methods for SMS. LINKS Task ID-2431217 COM PR odoo/odoo#71140 Signed-off-by: Thibault Delavallee (tde) <tde@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-08-11[IMP] mass_mailing[_sms]: update subject and allow emoji support for sms contentxO-Tx
PURPOSE Subject field on mailing has not the same use in email marketing (subject of emails) and in SMS maketing (used internally as there is no subject in SMS). Purpose of this commit is to improve mailing form view to better distinguish email and SMS flows. SPECIFICATIONS This commit changes helper for mailing subject and update its label according to mailing_type (mail or sms), as well as the sms content field to enable emoji support in mailing subjects. This is done through a fake sms_subject field that is a text without emojis while standard subject allows emojis. Helpers depends on the displayed field. Override CRUD to synchronize sms_subject on subject to have only one field used to store data. Also allow emojis in SMS content, suing the enable_emojis option. LINKS Task ID-2224393 PR #49096
2020-06-18[IMP] *: replace to new _() syntaxMartin Trigaux
Using a few regex like \((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\) ($1, $3)) Old syntax is still compatible but starts the migration to the new syntax that catches error.
2020-05-12[IMP] sms: Add new failure status for unregistered accountsRémi Rahir
Since January 2020, users are required to validate their IAP account via SMS code validation. This new behaviour needed to be properly ported to the client to correctly inform the user. This commit adds support of a new failure_type: 'Unregistered Account'. Task #2209567 closes odoo/odoo#48512 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-30[FIX] *: set ondelete policy of required Selection fieldsAdrian Torres
With this commit, Selection fields with `required=True` which are extended via `selection_add` are given proper ondelete policies to ensure the cleanup of records containing these extended options during uninstall of the extending module. This commit also cleans up leftover uninstall hooks that were being used to handle the same set of problems prior to the ondelete mechanism being implemented for Selection fields. closes odoo/odoo#46325 Related: odoo/enterprise#9117 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
2019-12-16[REF] mass_mailing(_sms): force domain reset when changing model / typeThibault Delavallée
In this commit we rewrite the compute on mailing domain to simply reset it once the mailing domain is changed. Indeed trying to keep a previous domain based on try / except has no meaning from functional point of view. If model changes then domain should change as it is a business record, not just a technical domain to try to apply. LINKS Task ID 2088577 PR #41877 Enterprise PR odoo/enterprise#7278 Co-Authored-By: Thibault Delavallée <tde@odoo.com> Co-Authored-By: Aurélien Warnon <awa@odoo.com>
2019-12-16[REF] mass_mailing: move from onchange / default to stored editable computed ↵Rémy Voet
fields PURPOSE Try to move from onchange / default_get to stored editable computed fields. Normally behavior should be the same (computed or set by user), with support in create / write + onchange without additional code. SPECIFICATIONS Update classic fields with onchange to stored editable computed fields. It means their value will come either from manual user input, either computed based on triggers. Purpose is to remove all onchange and default_get when possible. Clean fields definition inconsistencies, like default / required on computed fields. Indeed computed fields should always have a value, maybe coming from user input. They should not have default / required that are attributes for classic fields. LINKS Task ID 2088577 PR #41877 Enterprise PR odoo/enterprise#7278
2019-11-06[FIX] mass_mailing_sms: leftover reference to a renamed modelThibault Delavallée
closes odoo/odoo#39874 X-original-commit: c34f860548b0d68773b25e89fb99aad1fb144b8c Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-08[FIX] *: fix "there is no" sentencesYenthe666
"There is no <plural>" is not correct cf https://english.stackexchange.com/a/26634 closes odoo/odoo#38205 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-30[FIX] mass_mailing_sms : sms on record chatterryv-odoo
- For the sms marketing, by default the sms is now log on the chatter of the record (like with the sms composer). But can be disable it with keep arhives unchecked (in debug mode only). TASK_ID : 2075733
2019-09-30[IMP] sms - mass_mailing_sms : unsubscribe sms improvementryv-odoo
- In the sms marketing, the sms_allow_unsubscribe is now False by default and move the field in the setting page. - Improve the unsubscribe link for the sms : adding "\nSTOP SMS : " message before the link. TASK_ID : 2075733
2019-09-25[FIX] mass_mailing_sms: fix sms mailing retry not really workingThibault Delavallée
Retry was not working for SMS marketing as it was actually not really implemented. It now correctly unlinks failed sms and traces and reschedule the mailing accordingly It is also possible now to force send while being in queue mode to avoid having to switch too much between states. LINKS Task 2076366 (send now) Task 2067873 (template access) PR #37298 PR odoo/enterprise#5750
2019-09-25[FIX] (mass_mailing_)sms: allow to directly send SMS in mass modeThibault Delavallée
PURPOSE Sending SMS is sometimes required as an immediate marketing tool. Using delayed crons is not always the best user choice. Implement a Send Now mechanism in batch SMS. SPECIFICATIONS Allow to send directly SMS when doing SMS marketing SMS Application * in sms composer, in mass mode: rename Send SMS to Put in queue and add a Send Now button by-passing the queue; * set Put in queue as primary, Send Now as secondary; SMS Marketing Application * in mailing view for SMS: rename Send SMS to Put in queue and add a Send Now button by-passing the queue; * set Put in queue as primary, Send Now as secondary; Tests of SMS marketing with 400 contacts to SMS indicates it takes about 10 seconds to be completed which is considered as ok. LINKS Task 2076366 (send now) Task 2067873 (template access) PR #37298 PR odoo/enterprise#5750
2019-09-20[FIX] mass_mailing: ease marketing automation inheritanceDebauche Stéphane
Purpose of this commit is to add an anchor in mass mailing view in order to ease some marketing automation fixes. Also reset the sms composer context when sending sms from an sms mailing as it may create some issues when sending manually an sms from a marketing activity (see enteprise). Indeed wrong participant is chosen. Task ID 2073158 (marketing automation fixes) PR #37185 PR odoo/enterprise#5693
2019-09-16[IMP] mass_mailing_sms: fix various issues and ease marketing automation ↵Patrick Hoste
integration Including * allow to keep archives when performing a mass sms. This performs a log in mass in addition to sending SMS in batch, which could slow your sending; * move writing on failed traces in its own method to ease inheritance in marketing automation sms; Task ID 2053632 closes odoo/odoo#36503 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-12[IMP] (sms_)mass_mailing: improve interfaceryv-odoo
- Change the name of "Mass SMS" by "SMS Marketing" - Improve the Mass Mailing views (kanban, form) - Improve the Mass SMS views (kanban, search, form) - Hide the sanitized numbers from views (sometime replace by mobile) - Fix demo data of sms - Explain the language field of sms template - Improve the render of the sms composer wizard TASK_ID : 2053631
2019-08-12[ADD] mass_mailing_sms: support SMS in mass mailingThibault Delavallée
PURPOSE SMS are a powerful marketing tool. For instance it is perfect to announce a sale or to communicate a coupon code, to welcome a new customer in a fidelity program, ... Purpose of this task is to integrate SMS sending in batch in mass mailing. It will use same mailing objects but sending SMS instead of emails. Some metrics and flows will have to be slightly updated at the same time. SPECIFICATIONS Create a new application called "Mass SMS" that follows the structure of mass_mailing application. General guidelines * use the fa-comment icon for this module; * add a "Notification type" field to the mailings: email or sms. Set it invisible and set as domain from context when choosing mass mailing or mass sms application (menus / action specific); * adapt the metrics from Mass Mailing to SMS * sent = received = whether the SMS was sent or not; * opened => we don't have this information; * replied => we don't have this information; * clicks = from link tracker (no change of behavior); * bounced = SMS that failed to be delivered because the format is wrong; * exception = any issue when sending SMS; * keep the Mailing Lists menu, hide email related fields on contact model; * settings: hide the "Specific Mail Server" feature Mailing form view * add an "SMS Content" tab between Mail Body and Options. In there, we should have the following fields: * content * opt-out link: provide a link to the Unsubscribe page. Make it as short as possible; * SMS Template * add an "SMS Text Message" Medium; Mailing actions * add an "SMS Sent" smart button. Use the fa-comment-o icon and it should redirect to the same list views as the "Email sent" smart button and list the contacts to which an SMS was sent; * add a "Mobile" field in the list views of the "Email sent" smart button: * adapt the TEST button > Test Mailing modal to SMS (we should have 1 button for Email and 1 for SMS); update description; * default value for the Recipients field should be Name of the current user, work mobile/phone number; * If there are no Work Mobile/Phone numbers set on res.users, display (123)-456-7890 instead; * rename the Send Sample Mail button into Send Sample SMS; * adapt the SEND NOW button > Confirmation modal to SMS. Change the message into "This will send the SMS Text Message to all recipients. Do you still want to proceed?" * hide the following elements: Subject, From, Reply to, Attachments, Mail Server, Mail Body tab; Opened, Replied; * adapt the label of the following "warnings" to SMS * x SMS Text Message(s) have been ignored and will not be sent. * x SMS Text Message(s) are in queue and will be sent soon. * x SMS Text Message(s) could not be sent. Mailing kanban view * hide the following stats: https://nimb.ws/grvBn0: Opened, Replied; Mailing list / contact management * following fields should be left empty: https://nimb.ws/3HBeJL: Opened, Replied; * when browsing through mailing lsits and contacts through the Mass SMS application, update actions and views to hide fields related to email and display only phone-related information; UTM Campaign * form view > Related Mailings tab: the following fields should be left empty if notification type = SMS: https://nimb.ws/nfvr1O: Opened, Replied Mass Mailing > Reporting (mail.trace.report model) * adapt the reporting based on the fact that we do not have the following metrics for SMS: Opened, Replied; Mass Mailing > Configuration > Blacklist * do not display any email information (phone blacklist is about phone); * support phone blacklist. Phone blacklist is therefore a separate model from mail.blacklist to simplify management. It is included in sms sending process like mail blacklist when mailing in mass; Opt-out and blacklist handling * we do support mailing lists because they could come from different sources and are a way to communicate with a specific audience (and not just a list we bought), e.g. subscribe to this list to be kept updated whenever this product is back in stock, or to receive results of this ... * if the SMSing is from a list, opt-out removes ourselves from the list; * if it is from the contact ==> Sent to blacklist; * allow to attach unsubscription links in sent SMS, redirecting to a new route in mass mailing SMS allowing quick unsubscribe and/or blacklist of phone numbers; Error management * if the user clicks on Send Now / Schedule / Test and does not have enough credits, open the "Insufficient credits" modal in a lazy option (aka when having failed statistics linked to insufficient credits); * on the mailing, we however display this failure as : * a message on the mailing kanban view * a message on the top of the form view + same behavior as the mailing and "Could not be sent" https://www.screencast.com/t/BExgd1Gc; LINKS Task 1997464 PR #34424 Original SMS addition: Task 1922163 (4287481)