Commit Graph
359 Commits
Author SHA1 Message Date
Sébastien Theys 671e5b885e [IMP] mail, *: add view model for notification list items
* = im_livechat, sms, snailmail

Part of task-2728107

closes odoo/odoo#82239

X-original-commit: fadb57564209e1b9c4ee6ee993b117b288ac614d
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-01-05 12:50:16 +00:00
Louis Wicket (wil) 41076d1f1c [IMP] mail, sms, snailmail: rename message model
Rename javascript model `mail.message` to `Message` in order to
distinguish javascript models from python models.

Part of task-2701674.

closes odoo/odoo#81366

Related: odoo/enterprise#22883
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-12-15 16:40:21 +00:00
Louis Wicket (wil) 4749ce25a8 [IMP] hr_holidays, mail, sms, snailmail: rename thread viewer model
Rename javascript model `mail.thread_viewer` to `ThreadViewer` in order
to distinguish javascript models from python models.

Part of task-2701674.

closes odoo/odoo#81437

Related: odoo/enterprise#22911
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-12-15 12:07:03 +00:00
Louis Wicket (wil) b024377742 [IMP] mail, sms, snailmail: rename notification group model
Rename javascript model `mail.notification_group` to `NotificationGroup`
in order to distinguish javascript models from python models.

Part of task-2701674.

closes odoo/odoo#81405

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-12-15 11:12:42 +00:00
Julien Banken 0040a7b609 [REF] sms,mail: remove no_edit attribute from fields
It turns out that the 'no_edit' attribute of the fields is deprecated
and doesn't do anything (there is no JavaScript or Python code using it).
We will hence remove that attribute from the views to clean them.

task-2686290

closes odoo/odoo#81210

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-13 09:49:04 +00:00
Martin Trigaux d99cfd9416 [I18N] *: export saas-15.1 source terms
closes odoo/odoo#80964

X-original-commit: 0663892a34896980008eb0de69aeb58019a67e89
Related: odoo/enterprise#22759
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-07 13:48:53 +00:00
Thibault Delavallée 836428788d [FIX] sms: do not force a void context
When scheduling a mass sms with a template, do not force a void body in
context as default value. Indeed it takes precedence on computation of body
based on template and may lead to a void value being given to create.

Task-2709581

Part-of: odoo/odoo#80947
2021-12-07 11:50:54 +00:00
Thibault Delavallée e8796e6302 [IMP] sms: add precompute on fields
As body and composition_mode are required, an override of create has been
added to ensure they have a value. Indeed compute are computed after creation
which leads to required not being satisfied.

Now that precompute[1] are available this code can be safely replaced.

Task-2709581

[1] https://github.com/odoo/odoo/commit/d04a5b5c8c7dc13e4e911a29d1944e90587e2883

Part-of: odoo/odoo#80947
2021-12-07 11:50:54 +00:00
Louis Wicket (wil) 2cb3f774a1 [IMP] mail,*: change model declaration syntax
* = calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot, sms,
     snailmail, website_livechat

This commit will change the declaration of the models with the aim of
getting closer to a plain JSON-object. It allows us to eliminate a wide
portion of boilerplate code, making the declaration shorter, more
declarative, and less redundant, but mainly, it prepares the ground for
further changes.

Task-2695223

closes odoo/odoo#79259

Related: odoo/enterprise#22042
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-11-23 17:53:46 +00:00
Samuel Degueldre ceea5f7852 [IMP] mail: allow users to reply to other messages in discuss
This commit adds a feature where users can reply to messages of other
users, doing this will show a reduced version of the message that has
been replied to above the message once posted, clicking on this reduced
version will scroll to the original message and highlight it if that
message is already loaded.

task-2362251

closes odoo/odoo#77941

X-original-commit: cec2e69e832072dd699274187ddfa122e29d03f3
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-10-06 07:03:59 +00:00
Martin Trigaux e132c36ee6 [I18N] *: export 15.0 source terms
closes odoo/odoo#77898

X-original-commit: ad5afb1d18661784bfcf51bca66e576de1f6c49b
Related: odoo/enterprise#21478
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-10-05 16:54:21 +00:00
Sébastien Theys 3a87aaf914 [IMP] mail, *: clean up message component by introducing view model
* = hr, hr_holidays, sms, snailmail, website_livechat

Message model incorrectly contained data related to a specific component (only
one) even though there can be multiple message components per message model.

This cascaded to adapting related component/models to the same principle.

