Commit Graph
11642 Commits
Author SHA1 Message Date
Khushi da287cc2f7 [FIX] mail: activity view model domain
Steps to reproduce:

- Go to activity view.
- Schedule an activity for one record. (Say 8 records are available)
- Schedule an activity for the second time. (Again 8 records are available)
- Try to schedule an activity for the 3rd time. (Only 2 records are available)

Issue:
Since 7682286, the existing props of activity model are being passed as params
while scheduling an activity. Currently, `["activity_ids", "!=", false]` is
being pushed to the domain of activity model in order to display only those
records on which activities have been set. As a result, after you schedule
activities more than once, `["activity_ids", "!=", false]` domain gets applied
and the list of records available for scheduling activity is restricted from
the third time onwards.

Fix:
This commit passes the props from searchModel as params to the 'load' method
while scheduling activity, instead of existing props, to ensure that the
existing params are applied as well as all records are accessible for
scheduling an activity, in `searchCreateDialog`
(i.e.["activity_ids", "!=", false] condition is not added as domain).

Task : 3721750

closes odoo/odoo#155700

X-original-commit: 339df084567206cff8a5487bbe9dec249671244a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Khushi Patel (khpa) <khpa@odoo.com>
2024-02-29 10:34:23 +00:00
Yolann Sabaux 9c9552fd20 [FIX] account, mail: allow account custom sub model tracking
Steps to reproduce:
- Create an invoice and confirm it
- reset to draft
- change the account of an aml (product sales -> asset)
-> on the log note you will see the detail of the modification `Account: 400000 Product Sales -> 101000 Current Assets`
- connect with Demo
- go on the same invoice

Issue:
You will not see the details of the aml account change

This is problematic since Accountant and auditors should be able to see it.

