Commit Graph
162 Commits
Author SHA1 Message Date
Sébastien Theys 6dacefd50a [FIX] mail: standardize way to get guest from context
Backport of `_get_guest_from_context`.

Prevent crash when unexpected (not recordset) values are in the context.

Ensure the mere existence of a value (example integer) does not lead to
executing flows where an actual guest is expected.

task-2819597

closes odoo/odoo#127831

X-original-commit: 3d1890e88b99f059377d8b227b56d77798157397
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-10 15:33:06 +02:00
Yannick Tivisse b1f7e56f79 [IMP] base: Remove private res.partner type
- Improve performances, as the ir.rule restricting private partners
  visibility is also applied on res.users by inheritance, on each
  prefetch.
- Solve the issue of partners set as followers on records (eg: application
  form) and then made private, making them impossible to contact via the
  chatter.
- Solve the multiple access issues when trying to access the bank
  account, or the private address for non HR people like the accountants
  forcing the usage of sudo in the business code.

TaskID: 3101400
2023-07-05 14:21:28 +02:00
Maryam Kia ec93077b8d [IMP] mail: Edited label on edited message
By this commit, If a user edits the message body or changes
the message attachments, the edited label in the blob,
shows the last edit Info.

Task-2664848

closes odoo/odoo#117896

Related: odoo/enterprise#40208
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-05-04 14:03:42 +02:00
Sébastien Theys c1a3ad8e01 [REF] mail: move channel specific code of reaction to discuss
The opportunity is taken to clean the methods to make the override
actually possible.

Part of task-3265211

closes odoo/odoo#119942

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-27 17:21:53 +02:00
Sébastien Theys b1772094b1 [REF] mail: move discuss.channel code to its own folder (models)
This commit focuses on removing all references to discuss.channel from
code located in /models of mail module.

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#119413

Signed-off-by: Debondt Didier (did) <did@odoo.com>
2023-04-26 19:49:08 +02:00
Sébastien Theys 90cb44e1e1 [REF] mail, *: rename mail.channel to discuss.channel
* = bus, calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot,
    mass_mailing, privacy_lookup, test_discuss_full, test_mail,
    test_mail_full, website_crm_livechat, website_livechat, base

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#118354

Related: odoo/upgrade#4553
Related: odoo/enterprise#39661
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-21 02:21:53 +02:00
Didier (did)andSébastien Theys 611069fb65 [IMP] mail: improve get_mention_suggestion performance
"Order by" makes the query really slow.

On a database with 1000000 partner and 10000 user, this query goes from 5.5s to
600ms. Once cached by Pgsql it goes down below 100ms.

task-2982401

closes odoo/odoo#118198

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2023-04-11 15:17:35 +02:00
Renaud Thiry 035057a522 [IMP] mail: track contact address
Currently there is no way of knowing who changed the address
of a partner. This field is of high importance and should be
tracked to be able to follow who is editing it.
As addresses are represented with a bunch of fields, tracking
them individually would result in weird-looking tracking
messages with each value stacked on top of the other.

To avoid this, we take advantage of the fact that tracking can
be used on non-stored compute fields to log any change as a
change over the full address.

The full address is derived from the contact_address field to
take advantage of the existing regional formatting of addresses.
It is however modified to replace return to lines with commas to
accomodate the formatting of tracking messages in the front-end.

task-3165293

closes odoo/odoo#114695

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-03-30 16:22:45 +02:00
7710c3331e [REF] mail, *: refactor Discuss
This commit refactors discuss code to use OWL components
and new tools and services in web/.
Functionally, Discuss app should work relatively the same as
before this commit.

closes https://github.com/odoo/odoo/pull/110188

Related:
https://github.com/odoo/enterprise/pull/38058
https://github.com/odoo/upgrade/pull/4423

closes odoo/odoo#110188