closes odoo/odoo#76718

closes odoo/odoo#77779

Related: odoo/enterprise#20964
Related: odoo/enterprise#21426
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-05 15:40:49 +00:00
Julien Banken 93425828fc [IMP] mail,sms: remove create button from SMS and Mail failure view
When the user opens the notification panel from the navbar and click on
a notification indicating that an error occurs while sending an sms
or an email, the user will be redirected to a new view listing the users
that did not received the sms or the email. As it makes no sens to create
a partner from that view, we will remove the "CREATE" button.

task-2523036

Part-of: odoo/odoo#71413
2021-09-30 13:31:53 +00:00
Julien Banken e4c583fcc8 [IMP] mail,sms: revamp the resend modals
The error messages of the resend modals can be partially hidden in the
table. The user can therefore have difficulty to understand what went
wrong when the server failed to send an email or an sms. To avoid that,
we will ensure that the error messages will be fully visible in the table.

To improve the interface, we will also update the label of a some fields
and we will automatically hide the 'Send & Close' buttons from the resend
modals when the user did not select at least one recipient from the list.

task-2523036

Part-of: odoo/odoo#71413
2021-09-30 13:31:53 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Chong Wang (cwg) fd85e792ea [IMP] sms: slightly improve sms.sms list view
PURPOSE
We need this commit to provide a better visualization of the status of the SMS
and allow users to retry, send or cancel an SMS from the list view for a better UX

SPECS
sms.sms listview:
* reset 'failure_type' to False when its sms is resent
* 'sms status' column is moved to the right of the 'error code' column
* colors on the whole lines are removed
* the badge widget is used for the 'sms status' column
* new color for badges
    'in queue': blue
    'sent': green
    'error': red
    'canceled': gray
* new buttons are added to directly retry, send or cancel an SMS from the list view
    'fa-paper-plane send now' button
        only visible if the status is 'in queue'
        clicking on this button should effectively send the SMS
    'fa-times-circle cancel' button
        only visible if the status is 'in queue' or 'error'
        clicking on this button should switch the sms to the 'canceled' state
    'fa-repeat retry' button
        only visible if the status is 'error' or 'canceled'
        clicking on this button should switch the sms to the 'in queue' state

LINKS
task-2535005

closes odoo/odoo#74354

Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2021-09-28 10:53:15 +00:00
Martin Trigaux ef8ad324b0 [I18N] *: export 15.0 source terms
closes odoo/odoo#76542

X-original-commit: 63e6807437295519a0f4705fb88644d6d557ca3a
Related: odoo/enterprise#20882
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-09-16 07:17:40 +00:00
Thibault Delavallée 2915a939a8 [IMP] test_mail_full: add some tests, notably for SMS deletion
closes odoo/odoo#75895

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-03 09:26:12 +00:00
std-odoo cc012a0864 [IMP] mail, various: add email templates management levels
Purpose
=======

Purpose of this commit is to add a new group for the mail template designer.
Goal is to make roles clearer: managers edit templates, users use them. This
commit allow some designers / managers to make email template and to let
others users use those email templates.

Specifications
==============

When this feature is enabled in the Settings page, a new group is required to
modify email templates in a composer like wizard or to make dynamic content.
This allows to separate managers editing / composing templates from standard
users that use them.

If the current does not have this group, the email body will be in readonly
mode if he selected an email template. That way we force him to use the email
template that the manager made.

Technical
=========

New Group
---------

Only users in this group will be able to create / write email template or
to write Jinja code in the mail composer (including other fields like subject
in mailing).

By default, all internal users have this group. Mass mailing users also have
this group as writing mailings is about the same management level as writing
templates.

Mail Composer Mixin
-------------------

In comment mode, the template is rendered and then saved on the body field
so non-"Mail Template Editor" users can load email templates.

But in mass mode, the body of the template is saved and then rendered and
many things change the body (HTML sanitizer, web editor move inline CSS
properties, add / remove spaces...). So in this case, we can not know if
the user changed the body or not. That is why we put the body field in
readonly mode so, it is not modified by the web editor.

Jinja code detection
--------------------

To detect dynamic Jinja content, we compile the template, and we browse the
AST. If we do not have a single "Template Data" node, we assume that the
template is dynamic.

When we detect the template as static, we do not render it. That way we
avoid unnecessary rendering.

Code cleaning
-------------

Move Jinja import into tools so that it is outside of mail framework code.

Task-2187263

closes odoo/odoo#75840

