Commit Graph
15 Commits
Author SHA1 Message Date
Thibault Delavallée 626557147c [REF] various: remove duplicated sms helper tools
RATIONALE

Simplify field management for mail / phone / sms flows. Make it working out
of the box, easier to use and tweak.

SPECIFICATIONS

Simplify model custom code when dealing with phone and sms by using helpers
and standard behavior defined on all models.

'_sms_get_partner_fields' was introduced at odoo/odoo@bdebcab0ce to have a generic
implementation of finding partners on a record. Since then another version
has been added directly in 'mail' module, using '_mail_get_partners'.

'_sms_get_number_fields' was introduced at the same time to have a generic
implementation of finding numbers on a record. Since then a generic and
improved version has been added directly in 'phone_validation' module, see
'_phone_get_number_fields'.

Those method can therefore be removed, and replaced by the generic ones
available on BaseModel.

Task-3422449 (Mail, Phone: Move and improve field helpers)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130468
2023-08-02 18:50:17 +02:00
Saurabh Choraria 93b7463113 [FIX] event_sms: check model of sms template
When notification type is set as sms we need to check whether the template
which is referenced is coming from a correct model or not.

Applying this commit will fix this issue.

sentry-4195133685

closes odoo/odoo#125831

X-original-commit: 745bcab5ee524ae1c42e5773a86b15ef3a7019d3
Related: odoo/enterprise#42882
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Saurabh Choraria (sauc) <sauc@odoo.com>
2023-06-21 06:57:53 +02:00
Rémy Voet (ryv) 302c7baa87 [REM] core,*: remove name_get_uid parameter from _name_search.
`name_get_uid` is unused (at least since v14) and the
documentation about it, is wrong.

closes odoo/odoo#117819

Related: odoo/enterprise#39483
Signed-off-by: Rémy Voet <ryv@odoo.com>
2023-04-28 16:04:27 +02:00
Hansun (hale) 6a54992575 [FIX] event{._sms}: event: access right for admins of event app
1. Install [Events]

2. On [Settings], create an admin for Events (uncheck all other rights)

3. Click on Events, enter an event

3. Click on [Communication] tab, and try adding a line

Issue: accessing ir.model is blocked
Solution: Find another way

Original fix in 15.0: #112527
Fix of the fix in 15.0: #115881
Original forward-port in 16.0: #115101

This commit is fixing the original forward-port in 16.0 and includes
the fix of the fix.

affected branch: 16.0-master
opw-3163138, 3193659

closes odoo/odoo#116438

X-original-commit: 38594f13586d95c8ed74593ea368e8b51826740b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-03-24 07:45:15 +01:00
Hansun (hale) 5f6c758adb [FIX] event{._sms}: access right for admins of event app
1. Install [Events]

2. On [Settings], create an admin for Events (uncheck all other rights)

3. Click on Events, enter an event

3. Click on [Communication] tab, and try adding a line

Issue: accessing ir.model is blocked

Solution: Find another way

Impacted versions: 15 - master

opw-3163138, 3103199, 3193659

closes odoo/odoo#115237

X-original-commit: db37a4e230f8cd6ac916fe3a21aea5ff43c61d53
Related: odoo/enterprise#38169
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-03-14 19:39:09 +01:00
Raphael Collet c161177cb7 [IMP] core: _name_search() now takes explicit order and limit parameters
This API is much more sensible for making subqueries.  Specifically, one
can generate a subquery without the clauses LIMIT and ORDER BY.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Umesh Gupta cf0398f9c3 [IMP] {event_}sms, test_mail_full: remove record count in SMS composer
Currently we have the record counter in sms composer wizard, that allows
us to select all the records with given active domain (so that instead of
just the records selected by user, SMS can be sent on all the records
matching the active domain).

However, now in standard, we already have a feature that allows user to
not only select records in the current page, but from all the records
matching the current domain in list view. So, in the SMS composer, the
feature to select all records is not much useful, and repeats the
information user already has.

With this commit, we remove this feature and it's related code, to make
the composer simpler and align it with what has been done for the
mail composer. We also improve the wordings for invalid phone number
related warning.

TaskID-2728556
Upgrade PR: https://github.com/odoo/upgrade/pull/3181

closes odoo/odoo#82947

Related: odoo/upgrade#3181
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-30 11:12:46 +02:00
Debauche Stéphane d9ffbe9e89 [IMP] event: merge the SMS template and the mail template into one field
Purpose
=======
A new module "Event Social" will be added in the enterprise PR. This
new module will use a new template type, the "Social Post Template"
adding one more column in the communication tab...

We want to have only one column to select the template (Mail, SMS or
Post template) and therefor we need to use a reference field.

Technical
=========
As we can not set a domain on a reference field, we added a context key
and in the `_name_search` of the `mail/sms.template` we filter with the
domain we want if the key exists.