Related: odoo/upgrade#4423
Related: odoo/enterprise#38058
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre (aku) <aku@odoo.com>
Co-authored-by: Didier (did) <did@odoo.com>
Co-authored-by: Géry (ged) <ged@odoo.com>
Co-authored-by: Louis (wil) <wil@odoo.com>
Co-authored-by: Maël (mapa) <mapa@odoo.com>
Co-authored-by: Maryam (maki) <maki@odoo.com>
Co-authored-by: Sébastien (seb) <seb@odoo.com>
Co-authored-by: Thanh (tso) <tso@odoo.com>
Co-authored-by: Matthieu (tsm) <tsm@odoo.com>
Co-authored-by: Zelong (zel) <zel@odoo.com>
2023-03-17 11:47:09 +01:00
Zelong Lin 0cc3b3e6d3 [FIX] mail: portal user access error on init
closes odoo/odoo#114568

X-original-commit: bccdf65192140308d4661482a9dcb431cba8126a
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-03-07 16:56:48 +01:00
Pierre-Yves Dufays 3f413ca3da [FIX] mail: fix incorrect view form for partner auto creation
This fixes the problem of the full res_partner form being displayed instead of
the simplified one in some cases (and vice-versa).

The problem can be reproduced by the following steps:
- launch odoo without xml dev_mode enabled (otherwise the cache is disabled)
- in helpdesk, go to an existing ticket and click on an existing customer (this
will load the full form for the customer into cache)
- create a new ticket by first completing name and customer name, save it
- complete the email address, save it
- go to "Send message" and click on the email checkbox
- the full form is loaded instead of the simplified one
(base.view_partner_simple_form)

It is also possible to get the simple form instead of the full form by
reversing the order of the visited forms.

Technical note: The problem has been fixed by adding the context key
"force_email" as cache key using _get_view_cache_key override. Indeed,
_get_view_cache uses _get_view which result depends on that context variable in
its redefinition in res_partner.

Task-3024050

Part-of: odoo/odoo#105111
2023-02-23 14:53:57 +01:00
Pierre-Yves Dufays 1018c72571 [IMP] mail, test_mail: allow model to provide partner default values
Allow model to provide default values for auto creation of related res_partner
such as name, title, company_id, ...

It is used when claling 'Partner._find_or_create_from_emails()' that now
accepts custom data when creating partners based on a given email_normalized.
This allows notably to flatten a loop due to multi-company when creating
partners from emails in template management. It is now done using this email
based dict allowing to create all partners at once.

Task-3024050

Part-of: odoo/odoo#105111
2023-02-23 14:53:56 +01:00
Thibault Delavallée 023bc67327 [IMP] mail: introduce a batch version of Partner._find_or_create ()
Purpose is to be able to create find or create partners in batch based on a
list of emails. When sending email in batch, notably using templates, doing
sequentially a search or create for each potential email to contact is not
efficient from computation point of view. This commit introduces a new batch
method for that purpose.

If no valid email is found for a given email, it is used as it to try to
find partners with same invalid email and/or keep the value in order to
allow updating it afterwards. Notably with notifications resend it is
possible to update emails, if only a typo prevents from having a real
email for example.

Falsy emails do not create partners as those have no real interest.

Task-3034875 (Mail: Speedup and batch partners find or create with templates)
Prepares Task-2088884 (Mail: Use editable computed stored fields in composer)

Part-of: odoo/odoo#99482
2023-01-17 20:58:33 +01:00
Sébastien Theys c4ab3252f5 [FIX] mail: prevent crash as guest when partner email not set
closes odoo/odoo#100518

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-09-19 17:16:35 +02:00
Zelong Lin d57c64f95b [IMP] mail, *: remove 'public' field in channel
*: im_livechat, website_livechat

Access right should be based on channel type and membership instead.
Chat always private, group always private, channel private should
disapear and be a group instead (migration needed), and other channel
always public (but they can still be further restricted with
the "allowed groups" feature)

task-2632861

closes odoo/odoo#90415