Related: odoo/enterprise#20547
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-02 03:42:54 +00:00
Thibault Delavallée 1b3fca70f7 [IMP] sms: allow to keep sent sms
When calling send on SMS, sent SMS are unlinked. If a ``delete_all`` parameter
is true, failed SMS are also unlinked.

In this commit we allow to control that behavior with two boolean, one for
sent SMS and one for failed SMS. This allows to ask to keep sent SMS and
update their status accordingly.

More control is necessary notably to enable IAP feedback on sent SMS as
an error could happen after considering it as sent. Some flows will have to
be updated to decide whether this status is necessary and if SMS are kept.
This commit prepares ground for that feature by already improving methods
and API.

Task-2634957
Prepares Task-2535005 (SMS view pimp) and Task-2560666 (IAP feedback)
PR odoo/odoo#75798
2021-09-02 01:55:27 +00:00
Thibault Delavallée e86268222b [FIX] sms: fix mock when sending sms
Only SMS not in error should be considered as sent instead of being
unlinked. This has no effect on current tests but will be used in
future cleaning.

Task-2634957
Prepares Task-2535005 (SMS view pimp) and Task-2560666 (IAP feedback)
PR odoo/odoo#75798
2021-09-02 01:55:27 +00:00
Thibault Delavallée feb510ae93 [IMP] sms: improve synchronization of SMS actions with notifications
Improve cancel / set outgoing actions on sms model. This notably allows to
synchronize notifications when hitting action buttons on sms form view.

Also add an action to set as error. This will be used when having IAP
feedback on SMS sending.

Task-2634957
Prepares Task-2535005 (SMS view pimp) and Task-2560666 (IAP feedback)
PR odoo/odoo#75798
2021-09-02 01:55:27 +00:00
Louis Wicket (wil) 80d74e7ee0 [IMP] mail, web, *: add support for guest users
* = crm_livechat, hr, hr_holidays, im_livechat, mail_bot, purchase, sms,
    snailmail, survey, test_discuss_full, test_mail, web_editor, website,
    website_livechat

 - Create new model `mail.guest` for guests.
 - Rewrite some RPCs to target routes rather than model methods so that
   guests are able to use them.
 - Patch JS and python models to support guests.
 - Create a stand-alone page and boot the channel in it.

task-2494829

closes odoo/odoo#75496

Related: odoo/enterprise#20417
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-02 00:43:34 +00:00
Zelong Lin 51ff8b09db [REF] *: convert JS files to ES6 modules
* = hr, hr_holidays, sms, snailmail, website_livechat, account_invoice_extract,
approvals, documents, mail_enterprise, calendar, crm, mrp, note, website_slides,
crm_enterprise, sign, social, voip

task-2510656

closes odoo/odoo#72712

Related: odoo/enterprise#19241
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-24 14:31:55 +00:00
Sébastien Theys 07185d4dba [IMP] mail, *: access models without env in tests
* = hr_holidays, im_livechat, sms, snailmail, website_slides

Part of task-2582313
2021-08-19 13:34:59 +00:00
Sébastien Theys 166999e725 [IMP] mail, *: access messaging without env in models
* = hr, hr_holidays, im_livechat, sms, snailmail, website_livechat

Part of task-2582313
2021-08-18 14:56:50 +00:00
Thibault Delavallée 8c16737135 [REF] sms: rename sms.sms error_code to failure_type
PURPOSE

Prepare code cleaning and optimization in mail, mass_mailing and SMS by
cleaning models for readability and code complexity and footprint reduction.

SPECIFICATIONS

Be aligned with mail_mail and mass_mailing naming where failure_type is used
instead of error_code.

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
2021-08-18 13:38:17 +00:00
Thibault Delavallée c178a7829f [REF] mail, mass_mailing: improve mail.notification / mailing.trace failure_type
PURPOSE

Clean mailing code and ease understanding by replacing some old selection
keys by new ones better highlighting their use and aligned with other keys
used notably in mass mailing or SMS.

SPECIFICATIONS

Use shorted and mail-related keys. Indeed we already have sms_ and sn_ for
sms and snailmail related failure type. We therefore update failure_type for
mail as

  * "UNKNOWN" -> "unknown", a generic unknown of uncategorized error;
  * "RECIPIENT" -> "mail_email_missing", indicates email address is
    invalid;
  * "SMTP" -> "mail_smtp", connection issue;