Links
=====
Task-2127615
See odoo/odoo/pull/46304
See odoo/enterprise/pull/7701
See odoo/upgrade/pull/848
2021-07-14 08:32:59 +00:00
Thibault Delavallée 2520bfe625 [REF] event: manually update completion of mail schedulers
Purpose of this commit is to remove the "done" field computation. Indeed
it is based on either

  * mail_sent field if scheduler is global to the event (before or after
    event). This computation is light as this field changes only once
    when emails are scheduled and sent;
  * status of event registrations compared to all sent communication on
    those registrations. This is costly as adding a new registration changes

In this commit we therefore

  * rename ``done`` to ``mail_done`` to ease grep and understanding;
  * remove ``mail_sent`` as it is integrated within ``done``;
  * manually update ``mail_done`` when updating schedulers instead of doing
    it through a compute method;

Some code cleaning is performed to make it clearer and easier to understand.

LINKS

Task ID-2414658
COM PR odoo/odoo#63093
UPG PR odoo/upgrade#2014
2021-03-24 11:18:47 +00:00
Debauche Stéphane 69df7d3d8a [IMP] event: improve event mail state display
Purpose
=======

Show an icon representing the state of the event mail and number of contacted
registrations instead of the simple checkbox "sent".

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

Instead of the checkbox "sent", an event mail can have 3 values

  1. Sent, if all the mails has been sent;
  2. Scheduled, if scheduled but no attendee have been contacted;
  3. Running, if not all attendees have been contacted;

Note that communication targeting "after registration" are always considered
as being "running" as any new registration triggers a new communication.

A new widget is added that displays an icon depending on the state.

A new field holding contact count is added. When scheduler send emails it is
updated to keep a count of sent communications.

LINKS

Task ID-2414658
COM PR odoo/odoo#63093
UPG PR odoo/upgrade#2014
2021-03-24 11:18:42 +00:00
Thibault Delavallée b41fcc8458 [FIX] event: respect scheduled date when calling mail schedulers execute
In this commit we ensure calling ``execute`` method on communication schedulers
do not send emails or SMS if their scheduled date is still not achieved.
Currently only the cron method does it (see ``run``).

It is now safe to call ``execute`` directly on event communication schedulers.

Related to Task ID-2414658
COM PR odoo/odoo#68158

X-original-commit: 353bc5de9fafbc1527c382614e02438ee799c8a4
2021-03-19 18:38:30 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
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-30 13:42:04 +00:00
Thibault Delavallée abcd6c15cf [MOV] (website_)event(_sale/_question/_track): split main model files
PURPOSE

As event will soon evolve (onchange -> compute, code improvements, addition of
new features) cleaning and improving tests is necessary to help avoid issues.

SPECIFICATIONS

As event model grow in complexity and features, it is easier to find its
way through the application with having registration model lying in its
own file to separate it from event-specific models (event.type, event.event).

Ticket (event_sale) and sponsor (website_event_track) models are also extracted
in their own file.

LINKS

LINKS

Side effect of Task ID 2089156 (event onchange to compute)
Community PR odoo/odoo#43127
Enterprise PR odoo/enterprise#7656
2020-01-10 16:06:40 +00:00
Aurélien Warnon 0d6ddb7bda [FIX] event[_sms]: correctly take parameters from event type mail
PURPOSE

This commit 62ac23f0b9 introduced SMS capabilities on for
event.type.mail and event.mail models.

Values of event_type_mail_ids on event.type are supposed to be copied to
event_mail_ids on event.event when changing the event_type_id of an event.

There are however 2 issues with that integration:

- The 'notification_type' field was not correctly set on default
  event_type_mail_ids on event.type;
- The 'notification_type' and 'sms_template' fields were not copied from
  event_type_mail_ids to event_mail_ids;

LINKS

PR #39892
Task ID 2115792

closes odoo/odoo#41736

X-original-commit: 3fd66d844aa66ca8d54223071c787974e6c88c94
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-12 06:24:35 +00:00
Thibault Delavallée 62ac23f0b9 [ADD] event_sms: allow to schedule SMS in event communication
PURPOSE

Allow the user to schedule SMS communication on events

SPECIFICATION

In event.event form view:
  * rename tab 'Email Schedule' to 'Communication'
  * add a selection field at the beginning of event_mail_ids with label 'Send'
    and values 'Email' and 'SMS Text Message' (required with default value
    'Email');
  * add support of SMS template and SMS sending in event communication;

When sending SMS on event registrations, keep a log of what has been sent.
Use mobile or phone field of event registration as both may contain valid
values, like partner model.

Add SMS template data
  * Name: Event: Registration (see data)
  * Name: Event: Reminder (see data)

Improve registration model
  * add a mobile field to the attendees form view: https://nimb.ws/p0VvyS

Technically this task uses the newly-introduced API methods allowing to
send and schedule SMS.

LINKS

Task 1922187
Part of PR #34705
2019-07-25 11:47:20 +00:00