Related: odoo/enterprise#30980
Related: odoo/upgrade#3850
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-06 10:57:59 +02:00
Sébastien Theys 545d23888b [IMP] mail, im_livechat, *: add typing for guest and clean code
* = bus, hr_holidays, test_discuss_full

- use channel member instead of partner for typing
- use channel member instead of partner for all other return values from server
- remove temporary partner hack in livechat and keep public partner
- remove some obsolete convert data
- adapt format methods accordingly

task-2664853

closes odoo/odoo#98923

Related: odoo/enterprise#30760
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-09-01 20:21:58 +02:00
Thibault Delavallée 3cc931ef58 [IMP] mail: add helper to find customer partner on thread
Purpose is to use it notably in Voip where we link activities / phonecalls
to partners when possible. Future commits will use it more often in thread
methods.

Method to have the primary email is moved with that helper method in a sub
section, in order to have "model" helpers in the same section. Its code is
also simplified and fixed (return missing). Its name is made coherent with
other naming in the file.

Task-2884301 (Voip activity synchronization simplification)

Part-of: odoo/odoo#93682
2022-08-26 03:42:58 +02:00
Louis Wicket (wil) fdcaa53ca0 [IMP] mail, *: rename mail.channel.partner to mail.channel.member
* = calendar, crm_livechat, hr_holidays, im_livechat, privacy_lookup,
privacy_lookup, test_discuss_full, test_mail_full, website_livechat

closes odoo/odoo#95912

Related: odoo/upgrade#3681
Related: odoo/enterprise#29433
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-19 11:50:37 +02:00
Raphael Collet 6cf8db906f [REF] *: adapt code to new flush API
closes odoo/odoo#87527

Related: odoo/upgrade#3497
Related: odoo/enterprise#26939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-05-25 18:00:47 +02:00
Ivan Yelizariev df30d4d7c4 [FIX] mail: process first 100 mail failures only
Processing failed mails is quite consuming operation that leads to browser
slowness or even crash. It's especially painful, because user doesn't see the
reason for it.

Bypass the problem by processing first 100 notifications only.

---

opw-2810681
opw-2754243
task-2806549

closes odoo/odoo#90246

X-original-commit: ec2d3550f32ae1e0585630b5b38befb73ddf2b26
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2022-05-02 19:47:01 +02:00
Thibault Delavallée 93b6282ed6 [FIX] various: remove unnecessary .id in domains
Even if ORM normally filters them out, no need to specify .id in domains.
This leads to better and easier to read queries / domains.

Task-2816580

closes odoo/odoo#85648

Related: odoo/enterprise#24911
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-04-12 08:21:08 +02:00
Fabio Barbero 8ed0c6f54f [FIX] mail: add check valid email address
Purpose
=======
The method find_or_create of res.partner overwritten in mail does not
take into account the parameter assert_valid_email. This commit adds a
simple check and test.

Task-2799577

closes odoo/odoo#86943

X-original-commit: 7a07b365370d03e963aa7f7d9d19df7ee33e8a1c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-22 22:13:04 +01:00
Sébastien Theys 47bda95b98 [FIX] mail, sms, snailmail: fix perf of fetching failures of user
We are currently lacking an index with (author, failure) due to the information
being spread out in two different tables which are both rather big (there are a
lot of non-failure messages for the current user, as well as a lot of failure
messages for other users), so the fetch of failures for the current user can
become extremely slow (> 20s).

With this new index, the query takes less than 1ms.

task-2742946

closes odoo/odoo#83451

Related: odoo/upgrade#3204
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-02-01 18:07:02 +00:00
Sébastien Theys 08a3df6428 [FIX] mail: prioritize internal users when looking for mentions
Since https://github.com/odoo/odoo/pull/73689 all internal users are no longer
known at init. Unlike what was stated in the corresponding PR, the code of
mentions wasn't actually good enough to allow it without any drawback.

This PR fixes the issue by prioritizing internal users on the result of the RPC.

As a bonus the internal user state is immediately returned when fetching
followers, which allows mentions to be accurate even before the RPC is done.

task-2695224