"BOUNCE" key is never used and removed. Actually we use a bounce state for
bounced emails / traces so this key has no use.

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
2021-08-18 13:38:17 +00:00
Thibault DelavalléeandRémy Voet 7e98beef84 [REF] mail: rename mail.notification mail_id to mail_mail_id
PURPOSE

Be aligned with mail_mail model naming as well as convention used in SMS
application (sms_sms_id, sms_sms_int) and mass mailing application (using
mail_mail_id on mailing.trace model).

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907

Co-Authored-By: Rémy Voet <ryv@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-08-18 13:38:17 +00:00
Thibault Delavallée d950b97dbf [REF] mass_mailing(_sms): improve mail/sms and traces failed/ignored state management
RATIONALE

Currently there are differences between mail and sms error management
especially when sending them in batch (mass mode). Moreover cancel
(ignored) and error (exception) states meaning is not clear. Finally
some failure types management between mail and sms can be cleaned.

SPECIFICATIONS

Meaning of ignored / error we want to enforce now is

  * error: there was something wrong at sending and user has an action to
    perform, i.e. server failed -> check its logs;
  * canceled: invalid recipients due to contact information or mailing
    configuration (blacklist, opt out, void or invalid email or phone number).
    In indicates issues linked to records themselves;

In this task we also add failure information granularity on mailing traces
linked to email like what is done currently on SMS. This can be related to
mailing (blacklist, optout, duplicates) or related to recipient (no recipient,
incorrectly formatted).

We also correctly distinguish optout from blacklist when sending SMS.

SPECIFIC USE CASES

  * recipient without email / number: mail / sms is set as canceled, trace is
    ignored;
  * recipient with invalid email (no @) / number (formatting impossible):
    mail / sms is set as canceled, trace is ignored;

    -> we now distinguish when possible a void email from a wrong email using
       a newly-added selection key (mail_email_missing);

  * recipient with email / number blacklisted: mail / sms is canceled, trace
    is ignored;
  * recipient with email / number that optouted from mailing: mail / sms is
    canceled, trace is ignored;
  * recipient with email that bounces: mail is sent and will be set as bounce
    when receiving bounce in gateway; trace follow same path;
  * recipient with number that bounces: not supported as currently no support
    of bounce through IAP;
  * mail server error, IAP error: mail / sms is set as exception / error,
    trace is set in exception;

This means we introduce new failure types on mailing.trace model to reflect
those failure types

  * ``mail_missing``: missing email (different from wrong value);
  * ``mail_bl``: blacklisted;
  * ``mail_optout``: optouted;
  * ``mail_dup``: duplicated email skipped during mass email send;

We introduce ``sms_optout`` on SMS and trace models as it was merged with
blacklist previously. Now both errors are distinguished.

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
2021-08-18 13:37:33 +00:00
Samuel Degueldre a25064380f [IMP] mail, *: introduce messaging components registry
*: hr_holidays, im_livechat, sms, snailmail, website_slides

Most messaging related components have common needs concerning
subscribing to model changes, and not needing to be rerendered unless
their props change. Previously, most components would call the hooks
"useModels" and "useShouldUpdateBasedOnProps" individually. Messaging
components also depend on one another quite a bit, requiring a lot of
explicit imports of other components. It would also be useful to be able
to have cyclic dependencies between component (eg Message renders a
component that allows to delete the message, and the delete component
renders the message in a confirmation dialog), but that doesn't work
with explicit imports (the odoo module system doesn't support cyclic
dependencies).

This commit adds a Component decorator that:
- Registers the component in an internal registry
- Makes all components in this registry available at render time to
components that have been registered in this way
- Calls the useModels and useShouldUpdateBasedOnProps hooks during
component initialization (setup)

enterprise PR: odoo/enterprise#20304

closes odoo/odoo#74982

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-18 10:09:24 +00:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Martin Trigaux 03ff8d4d58 [FIX] *: retrieve model with sudo in selection fields 2021-08-10 13:49:04 +02:00
Xavier-Do 288595f558 [FIX] *: add explicit license to all manifest
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.

closes odoo/odoo#74245

Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-07-26 13:09:57 +00:00
Kevin Baptiste 86aa7b78aa [IMP] *: introduce data-hotkey on form and modal views
Define `data-hotkey` on most used action buttons.

For the modals, the following keys are dedicated for "special"
actions:
 - Alt+G: add
 - Alt+V: save
 - Alt+Z: cancel

closes odoo/odoo#73275

Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-07-15 08:39:49 +00:00
Martin Trigaux 6758868731 [I18N] *: export saas-14.4 source terms
Without demo data