Cause:
Sub-model tracking is not supported. Although we override this constraint in accounting (refer to https://github.com/odoo/odoo/blob/f56de22f10d09e6e34b25cbff04bbb6bf0823e54/addons/account/models/account_move.py#L5058-L5071), it remains inaccessible for users other than base.system. This is because we attempt to locate the account_id field on the model account.move defined in tracking.mail_message_id.

opw-3632295

closes odoo/odoo#155034

X-original-commit: 20f00a73cb280fd9a3636122c4a8a316abcee0d0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
2024-02-29 10:34:18 +00:00
tsm-odoo 440e6a5b86 [FIX] mail: fix non deterministic bus subscription test
Before this PR, the `bus subscription is refreshed when channel is
left` test was sometimes failing. This actually reveals a real issue:
if a channel is joined a leave very quickly, the bus subscription is
not updated.

This occurs because we rely on the last subscription made and the one
that should be made to detect if channels differ. Since the
`updateBusSubscription` method is debounced, we can miss information.

This PR replaces the complicated `updateBusSubscription` method by a
`onAdd/onDelete`. This is much more reliable and more efficient since
there is no need to walk through every channel to detect changes.

This PR also remove a test that was redundant that the failing one.

fixes runbot-55292,57645,56232

closes odoo/odoo#155720

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-28 19:49:13 +00:00
Pierre-Yves Dufays 821156ce90 [FIX] {test_}mail: remove activity assignation check
How to reproduce:
- Install hr with demo data
- Create a user without access to hr and turn it into an employee
- Create a user for Abigail
- Assign Abigail as manager of the new user
- Click on "onboarding plan" in the chatter of the new user
- Then in the dialog, click on "Schedule" button

You get the error "Assigned user test has no access to the document and is not
able to handle this activity." because the new user has no access to the record
employee on which those activities are scheduled.

As activities for which the user has no access to the underlying record are now
displayed in the systray (with no access to the record), we remove the check
that prevent assigning an activity to a user on a record he has no access to.

Technical note: before odoo/odoo#149965, activities scheduled manually were
created with the flag "automated" set to True and when this flag is set the
check that ensures that the user has access to the record is skipped. With
odoo/odoo#149965, as the "automated" flag is set to False when scheduling
activities manually, an error is trigerred if the user has no access to the
underlying record. Here we always skip that test and mark the method as
deprecated because the user can see the activity no matter the access he has on
the underlying record.

Task-3598836

closes odoo/odoo#155576

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-02-28 19:49:07 +00:00
zel-odoo aa87b65dc8 [FIX] mail: thread search works for all channels
1. channel mention should work for channels, chats, and groups, even if
there is a group restriction for the channel.
2. channel mention in livechat is disabled because the visitor can't get
access to the channel.
3. remove the fetch and search for channel mentions in livechat so that
there is no extra rpc call for unuseful data.
4. add a test for the channel mention in thread.

closes odoo/odoo#155380

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-27 17:40:52 +00:00
Rahul Prajapati 96debc0764 [FIX] mail: squashed transient message has date
Before this commit:

Squashed transient messages had date displayed in the sidebar of the message.
This was introduced by this commit: 631ae1c

After this commit:

Squashed transient messages would not have date in the message sidebar.

closes odoo/odoo#154594

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-27 14:41:45 +00:00
Thibault Delavallée 7c6d5394fb [FIX] mail: improve alias domain usability
Ease understanding the purpose of main fields on alias domains. Set bounce,
catchall and default_from available in debug mode as those are advanced
configuration bits that should be displayed (and modified) with care.
Add tooltips on fields to ease understanding the field usage.

Task-3696224

closes odoo/odoo#150401

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-02-26 11:41:54 +00:00
Odoo Translation Bot 4f4ca50e8d [I18N] Update translation terms from Transifex 2024-02-25 00:13:04 +01:00
tsm-odoo 60dc936be1 [FIX] mail: fix missing identifying field in record insert
When a message is posted, the server sends a `mail.record/insert`
notification to update the related channel pin state. In order to
recognize the thread, the client needs its id and its model.
Currently, only the id is passed so the thread pin state is not
updated. This PR adds the model to the notification.

closes odoo/odoo#155150

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-23 16:43:33 +00:00
Sébastien Theys 6ac4cd7d7b [FIX] mail: cache access to newestPersistentNotEmptyOfAllMessage
Store in variable in sort instead of accessing many times (less proxy
get).

closes odoo/odoo#155068

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-23 15:13:53 +00:00
Sébastien Theys 93078feeab [FIX] mail: cache access to message_unread_counter
Store in variable in sort instead of accessing twice (less proxy get)

Part-of: odoo/odoo#155068
2024-02-23 15:13:53 +00:00
Sébastien Theys 551e98e9c3 [FIX] mail: cache access to needactionMessages.length
Store in variable in sort instead of accessing twice (less proxy get)

Part-of: odoo/odoo#155068
2024-02-23 15:13:53 +00:00
Sébastien Theys 0681c5b779 [FIX] mail: cache thread isCorrespondentOdooBot
This value is accessed often during sort of messaging menu, so it's
better to not compute it each time on the fly.

- make it a compute
- access correspondent2 to avoid extra indirection
- store in variable in sort instead of accessing twice (less proxy get)

The performance impact is more visible for subsequent sorting, as the
first one benefits less from the cache (when it still has to be built).

Part-of: odoo/odoo#155068
2024-02-23 15:13:53 +00:00
Sébastien Theys 805713d4b7 [FIX] mail: cache the compute of newestPersistentNotEmptyOfAllMessage
This is a complex compute that is better not done every time we need its
value.

Part-of: odoo/odoo#155068
2024-02-23 15:13:53 +00:00
Sébastien Theys b903eb531f [FIX] mail: cache the compute of message datetime
Avoid doing this process every time the datetime is accessed.

It looks like it is already cached with `_datetime`, but it's not
efficient because there are still many proxy get access (which are
costly).

3 proxy access before: getter itself, reading _datetime twice
1 proxy access after: the field itself

Part-of: odoo/odoo#155068
2024-02-23 15:13:53 +00:00
Rémy Voet (ryv) bb7f0c86ae [FIX] mail: avoid unbatched read of activity's deadline
__getitem__() of BaseModel, reset the prefetch set of the recordset.
Fix _compute_activity_date_deadline, to batched the reading of
activity's deadline.

closes odoo/odoo#154860

X-original-commit: ef7226aaa2f0ad135133fe27bdf1414b7ebf2a92
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-02-23 13:09:57 +00:00
Sébastien Theys 786112af3d [FIX] mail: fix performance of channel is_member search
Part 1: _search_is_member
-------------------------

Separate query to fetch candidate channels because the sub-select that
`_search` would generate leads psql query plan to take bad decisions.
When candidate ids are explicitly given it doesn't need to make
(incorrect) guess, at the cost of one extra but fast query.

It is expected to return hundreds of channels, a thousand at most, which
is acceptable.

A "join" would be ideal, but the ORM is currently not able to generate
it from the domain.

`sudo` is added as well because the rules for the member don't need to
be checked as no information is leaked.

Part 2: clean rules
-------------------

The rule for reading "self" is included in the rule for reading other
members. It can be disabled for "read" to avoid duplicate.
It also checked is_member again, but is_self necessarily implies it.

Part 3: clean tests
-------------------

The opportunity is taken to fix the tests. The tests where considering
as "access error" when there was an assert error inside the test (for
example not finding the channel or the member), but those needed to be
considered as failure regardless of expected outcome of access check.
Extra mute loggers are added to clean the test output.

closes odoo/odoo#153697

Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
2024-02-22 17:46:52 +00:00
tsm-odoo 49fa5c1f3e [IMP] im_livechat, *: show live chat channels as sidebar categories
*: mail.

This PR removes the live chat sidebar category. From now on, each
channel will have its own category. This is a first step towards
providing an efficient way for operators to join/leave a live chat
channel.

part of task-3640730

closes odoo/odoo#154755

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-22 16:23:59 +00:00
Sébastien Theys df8484e833 [FIX] mail: fix performance issue with im status tracking
Move compute of `imStatusTrackedPersonas` to its inverse field. Doing
the compute on the "One" side of the relation prevents from looping and
computing all values whenever there is a change in any of them.

In practice, this reduces the "compute" time of the message fetch (which
also fetch persona as authors of messages), reducing by approximately
half the time it takes to insert these messages (depending on the number
of persona it had to loop through).

For example from 60ms to 30ms on my machine for message insert in
"partner_1_125" (populate medium).

closes odoo/odoo#154918

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-21 17:27:50 +00:00
Zelong Lin 1ae849a7e2 [FIX] Activities: "Cancel" hotkey conflicts
Since 17.0, the `Cancel` button in the `mail_activity_schedule_view_form` uses the hotkey `z`, which conflicts with the other button.

Change the hotkey into `x`.

closes odoo/odoo#154727

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-20 14:57:33 +00:00
Zelong Lin aed6e24e8d [FIX] Activities: add "Cancel" button when launching an activity plan
Restore the "Cancel" button when selecting a plan from the activity wizard.
When we introduced the plan feature in v17, the "Cancel" button was forgotten. The only way for users to cancel the action is to click on the "X" button at the top right. 

task-3754897

closes odoo/odoo#154678

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-20 14:57:28 +00:00
Odoo Translation Bot 1cf48deef9 [I18N] Update translation terms from Transifex 2024-02-18 00:12:23 +01:00
Sébastien Theys c5e5cab080 [FIX] mail: prevent search unexpected load more
Before this commit, if the search result would have "load more", the
extra messages would immediately be fetched, defeating the purpose to
have load more in the first place, and making unnecessary requests.

closes odoo/odoo#154406

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-17 00:26:02 +00:00
tsm-odoo 4f0b262dbe [FIX] bus, mail: fix redundant bus subscriptions
Since 16.3, opening the web client on the Odoo backends results in two
subscribe events being sent through the bus websocket.

Discuss listens to the thread changes to know when the subscription
should be refreshed. In order to do so, the last subscription that was
made is kept. This issue is that this subscription is empty in the
first place so the first evaluation always considers the subscription
should be made.

In order to fix this issue, this PR refine the condition to determine
if the subscription should be renewed:
- The last subscription is different from the last one
- The user joined a channel after the bus initialization
- The user left a channel after the bus initialization

In order to test those scenario in a reliable way, this PR also
backports odoo#147455

closes odoo/odoo#154170

X-original-commit: 109b45f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2024-02-15 18:21:31 +00:00
Sébastien Theys 4f2975a662 [FIX] mail: allow mentioning OdooBot
1. Make sure to return archived users in partner format.

2. Remove the condition to check for archived users in suggestion code.

The condition made no sense since the refactoring (that's the opposite
of what we want, and it didn't compare the partner records correctly).

The feature is broken since https://github.com/odoo/odoo/pull/133065/
because it "fixed" the way records are compared. Making the condition we
don't want in the first place actually working and excluding OdooBot
(instead of allowing it).

3. Since archived partners are displayed anyway since the refactoring,
and nobody complained, let's consider it a wanted feature.

Archived partners are given lowest priority and moved to the bottom.

task-3747277

closes odoo/odoo#154078

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-15 13:50:49 +00:00
Maryam Kia e6097043b9 [FIX] calendar: restore schedule call activity without event
Since PR #137969, the `save` button is no longer available in schedule activity
 wizard.
This PR makes `schedule` button available for call activities like other
activities (except meeting), so user can create a call activity without going to
 calendar view.
Also, we have to consider `has_error` in creating activity so if there is an
error, user couldn't access to `schedule` button. This field is correctly placed
in `mail.mail_activity_schedule_view_form` view but not in the inherited view
in `calendar`.

task-3668732

closes odoo/odoo#152893

Signed-off-by: Maryam Kia (maki) <maki@odoo.com>
2024-02-14 18:32:04 +00:00
mano-odoo f0a52d2c90 [FIX] mail: revert activity button spacing
In commit[1] we changed the spacing of the activity button to dissociate
it from buttons that are "message/communication" oriented.

This spacing was unwanted so we need to revert it back.

task-3730089

[1]: odoo/odoo@e0491c1a62

closes odoo/odoo#153100

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-13 14:14:53 +00:00
Pierre-Yves Dufays 55d51b0882 [FIX] mail: fix activity due date format in the chatter
How to reproduce:
- Install crm with demo data
- Open the crm app
- From the menu "Configuration -> Activity Plans", create a plan
- Open a lead
- Schedule the plan just created for the lead

The log message in the chatter display due date in the wrong format:
Year(4)-month(2)-day(2) instead of the user date format (if your date format is
that one, please change it for testing).

This fixes the problem by displaying the date in the user format.

Task-3639909

closes odoo/odoo#152217

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-02-13 10:07:51 +00:00
Samuel Degueldre 7070925701 [FIX] mail: stop leaking memory in onExternalClick
The onExternalClick custom hook keeps a reference to elements that may
no longer be in the DOM, this can cause entire sections of the DOM that
are no longer needed to be kept in memory, and can also retain the
associated Owl components and their data.

To solve this, we set the downTarget and upTarget to null after calling
the callback. In practice they are no longer used in the code but we are
keeping it for stable compatibility.

closes odoo/odoo#153654

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-12 22:26:16 +00:00
Stanislas Sobieski ac572d1e76 [FIX] mail: setup system example email in base to avoid overwrite at mail install
closes odoo/odoo#153529

X-original-commit: bd4eedc3fbefb75381b2b6457e5145edac2be031
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Stanislas Sobieski (sts) <sts@odoo.com>
2024-02-12 20:24:13 +00:00
tsm-odoo 7d18bf0f83 [FIX] im_livechat, mail: broken history navigation
This PR fixes 2 issues with discuss navigation:

1. Broken backwards navigation when going back and forth from the live
chat session history.
2. Broken backwards navigation when trying to access the same thread
than the current one.

Steps to reproduce 1:
- Open the command palette
- Go to the live chat session history view
- Click on one of your channels
- History back => leads to the session history view
- History forward => leads to discuss
- History back => stays on discuss, history is broken

This occurs because the active id is not passed in the action context
when navigating backwards which leads to the URL being pushed again in
history (URL without active id is different). The active id should be
put in the context when available.

Steps to reproduce 2:
- Go to discuss
- Click on the active thread
- History back => stuck on discuss, cannot navigate backwards anymore.

We should not push in history when accessing the same thread than the
current one.

task-3422516

closes odoo/odoo#153094

X-original-commit: 029b79ad7dc28aab83289e7c3ebd4cc0dcc5d609
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2024-02-12 20:24:07 +00:00
Odoo Translation Bot dd40867949 [I18N] Update translation terms from Transifex 2024-02-11 00:14:17 +01:00
Jeremy Kersten 0ec39e91e5 [FIX] mail, hr_recruitment: fix creation of alias for source
A user that is not admin cannot create an mail.alias.
We can create the alias in sudo since we control the default_values and
model that are created with the new alias.

Check the _check_alias_domain_id_mc constraint in sudo because non amdin
user cannot read model ir.model.

closes odoo/odoo#153222

Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
2024-02-09 18:33:17 +00:00
Andrzej(pian) 2c1e070ad3 [FIX] mail: Fix thread object transfer to chatter in CRM email preview
This commit addresses a problem in CRM where it was not possible to send emails directly from the preview window.
The issue arose when returning to the chatter interface from the preview window,
as the thread object was not properly passed back (to the chatter).
This fix ensures the thread object is reintegrated into the chatter interface, resolving the email sending issue.

Issue was traced back to the commit
5d99de10ec [FIX] mail: do not reload chatter when not needed
https://github.com/odoo/odoo/commit/5d99de10ec09244e10e4130573ad2e0c38e8600

[reproduce]
- install crm
- create activityTypes AT with an email template specified( crm/configuration/activityTypes)
- open a Lead,  ( crm/sales/MyPiepline)
- schedule activity with activity type AT
- click "preview" on the activity
- click "send" or just close the preview -> BUG traceback
opw-3680600

closes odoo/odoo#152698

Signed-off-by: Andrzej Pietrusiak (pian) <pian@odoo.com>
2024-02-08 10:56:59 +00:00
damr cc6ecce5f0 [FIX] base,*: remove force_email from the context in views
ba1a550#diff-36973ac6e1f20b32a00fbcdc1f811c923bbb44ca15a0e068018e904ff565644fR97
The previous PR added some constraints on what can be used on the
context of views. The key word 'force-email' is no longer relevant and
will be removed from the context before reaching the next view/python
code.

This commit's purpose is to remove the force_email that were forgotten.
In order to still open the simplified partner form view, the ref of the
view is given in the context instead. While at it, we also fix the
create option given on the partner_ids field that was inconsistent.

affected version 17.0 - master
task - 3538000
https://www.odoo.com/web#id=3538000&menu_id=4720&cids=1&action=333&active_id=4105&model=project.task&view_type=form

Please enter the commit message for your changes. Lines starting

closes odoo/odoo#149806

Related: odoo/enterprise#54549
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-02-07 12:48:50 +00:00
tsm-odoo d8b294ad96 [FIX] mail, im_livechat: do not start bus for transient threads
Since [1], the websocket worker is started when a transient thread is
added to the mail store. This occurs because this PR introduced a call
to the `addChannel` method of the bus service when the current user
was not member of the thread.

Since transient threads are not yet created, they have a partial state
that does not necessarily include channel members hence the impression
that the current user is not member of the channel.

This PR prevent starting the bus service for transient threads.

[1]: https://github.com/odoo/odoo/pull/146800

closes odoo/odoo#153000

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-07 11:05:13 +00:00
Nasreddin Boulif (bon) d7fc43df58 [FIX] mail: give additional values for partner creation
Steps to reproduce:

  - Install `crm` module (for test purpose)
  - Create a new lead
  - Set an email address, phone number, company name and contact name
  - Save the lead
  - In the chatter, send a mail (with the default recipient checked)

Issue:

  - The partner has only the email address set (also set as name).
  - The `contact name` on the lead is updated with the partner name
    (who is the email address).

Cause:

  When sending a mail with the default recipient checked, the partner
  is created based only on the email address (therefore, name is same as
  email), and when assigning the new partner on the lead, the
  `contact name` is updated with the partner name (who is the email
  address).

Solution:

  Alter the route `/mail/partner/from_email` and `/mail/message/post`
  so it can take or manage additional values for the creation of the
  partner.

opw-3512045

closes odoo/odoo#152780

X-original-commit: 92916985b72ff1cda2021900f0aa9476f7283576
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2024-02-07 09:18:55 +00:00
Aaron Bohy d1e14994a9 [FIX] *: use correct float formatter
Commit [1] moved (almost all of) the code of formatFloat from
views/fields/formatters.js to core/utils/numbers, to make it
accessible in the frontend. A formatFloat function was kept in
formatters.js to handle the false case, which makes no sense in
number utils, but is useful for fields. However, a lot of imports
have been updated to use the numbers.js instead of formatters.js
(i.e. they no longer benefit from the support of false), whereas
they are actually formatting field values, so they should have
kept using the formatFloat from formatters.js

This commit adapts the places where the formatFloat to use must
come from formatters.js, not numbers.js.

[1] https://github.com/odoo/odoo/commit/054ca0a19aaf297f420a1b478b93ae26f1b943b8

task 3722043

closes odoo/odoo#152810

Related: odoo/enterprise#55919
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2024-02-06 20:16:20 +00:00
Tiffany Chang (tic) 94c58407f6 [I18N] *: add in Russian translations
For a first iteration, Russian translations were done using DeepL using
1 large .pot file of all the standard modules to translate (e.g. no
localizations, no test modules, etc). Unfortunately for some reason
doing a msgmerge with the existing ru.po files didn't seem to work, so
old "Translators" metadata at top of files were lost (maybe they will be
re-added during next Transifex sync?)

Part-of: odoo/odoo#152285
2024-02-06 18:49:02 +00:00
Khushi e11e3ca447 [FIX] mail: activity model domain
Steps to reproduce:
Select a document in activity view to get its preview
Click the archive button => traceback

Before this commit:
The 'load' method of Activity Model led to the traceback while attempting
to set the domain of params, when none were received.
(bug introduced by : 7682286)

After this commit:
This issue is resolved by tweaking the code of 'load' method. In case of
default params, it now directly sets a domain, instead of trying to add a
domain to the one obtained in params.

Task ID : 3704340

closes odoo/odoo#152335

X-original-commit: 725ebab1f0c7ffc996414c85fbbd162afc4ecaf5
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Khushi Patel (khpa) <khpa@odoo.com>
2024-02-05 18:24:43 +00:00
Odoo Translation Bot c95419af44 [I18N] Update translation terms from Transifex 2024-02-04 00:11:05 +01:00
Sébastien Theys 4006e346f9 [FIX] mail: onAdd/onDelete hooks on many without inverse
The opportunity is taken to fix an issue where removing a record from
assign would not update the inverse.

closes odoo/odoo#152442

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-02-03 06:59:46 +00:00
EL Alaoui Yassine cdef2d8212 [FIX] whatsapp: check state of phone blacklist
When a customer sends a message to Odoo via WhatsApp, their number is saved in the `phone.blacklist` model, but the active state is set to False. If the customer sends 'STOP', it will be set to True, and if the customer sends a new message, it will again be set to False.

Before sending a message from Odoo to a customer via WhatsApp, we check if the number is in the `phone.blacklist` with this line in whatsapp_message.py

if self.env['phone.blacklist'].sudo().search([('number', 'ilike', number)]):

In SaaS 16.4, this line returns the following SQL request:

SELECT "phone_blacklist"."id" FROM "phone_blacklist" WHERE (("phone_blacklist"."active" = true) AND ("phone_blacklist"."number"::text ILIKE '%32491730941%')) ORDER BY "phone_blacklist"."id";

Here, we check if the Active state is True to block the message if necessary.

In 17, this same line returns this SQL request:

SELECT "phone_blacklist"."id" FROM "phone_blacklist" WHERE ("phone_blacklist"."number"::text ILIKE '%32491730941%') ORDER BY "phone_blacklist"."id";

I correct it in a PR https://github.com/odoo/enterprise/pull/55498

But if we go further we find that it's really because of the active_test = False of this line in thread.py
thread = request.env[thread_model].with_context(active_test=False).search([("id", "=", thread_id)])
from this commit
https://github.com/odoo-dev/odoo/commit/8b2605b99348b7707b3db3db46af880c17c7029c

with the fix of this PR, the discussion on Whatsapp is now possible and we keep the fix of the previous commit.

opw-3704136

closes odoo/odoo#152273

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-02-02 07:53:36 +00:00
John Kirkwood (kij) 4dec76afc5 [FIX] mail: correct HEAD tag typo
closes odoo/odoo#152077

X-original-commit: 81ede4b9114b1eca847dad3d975c243d64215d3e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-02-01 09:49:55 +00:00
Eteil Djoumatchoua(etdj) etdj@odoo.com a3befcc5a9 [FIX] mail: set body on mail.message on event registration confirmation
Steps:
- Go to any event with tickets and using the ticket confirmation
template, sending 'after new confirmation'.
- Confirm a new attendee.
- An email is sent but the chatter only shows the attachment and the
subject, with no body.

Issue:
Chatter should show full content of the email.

Reason:
Above 16.2+ the 'body' is not implicitely set when genrating the
template in ``mail_template.send_mail()``. As discussed with RETH, when
requesting the 'body_html' for a template, setting the 'body' solves the
problem.

opw-3562438

closes odoo/odoo#151930

X-original-commit: 0a3d4b10a7c81d05d9bf6864b0b9a2f48f09b2a0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-01-31 17:13:57 +00:00
Alexandre Kühn dca2921252 [FIX] mail: correctly display Logged in as in public page
`getLoggedInAsText` is a function, due to missing brackets
the function content was dumped instead of evaluation of function.

opw-3701333

closes odoo/odoo#151600

X-original-commit: 4ce21a4207a9dd7047a6b5ec9c447f9e48ca199c
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-01-29 23:16:19 +00:00
Odoo Translation Bot 625dac5a10 [I18N] Update translation terms from Transifex 2024-01-28 00:16:34 +01:00
Thibault Delavallée e86617fd93 [FIX] mail, sms: respect scheduled_date for notification
When a 'scheduled_date' is given to posting API notifications are delayed.
They are send using a cron running on a schedule model. However SMS are
not respecting this parameter. This is now fixed.

We also use sql.now() instead of datetime.now() when checking notification
delay. This leads to values that are consistent through the transaction
and avoid non deterministic behavior.

This leads to fixing a global mock of "cr.now" that has unexpected side
effects in composer tests. Indeed now that the scheduled notification checks
cursor now instead of datetime now this global mock leads to some notification
not being sent. We now mock cr.now() only for creating records, allowing
to effectively test templates using create_date for dynamic scheduled date
computation.

closes odoo/odoo#150911

Related: odoo/enterprise#55052
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-01-24 23:07:09 +00:00
Alexandre Kühn 17a3a84aaa [FIX] mail: fold discuss app category when no conversation selected
Before this commit, when no conversation was selected in the
Discuss app, folding a category such as "Channels" results in
a crash.

This happens because `store.discuss.thread` is `undefined`, so it
must be properly guarded in the template of discuss sidebar category.

closes odoo/odoo#150828

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-01-24 12:30:09 +00:00
Alexandre Kühn e5d7c4fef2 [FIX] mail: squashed message don't grow on mousehover
Before this commit, when a message without bubble layout
is squashed (e.g. with `/who` command twice in a channel),
mouse-hovering on the squashed message pushed increased the
height of the message.

This happens because the sidebar of squashed message contains
the date and it uses 12-hour format with AM/PM.

This design requires cautious use of content in the sidebar,
and had 24-hour format to make it work. A recent refactoring
changed it to 12-hour format as localization was a better concern.
However, the UI is not designed for it, and there's not much value
in having 12-hour format rather than 24-hour format. Indeed,
users assume AM if no AM/PM is shown, except if hour is greater
than 12 which is quite obvious the current time.

12-hour format is best for some users, but we can't have it without
overhauling parts of the UI which is not worth it at the time of
this commit. Therefore using 24-hour format is the better tradeoff.

Also took the opportunity of this PR to better align the date and
seen indicator in squashed message sidebar.

Task-3637270

closes odoo/odoo#150369

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-01-23 04:41:44 +00:00