closes odoo/odoo#80645

X-original-commit: 86de2f231be87b289deb85c3b20b93d890cce918
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-11-30 18:23:49 +00:00
Didier (did) db4e07e52e [FIX] mail: exclude portal user from the DM search
Before this commit, a user could DM a portal user.
Portal user are not supported and can't chat.

task-2632874

closes odoo/odoo#77568

X-original-commit: a7eda6d7314e7261ddda32620fae817f1d828bae
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-30 19:42:15 +00:00
Nikunj Ladava 7a1345876a [IMP] mail: enable tracking on important partner fields
This commit enables tracking on vat, parent_id for the contact, because the
impact of changes of these fields are very important.

We also manually track portal status change. To avoid a costly computed
field, this is done through manually logging portal access change as a note
on the user partner's chatter.

VAT field naming is also updated to match view naming used in inherited
views.

TaskID-2586195

closes odoo/odoo#74692

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-06 12:03:05 +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
Julien Giannone 845bb6cc93 [IMP] mail: add group chat feature
task-2360934

closes odoo/odoo#75633

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-08-26 17:25:06 +00:00
Sébastien Theys b1f3340042 [IMP] mail, hr_holidays: add member list on channels
task-2368906

closes odoo/odoo#75605

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-08-26 11:34:52 +00:00
Thibault Delavallée 1b4e0099d4 [MOV][FIX] mail: quickly reorder code parts, remove dead imports, fix code bits
Reorganize code to ease future additions understanding and setting code
at the right place.

Rename some compute methods to have understandable names.

Remove dead imports.

Fix pytz.utc usage.

No functional change comes with this commit. This is only code move.

Task-2631873
PR odoo/odoo#75571
2021-08-25 13:12:11 +00:00
Sébastien Theys 4cd70f164e [IMP] mail, hr, hr_holidays, *: batch mail partner format
* = test_discuss_full

Overall less queries.

Changes:

- Batch `mail_partner_format`.
- Batch `user.employee_id` compute.
- Remove query for current leave state, use fields (and prefetch) instead.
- Move current leave state in partner format instead of channel info.

Part of task-2622462

closes odoo/odoo#73174

Related: odoo/enterprise#20186
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-12 15:22:59 +00:00
Sébastien Theys 9772512e7a [IMP] mail, *: batch channels at init messaging
* = im_livechat, test_discuss_full

Less code, less queries.

Part of task-2622462
2021-08-12 15:22:37 +00:00
Sébastien Theys 96d7102ee2 [IMP] mail, *: move init messaging in models and avoid self.env.user
* = im_livechat, test_mail

The goal of moving it in models and making it independent of current user is to
be able to test it easily in future commits.

Part of task-2622462
2021-08-12 10:11:42 +00:00
Francois (fge) f6f1b1f571 [IMP] mail: access to chat window from the command palette
From this commit, it will be possible to access the chat window
of a partner/thread from the command palette.

In the palette command, if you type :
    - @ then it will display partners
    - # then it will display threads

TaskID-2593197

closes odoo/odoo#74436

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-11 08:38:10 +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
Sébastien Theys 810d5fd8aa [IMP] mail, im_livechat: add new UI for inviting members on channels
Opportunity is taken to clean the various follow/join/invite methods into only
one `add_members` method.

Part of task-2360169

closes odoo/odoo#74425

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-07-30 15:52:33 +00:00
Sébastien Theys c96a30a8fb [IMP] mail: remove static mention suggestions
Returning all the users at init does not scale. Mention suggestion code is good
enough now that this is no longer necessary.

closes odoo/odoo#73689

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-07-14 10:45:44 +00:00
Anh Thao Pham (pta) 0d528d7007 [FIX] mail: prevent use of private addresses for followers, recipients,...
- Connect with Admin
- Go to Contacts, edit himself by adding a Private Address
- Create an Internal User without "Access to Private Addresses" right (i.e. User X)
- Go to any app implementing chatter (i.e. Sales)
- Create a SO
- Add the created Private Address as follower
- Make sure User X can access the record (i.e. Sales: Administrator)
- Connect with User X and open the SO
An Access Error is raised while trying to fetch data about the followers.