closes odoo/odoo#73560

X-original-commit: 802e46541117573e028b711ea33dad9df9075a39
Related: odoo/enterprise#19602
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-07-12 10:57:37 +00:00
Didier (did) 6240617358 [IMP] mail, *: use explicit export instead of default
* = hr, hr_holidays, im_livechat, sms, snailmail, website_livechat,
    website_slides

Exporting directly on the line of the class or variable definition is less lines
of code and less repetition (and risk or mistake).

Exporting with a name instead of default allows to catch typos more easily when
importing and ensures the same name is used for consistency (and ease of grep).

closes odoo/odoo#72597

Related: odoo/enterprise#19224
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-25 14:56:52 +00:00
Didier (did) 40f2c764b0 [IMP] mail, sms, snailmail: remove default date on message
We should not assume that the default date of the message is "now". A message
should only have a date when it's coming from the database that supply it.

closes odoo/odoo#70069

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-08 13:25:25 +00:00
Stéphane DebaucheandThibault Delavallée 2d6df1fe7a [IMP] mail, sms, mass_mailing: define rendering model at render level and improve mixin code
Currently ``mail.render.mixin`` offers rendering tools, some of them being
based on a ``model`` field. It allows to know which model to use to fetch
records on which we perform rendering. However this field is not defined at
mixin level but in inheriting models without being clearly implemented that
way (see ``mail.template`` or ``sms.template`` models).

In order to clean this mixin it is now defined at mixin level, using a
not stored computed field allowing to define how to find this model. Sub
models are updated accordingly.

Other cleaning is done in the render mixin
  * rename ``_render_template_qweb`` to ``_render_template_qweb_view``
    to indicate it works on views, not on raw qweb templates;
  * extract some common available variables for rendering in a method then
    called / upated for jinja and qweb views;
  * correctly set same rendering context for jinja and qweb views rendering;
  * allow to propagate an additional context from _render_field to sub
    rendering methods;
  * allow to propagate options through rendering methods (notably for escaping
    or safe attributes in jinja);
  * allow to specify engine used to render lang;
  * clean or update some docstrings;

Some tests are also added, as render mixin lacks some more detailed test to
ensure various use cases will be correctly migrated to other engines like
QWeb.

Task ID-2534550 (Template usage improvement)
Task ID-2477164 (Composer mixin)
Prepares Task ID-27033 (QWeb in templates)
COM PR odoo/odoo#70889
ENT PR odoo/enterprise#18352

Co-Authored-By: Stéphane Debauche <std@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-06-01 09:05:42 +00:00
Sébastien Theys c6716847aa [IMP] web, *: clean up notification API
task-2476867

closes odoo/odoo#67009

Related: odoo/enterprise#16760
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-05-27 13:47:23 +00:00
Thibault Delavallée b1c90b96e1 [FW][FIX] sale, mass_mailing_sms, test_mail_full: correctly support partner-only 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

X-Original-Commit odoo/odoo@987d974ccb

closes odoo/odoo#71178

closes odoo/odoo#71205

X-original-commit: 642816d0a819bf74927ed5aa11b6843cbb97d4df
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-25 14:20:08 +00:00
Thibault Delavallée 5d4208d44d [FIX] sms, various: fix override of sms and phone fields methods
There are two mixin involved in SMS notifications

  * mail.thread: standard SMS sending capabilities;
  * mail.thread.phone: advanced use with support of blacklist;

Both require to define fields to use when searching for phone numbers
(generally phone and/or mobile). Those are ``_sms_get_number_fields`` for
mail.thread standard implementation (in SMS module) and ``_phone_get_number
_fields`` for mail.thread.phone advanced implementation (in phone_validation
module).

In this commit we make mail.thread.phone act like a more advanced version
of mail.thread by making _sms_get_number_fields use result of _phone_get_number
_fields, and not the inverse. It allows to remove some overrides notably in
CRM having to define twice fields.

Task ID-2528169

closes odoo/odoo#71111

Related: odoo/enterprise#18428
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-20 15:02:24 +00:00
Munaf Khan 3c71695e2a [IMP] sms: rename 'Cancel' button to 'Discard' in SMS resend wizard
taskID-2465233
closes https://github.com/odoo/odoo/pull/67502

closes odoo/odoo#67502

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-19 12:51:07 +00:00
Munaf Khan 160b5732ef [IMP] sms: allow users to resend SMS
Right now, for failed SMS, user have to go through each record one
by one to resend the SMS, which is not ideal and user should be
able to resend SMS in batch from the list view.