This commit prevents to:
- add a private address as follower of a record
- add a private address as Recipient in full composer
- propose private addresses when adding a mention to a partner

opw-2428936

closes odoo/odoo#68493

Task-id: 2463622
X-original-commit: 20536e1bbeb641539c0de44364f8376e7cef651b
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-03-30 07:45:02 +00:00
Xavier DubucandSébastien Theys e3ecccd641 [FIX] mail; hr: restore faster and more accurate mention suggestions
The code from v13 used to look for partners in JS before making the RPC, which
was much faster, and also gave better results by returning partners that were
already known and therefore more likely to be selected.

The same logic is reintroduced here, and further improved to take into account
all known partners and sort them according to the likeliness they will be
selected based on various criteria.

task-2413776

closes odoo/odoo#68045

X-original-commit: 930e090ced8134c3819a5a87b9052467ba23e8e4
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2021-03-18 10:32:27 +00:00
ryv-odooandThibault Delavallée ba9e79f29c [REF] mail: rename mail.notification table
RATIONALE

A bit of history. Link between a message and its recipients has been added
at first mail refactoring towards a Chatter / Discuss feature. It was done
in v7 at d64f3c9783 with the base addition of mail notification model (lots
of commits follow that one but that's the first one about notification).

Due to some people thinking that it was unnecessary to keep a model for
notification it has been removed in v9 at 88b8cd0587. Notification table was
renamed from mail_notification to mail_message_res_partner_needaction_rel.

It was proven to be a mistake even if those "some people" were warned and
model made its way back to Odoo in v10 at 72dfcae2a4 . Table name mail_message
_res_partner_needaction_rel was kept to ease migration and backward
compatibility.

It is now time to complete the circle and rename it to mail_notification.

SPECIFICATIONS

Rename ``mail_message_res_partner_needaction_rel`` to ``mail_notification`` .

RIP JEM.

Never forget.

LINKS

Task ID-2477444
Prepares Task ID-2377974 (trace management cleaning task)
Prepares Task ID-2070632 (channel members main task)
Prepares Task ID-2419762 (channel members followup task)
COM PR odoo/odoo#67382
UPG PR odoo/upgrade#2245

Co-Authored-By: Rémy Voet <ryv@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-03-05 15:20:53 +00:00
Thibault Francois f001e026a2 [IMP] mail: improvement perf of find_or_create
Behavior before the commit
--------------------------
find_or_create define in mail module called
super if no partner is found based on the email_normalized

super call find_or_create define in base that make
a search again on the email before the creation

This cost two search every time a new partner should be created
and the search on email is less efficient than the search on
email_normalized

after the commit
----------------
Only the search on email_normalized is done before the creation

drawback: if a module that does not depends on mail module
override find_or_create the code will not be triggered anymore
the module should depends on mail module

closes odoo/odoo#65565

X-original-commit: 49d5b3813e57f2cd91d582de9b9bb534f05d2dc3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-02-05 10:23:53 +00:00
Thanh Dodeur e77e205252 [FIX] bus, mail: fix im_status for archived partners
Before this commit, archived and deleted partners had not their
im_status being updated automatically. There were some issues
with this, notably:

- odoobot 'bot' status was not displayed in chatter
- im_status of partners becoming archived were not updated.

This commit fixes both issues.

task-2329591

closes odoo/odoo#60567

X-original-commit: 63b081c49da089c839479b807de8c0cea45221da
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-10-22 17:23:13 +00:00
Didier (did) bc5654f0a4 [IMP] mail, mail_bot: move notif request and OdooBot name into mail
task-2282334

closes odoo/odoo#56616

X-original-commit: bde23b82029507e525cf55d11b050af5f820a06b
Related: odoo/upgrade#1705
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-26 15:49:21 +00:00
Sébastien Theys c2918c139b [IMP] web, *: improve mock server and replace most mail mockRPC
Improve mock server:

- add support for mocked `fetch`
- add support for `active_test`
- add support for x2m `in` in domains
- add support for default values computed from a function
- implement a more natural "next id" compute
- allow initial data without ids
- ensure write and x2m commands integrity
- improve bad data/bad commands error messages
- always warn for failing RPC, not only in debug mode
- fix all existing tests that had inconsistency data

Other changes done in mail (or dependents) that are not just related to tests:

- remove `direct_partner` from formatter result
  ->`correspondent` can be computed from other keys, especially `members`

- fix `livechat_visitor` convertData
  -> only process if there is value

- add `current_partner` and `current_user_id` as `init_messaging` result
  -> easier to mock than session

- remove usage of `need_moderation`
  -> that was just a search indirection to `moderation_status`

- adapt `partner_id` -> `res_partner_id` key in `_notification_format`
  -> to be consistent with field name

- add name in result of `mail_partner_format`
  -> sometimes display_name is not the same

- remove usage of `is_moderator`
  -> that was just an indirection to `moderation_channel_ids`

Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523
task-2287171

closes odoo/odoo#55854

X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d
Related: odoo/enterprise#12391
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-13 16:26:35 +00:00
Xavier Morel 470fb905a9 [FIX] base, mail: properly annotate Partner.find_or_create
In 6e25a510b3 `find_or_create` was
modified to return a recordset rather than just an id. This made it
incompatible with the RPC protocol and it was not annotated to
downgrade the return value back to an id.

Fixes odoo/odoo#54466

closes odoo/odoo#54476

X-original-commit: a7e3894e20207b714cebefa908be090967866791
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-07-15 07:36:23 +00:00
3fea5b2136 [REF] mail, *: refactor messaging with OWL
This commit is a significant rewriting of client-side discuss, chatter,
chat window, and messaging menu using OWL. The behavior should be broadly
the same, with some slight functional changes here and there.

From a technical standpoint, the code of messaging is mainly organized in 2
main groups of modules:

- models, which are logical entities that depict the client-side state of
  messaging as a whole.
- components, which are in charge of displaying information from models.

This refactoring also introduces new JS guidelines regarding folder structure
(/static) and naming rules for JS modules.

Community PR: https://github.com/odoo/odoo/pull/39023
Enterprise PR: https://github.com/odoo/enterprise/pull/6249

Task-1914207

This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier,
with the precious help of Lucas to speed it up towards the end.

closes odoo/odoo#39023

Related: odoo/enterprise#6249
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre Kühn <aku@odoo.com>
Co-authored-by: Julien Giannone <jgi@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2020-06-15 18:12:21 +00:00
std-odoo 56b02d54c8 [IMP] mail: track the email and the phone of the partner
PURPOSE

Get rid of email / phone behavior on lead that is hard to understand: if
and contact is set fields are readonly, if not they are editable.

SPECIFICATIONS

Track partner update of email and phone field. Now, when an user writes on the
email or phone of a lead, it also writes on the partner. That is why we want to
track those fields.

Task ID 2207636
PR odoo/odoo#48395

Related: odoo/upgrade#1025
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-18 15:03:29 +00:00
Thibault Delavallée 6e25a510b3 [REF] base, mail: improve partner creation from name / email
Rewrite code parsing name (_parse_partner_name) to make it easier to
understand. Tweak find_or_create to return directly a recordset with the
found partner / new partner instead of a name_get result.

Also inherit Partner.find_or_create() in mail in order to benefits from
email_normalized field, allowing to improve the search on matching emails
and avoid duplicates.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:14 +00:00
helly kapatel 355f99069a [FIX] mail: do not mention on archive users
Archived users are inactive, so we shouldn't be able to ping them.

Task-2046885

closes odoo/odoo#40814

X-original-commit: 8169e34a2230b9a2aff359dc6a69b59c04fc9908
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-11-25 13:02:10 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00