This commit improves the behavior with following changes:
 * Introduces an action 'Resend' which is availabe on list view of the SMS.
   It enables resending multiple SMS (that are in error state). It also
   displays appropriate toast notifcation to users so they know how it
   worked (if few/none SMS sent successfully or there was no SMS that could
   be resent etc).
 * On the SMS form view, a new 'Retry' button is introduced, visible on SMS
   whrich are cancelled or in error state. It pushes the SMS back in sendng
   queue (outgoing state).
 * 'Cancel' button on form view now also appears in error state.
 * Uses the state-decorations on the list view for better identifications
   of the records (info for outgoing, muted for canceled and danger for error
   state).

taskID-2465233
closes https://github.com/odoo/odoo/pull/67502
2021-05-19 12:51:06 +00:00
Thibault Delavallée a8fafbf02e [FIX] crm: correctly compute phone_sanitized without having crm_sms installed
Currently phone_sanitized computation on lead model works only if crm_sms
is installed. Indeed an override of ``_phone_get_number_fields`` is missing.
However ``_sms_get_number_fields`` coming with ``crm_sms`` and its ``sms``
dependency hides the issue as those modules are auto-install. However if
``crm_sms`` is uninstalled phone_sanitized is not correctly computed anymore.

Task ID-2528169
Oversight of odoo/odoo#45315

X-Original-Commit: odoo/odoo@45ae2922e5
2021-05-12 13:35:03 +00:00
Martin Trigaux 41d8b8cf68 [I18N] *: export saas-14.3 source terms
closes odoo/odoo#70673

X-original-commit: bcb9ff784e44462384b0a43a0a23eed7a1111bc5
Related: odoo/enterprise#18269
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-05-11 12:28:28 +00:00
yograj tandel fa6222e7fd [REM] mail, *: remove bugfix files
currently, Across Odoo, there are bugfix folder in around 13 module,
New manifest system allows to add new files in stable so the bugfix files are no
longer required.

after this commit,
all the bugfix files are removed from all module.and all the code in those file
is maintained as per New manifest system.

Task : 2510653

closes odoo/odoo#69830

Related: odoo/enterprise#17936
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-04-27 08:34:58 +00:00
Qiuyu (QHO) bd67479316 [REF] mail, mail_bot, im_livechat, *: convert JS files to ES6 modules
task id: 2487514

closes odoo/odoo#69376

Related: odoo/enterprise#17749
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-04-19 13:33:35 +00:00
Thibault Delavallée 781b61405b [IMP] event_sms, link_tracker, sms, test_mail_full: improve SMS-based mailing tests
PURPOSE

Purpose is to have more tests when sending sms mailings, notably about
canceled or failed mails or sms as well as jinja and links rendering.

SPECIFICATIONS

In this commit we improve SMS Marketing mailing tests. We notably

  * add tests for void and invalid email and numbers. It allows to check they
    correctly update their trace status;
  * add tests for unsubscribe and view links embedded in sms marketing;
  * add tests to simulate a click on links sent through sms marketing and
    ensure click statistics are effectively updated;
  * ensure content of sent sms are checked;

Default content of mailings used in test is updated to ensure jinja is
correctly rendered, including links and some corner cases. This will also
helps ensuring behavior is kept when converting to QWeb.

In event we now correctly use sms gateway mock to ensure SMS finding.

In link_tracker a helper is added to check url tracking in plaintext content.

LINKS

Task ID-2508643
Followup of odoo/odoo#68874 (improve mail tests)
Prepares Task ID-27033 (support QWeb in templates)
Prepares Task ID-2377974 (clean trace and status management in mass mailing)
COM PR odoo/odoo#69461
ENT PR odoo/enterprise#17780

X-original-commit: f1182b9da9aca9e67518fc10c240f3b21895a7ab
2021-04-20 09:18:22 +00:00
Thibault Delavallée 4c2ad37709 [IMP] event, mail, mass_mailing, sms, test_mail: clean some mail tests tools helpers and parameters
In this commit we backport some of 14.1+ improvements done in mail tools
in order to keep a coherent definition through sub versions. We also
improve docstring and add some explanations on available toold and asserts.

Task ID-2500615
COM PR odoo/odoo#68874

X-original-commit: d44c47697389866603f28ff2d5da60a97574ec5f
2021-04-09 14:39:13 +00:00