Commit Graph
174 Commits
Author SHA1 Message Date
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +02:00
Thibault Delavallée adfdf5ab33 [IMP] phone_validation: add a phone formatting tool on model
RATIONALE

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

SPECIFICATIONS

Add a '_phone_format' tool method on BaseModel. It allows to format a number
either directly, either from a field available on the model. It allows to
ease number formatting. It uses available helpers to find numbers using
'_phone_get_number_fields' and '_phone_get_country_field'. With default
generic behavior this allows to simplify most calls to phone number formatting.

Having it available at BaseModel level allows to remove some custom code,
calls to phone_validation API, ...

Task-3422449 (Mail, Phone: Move and improve field helpers)

Part-of: odoo/odoo#130468
2023-08-02 18:50:17 +02:00
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
Thibault Delavallée baf20910a2 [IMP] phone_validation: improve default phone fields heuristic
RATIONALE

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

SPECIFICATIONS

Support by default 'phone' and 'mobile' fields if present on model as phone
fields to fetch when searching for a number. This allows to remove several
of unnecessary overrides always doing the same thing.

Task-3422449 (Mail, Phone: Move and improve field helpers)

Part-of: odoo/odoo#130468
2023-08-02 18:50:16 +02:00
Thibault Delavallée cb8fea4825 [MOV] mail, phone_validation: move field helpers at model level
RATIONALE

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

SPECIFICATIONS

Move 'mail' and 'phone_validation' helpers directly at model level, allowing
to rely on those methods in all models instead of only when inheriting from
'mail.thread' or 'mail.thread.phone'.

Those helpers are used to find primary email, phone numbers or customers in
flows involving sending emails or SMS. A default behavior exists that is
generally valid for most models. Method can then be overridden to implement
their own custom behavior.

Future commits will improve them and remove duplicated computation between
mail, phone_validation, mass_mailing and sms modules.

Task-3422449 (Mail, Phone: Move and improve field helpers)

Part-of: odoo/odoo#130468
2023-08-02 18:50:16 +02:00
Thibault Delavallée c6950aca6d [FIX] phone_validation: add missing translation
An action name was not translated.

closes odoo/odoo#129839

X-original-commit: 43b434f58fa585abcd62579577745a3b725c7f64
Related: odoo/enterprise#44661
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-07-27 14:47:17 +02:00
Thibault Delavallée 2fc8a324d1 [FIX] phone_validation: use international formatting in onchange
International formatting ease reading the value, which is handy in onchange.
This partially reverts odoo/odoo@51d571fab4 .

closes odoo/odoo#129851

X-original-commit: dab802a939c97603f70c504e98ecc92b0ac552f9
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-07-27 07:00:08 +02:00
Louis Wicket (wil) 7da30c7d14 [FIX] mail, *: fix grammar error in field help
This commit fixes a really old grammar error in the help message of the
message_needaction_counter field.

Before this commit: “Number of messages which requires an action”
After: “Number of messages requiring action”

The subject of “require” is “messages”, which is third-person plural, so
it can't take the -s suffix.

closes odoo/odoo#129468

X-original-commit: 0d10cfeaa56d5df23df05f436d353978043f4a71
Related: odoo/enterprise#44509
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-07-25 17:36:08 +02:00
Julien Carion (juca) 6c412be2ea [IMP] *: coherent hotkey uses
This commit makes hotkey uses more coherent throughout the entire
codebase by setting alt+q as main shortcurt for confirm and default
actions and alt+x for cancel actions.

task-3370463

closes odoo/odoo#127469

Related: odoo/enterprise#43694
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-19 18:24:15 +02:00
Thibault Delavallée 0f26b490e1 [FIX] crm, phone_validation: format numbers using E164 standard
Most number formatting is done using E164 standard, see notably
'phone_get_sanitized_number' method in mail.thread.phone.

Some calls are still done using INTERNATIONAL format. Notably on 'partner'
and 'lead' model, an onchange is implemented that formats numbers according
to INTL format. However this leads to inconsistent computation where sanitize
is done using E164, and format using INTL. This makes some computation and
comparisons harders without much real added value.

In this commit we choose to make the onchange on those models use the same
E164 format as the sanitized one. This eases comparisons and usage of phone
numbers through Odoo.

Task-3342820

X-original-commit: 51d571fab4871fd62ce154b6fc1ed573407c7f86
Part-of: odoo/odoo#128118
2023-07-12 12:38:47 +02:00
althaf shaik 063b98bf83 [FIX] phone_validation: confirm unblacklist phone number
This traceback raises when user gives phone number and clicks on
'unblacklist' and 'confirm' button.

To reproduce this issue:

- Install phone_validation
- Make developers mode on
- Open settings/Technical/Phone/Phone Blacklist
- Create a new record and give valid Phone Number
- Then click 'Unblacklist' button and 'Confirm' button

Error: A traceback :"ValueError: Invalid domain term ('number', 'in', '907856')"

On 'action_unblacklist_apply' method returns to call  '_remove' method in
'phone.blacklist' model.

https://github.com/odoo/odoo/blob/5a39b757b703fc2e3edb5b9d59631934cd40b819/addons/phone_validation/wizard/phone_blacklist_remove.py#L14-L22

Therefore in the above usecase '_remove' method uses 'numbers' argument for
searching in 'phone.blacklist' model, as 'self.phone' is a string and it leads to invalid
domain while searching for records.
See:
https://github.com/odoo/odoo/blob/5a39b757b703fc2e3edb5b9d59631934cd40b819/addons/phone_validation/models/phone_blacklist.py#L110-L115

Sentry-4275213194

closes odoo/odoo#127150

X-original-commit: 821136a3f2586852e2b7a299331c8cb79fe9a2d1
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-07-07 10:52:44 +02:00
Martin Trigaux 2afdda2576 [I18N] *: export saas-16.3 source terms
closes odoo/odoo#123046

X-original-commit: 137f5ca0cb703ee953cb01db525362f7a778e6bd
Related: odoo/enterprise#41703
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-01 11:43:51 +02:00
niyasraphy 8aa624c7ed [REF] phone_validation: class attribute to bypass the length validation
before this commit, if user need to bypass the validation
added for the length in custom module, the entire function
has be rewritten in the custom module.

scenario:

* add the phone_mobile_search field to the name search of res.partner model

* then open sale order form, and in the customer field enter any letter or digits, this user
error will be raised

after this commit, users just need to change the class
attribute: _phone_search_min_length in the
inherited module.

closes odoo/odoo#122411

X-original-commit: b89f948ef4789ec8dc400ef8c8e40778d5bbe406
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-25 13:49:55 +02:00
Louis Wicket (wil) 04189318cc [I18N] *: update master translations
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.

This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).

closes odoo/odoo#121629

Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-22 17:52:07 +02:00
Elisabeth Dickinson b2ef35a431 [IMP] *: replace .bg-color by .text-bg-color on ribbons
Also remove unnecessary CSS on ribbons.

Part-of: odoo/odoo#116641
2023-05-12 22:59:16 +02:00
amdi-odoo 02ec80445b [IMP] mail,mass_mailing_sms,*: improve UI
*: phone_validation

- Add sample data in the mass_mailing_sms blacklist phone
numbers tree view.
- Update the mass_mailing_sms demo data so that, instead of
the sms being stuck due to a lack of credits, they are
all sent.
- Swap the mass_mailing_sms list view with the kanban view
so that the list view is the main one like in Email Marketing.
- Rename the reset mail template confirm button from "Proceed"
to "Reset Template" to make the action more explicit.

Task-3280602

closes odoo/odoo#119321

Related: odoo/enterprise#40120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-05 17:06:23 +02:00
Victor Feyens f4ea6d3226 [FIX] *: strict api for main orm methods
Enforce strict types for returned values for
* create
* write
* unlink
* default_get

to make those methods more consistent and reliable.
Also make sure they can be called with empty self/values,
i.e. that they follow the same behavior as the base methods
defined in the main orm Model.

closes odoo/odoo#116809

Related: odoo/enterprise#38880
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-04-25 15:20:43 +02:00
Raphael Collet 7e6cff5479 [IMP] core: search() and _search() no longer have parameter count
The parameter in search() is redundant with method search_count(), and
was making the calls less readable.

The method _search() is aimed at always returning a Query object.  The
method can therefore never return an integer, hence the removal of the
parameter.  This does not actually remove any functionality from the
method; counting result is simply given by using it differently.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
rootandThibault Delavallee bd5f307c66 [FIX] phone_validation: fallback if no region provided
Before this commit if you would call phone_parse() but not pass along a
country code it would crash. This is reproducable by calling the phone_parse
function and not setting a country on the contact. In this case you would get
the following traceback:

  AttributeError: 'bool' object has no attribute 'upper'.

This happens because the phonenumbers library tries to upper() the region but
if Odoo doesn't have a country set it passes along False. By doing a fallback
to 'None' the phonenumbers library will natively handle this and the user in
the UI does not get a traceback.

Task-2852953

closes odoo/odoo#112699

X-original-commit: 9b75d7ac1a912ff3d15c393a6a23018a18b3b9bb
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
2023-02-14 18:11:52 +01:00
Martin Trigaux 776689b0f4 [I18N] *: export saas-16.1 source terms
closes odoo/odoo#110752

X-original-commit: 56b2b52287a8f2192d80ea417c7efac80a87c0a9
Related: odoo/enterprise#36173
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-01-24 10:20:30 +01:00
Thibault Delavallée 418761e344 [LINT] mail, various: use explicit subtype in message_post_{with_...}
RATIONALE

Purpose of this commit is to be explicit in subtype chosen when invoking the
message composer / calling message_post. As default value may not always be
clear, better be explicit in case the composer default value changes.

SPECIFICATIONS

Add explicit references to subtype when it is not obvious what will be the
final subtype, notably when using helpers (post_with_view or template which
uses the composer that is not crystal clear in its subtype management).

In this commit we also add support of XMLID-based subtype when invoking the
composer. A ``default_subtype_xmlid`` context key is transformed into a
``default_subtype_id``, to be used notably in JS where we cannot easily
use a ``ref``-like statement. Post API now also supports 'subytpe_xmlid'
argument allowing to give the xml id and ease calling the methods.

Use ``_xmlid_to_res_id`` to get directly the ID of subtypes in order to
avoid useless queries from ``ref`` that does an exists.

Also remove useless values given to post API, notably author_id that is by
default the current users' partner.

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:33 +01:00
Victor Feyens 13ccd9cee4 [IMP] test_lint: detect useless manifest content
Keep the manifests as light as possible, to easily see custom behavior/content.
Complete the work of previous commits cleaning the manifests content:

* 42bad1a6d2
* ef7005f524

and make sure this kind of cleanup commit is not necessary in the future
because it is now automatically verified by a dedicated test.

closes odoo/odoo#107735

Related: odoo/enterprise#34903
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-16 16:17:41 +01:00
Thibault Delavallée 1844f335d7 [IMP] mail, phone_validation: allow to log a message when (un)blacklisting
Add possibility to add a message when adding or removing a blacklist entry
for both mail and phone_validation (used for SMS). This replaces the
``action_remove_with_reason`` method.

When updating active flag this is added as a tracking note to avoid having
several messages. Indeed message is concatenated with the tracking itself
instead of adding message for tracking + a message for the log itself. When
a new record is created, a note is logged.

Task-2710804 (Mail: Clean MailThread API)
Prepares Task-2150462 (Mass Mailing: Unsubscribe flow refactoring)

Part-of: odoo/odoo#106568
2022-11-25 18:55:20 +01:00
Thibault Delavallée 9a5046ba0a [FIX] phone_validation: correctly support phone/mobile search parameters
Currently the search method defined on 'phone_mobile_search' supports either
a boolean (is set / is not set) search, either considers all searches to be
"like TERM". This is coming from the main usage that is the search view
that sends domains like "[('phone_mobile_search', 'ilike', term)]".

In this commit we improve the method to correctly support

  * direct check (=)
  * negative operators (not (i)like)
  * like / ilike (previously like were considered as ilike)

Idea is: a positive operator check that any of the phone fields respects the
domain (phone or mobile is TERM). A negative operator checks that all phone
fields respects the negative domain (both phone and mobile do not contain TERM).

Tests are added.

Task-3012789

X-original-commit: 8e905343f38a4dae828ccaddc62ce5c6a2f754db
Part-of: odoo/odoo#104111
2022-10-26 00:55:05 +02:00
Abdelouahab (abla) 897eedf22e [FIX] phone_validation : filter by phone/mobile is set
To reproduce
============

Go to Contacts and try to filter by phone/mobile is/not set. A traceback is
raised.

Problem
=======

The search method responsible for this field didn't take into account Value
to filter by to be a boolean.

Solution
========

Correctly support this case in search method.

Add unit test.

Task-3012789
opw-2980542

X-original-commit: 62b7da527c6ddb4654fbccf5c6d8c94158915ebc
Part-of: odoo/odoo#104111
2022-10-26 00:55:04 +02:00
Thibault Delavallée 47f08bf9d3 [FIX] phone_validation: correctly use phone fields when searching on phone/mobile
Currently the search methods defined on ``phone_mobile_search`` field forces
the usage of ``phone`` and ``mobile`` fields on model. This currently works
on models using by default this search field (lead and partner). However this
breaks on any model not having those two fields and inheriting from the
'mail.thread.phone' mixin.

In this commit we use the result of ``_phone_get_number_fields`` to know which
fields to use in the SQL query.

Tests are added to ensure it works as intended.

Task-3012789

X-original-commit: 6b235868da6fed1b2a0eaa7a25dc2202c6fefaa0
Part-of: odoo/odoo#104111
2022-10-26 00:55:03 +02:00
Martin Trigaux 1a8772769e [I18N] *: export 16.0 source terms
closes odoo/odoo#100573

Related: odoo/enterprise#31507
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-20 13:48:49 +02:00
std-odoo 66f5bc4dbf [IMP] portal: allow portal users to deactivate their accounts
Purpose
=======
Allow portal users to deactivate their accounts from the portal view.

After the deactivation, they are redirected to the login page, so
they can verify that they can not longer login with their credentials.

We first archived the record and remove sensitive information (password,
login, so he can not log in again with the same credentials).

After the deactivation, we blacklist the email and the phone of the
user, so we are sure that we never send him again email / SMS.

Then, we create a <res.users.deletion> to delete the user and the
partner in a CRON because this operation can be heavy (write_uid,
create_uid field on all models).

Task-2629544

Part-of: odoo/odoo#78298
2022-06-30 12:10:56 +02:00
Martin Trigaux 5acb6db891 [I18N] *: export saas-15.4 source terms
closes odoo/odoo#93246

X-original-commit: 5ff6d185f70650c26c28a6aef7dd37c859ab58d2
Related: odoo/enterprise#28218
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-06-10 07:27:26 +02:00
Fabien Pinckaers c08fa433e4 [IMP] remove unused indexes (field index included in unique index)
account.account: code was already in unique constraint
account.journal: inverting compound unique constraint to benefit from indexing company_id
hr.employee: user_id already in unique index
phone.blacklist: number already in unique index
stock.orderpoint: product_id already in unique constraint/index

closes odoo/odoo#92932

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-06-07 09:19:27 +02:00
Adam HeinzandThibault Delavallée 2cc76d0db0 [FW][FIX] phone_validation, crm: fix usage of number sanitizing on partner model
``CRM`` application calls ``phone_get_sanitized_number`` on partner model to
synchronize lead values to its partner values. This method is defined in
``mail.thread.phone`` mixin. ``Partner`` model inherit from this mixin in
``SMS`` application which is auto install after mail and IAP. If this app
is removed, code is not reachable anymore and lead synchronize fails.

How to reproduce
  * install CRM and its automatically installed dependencies;
  * uninstall IAP;
  * run lead unit tests -> synchronize crashes due to missing method as partner
    does not inherit from the mixin anymore;

In this commit we define the missing methods on Partner model directly into
phone_validation. In SMS the inherit order is fixed so that the mixin method
takes over the manually defined one.

Fixes #79460.

X-original-commit: eefac25da8d8a01e5f7da8fab35810da402c0bd9
Part-of: odoo/odoo#88970
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-04-19 09:48:15 +02:00
Bruno-brsy 8629eccb96 [FIX] phone_validation: new convention number for Ivory Coast
Step to reproduce:

- Install contacts
- create a new contact and set "Côte d'Ivoire" as country
- add a phone number like this one: (+225) 01 02 03 04 05
- try to send a sms to the number, it's says "(Invalid number)" instead
  of the number, so it's not possible to send the SMS

The Ivory Coast has a new standard for the phone number since the 31
January 2021, the phone number can have a length of ten digits. And we
use the library phonenumbers with the version 8.9.10 and 8.8.1 for the
runbot and the SaaS server, but it's quite old (the 8.9.10 is released
on Jul 12 2018). The library in version 8.12.29 resolve the issue, but
using the recommended installation method, we would not have this
version.

opw-2726582

closes odoo/odoo#86742

X-original-commit: 2f718cd78feeafb82b2d11a58e1a518a69d52c5e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Bruno-brsy <brsy@odoo.com>
2022-03-21 14:01:13 +01: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
dht-odoo 37d94d3f98 [IMP] mass_mailing(_sms), link_tracker: improve action helper messages
This commit improves action helper message and sample data for
different menus of link tracker for better onboarding.

Menus (link tracker)

1) Mediums(action -> utm_medium_action)
2) Source(action -> utm_source_action)

Menus (mass mailing)

1) Mailings(action -> mailing_mailing_action_mail)
2) Mailing Lists(action -> action_view_mass_mailing_lists)
3) Campaign Tags(action -> action_view_utm_tag)
4) Blacklisted Email Addresses(action -> mail_blacklist_action)

Menus (mass mailing sms)

1) SMS Marketing(action -> mailing_mailing_action_sms)
2) Mailing Lists(action -> mailing_list_action_sms)
3) Mailing List Contacts(action -> mailing_contact_action_sms)
4) SMS Marketing Analysis(action -> mailing_trace_report_action_sms)
5) Blacklisted Phone Numbers(action -> phone_blacklist_action)

Menu name changed for following menu.

1)Contacts Lists to Mailing Lists
2)Contacts to Mailing List Contacts

Task-2584073
PR odoo/odoo#74082
2021-08-20 13:11:03 +00: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
Julien Banken f0f1cf3902 [FW][FIX] crm: fix incorrect prefix removal from phone filter
When the user searches a phone number, the search function will generate
a pattern by removing the "+" sign as well as well as the prefix "00" from
the input string.

Problem:

If the input string starts with "+", it means that the phone number will
be prefixed by something different than "00". As the function will
systematically remove the first occurrence of "00" from the input string,
the function can remove part of the input string that does not correspond
to a prefix. The search results can hence be incorrect.

Example:

If the user types "+32485001122", the function will remove the "+" sign
and the first occurrence of "00" from the input string. In the provided
example, the function will search phone numbers matching with the pattern
"324851122" which is incorrect.

Solution:

The function should remove the first occurrence of "00" iff the phone
starts with "00".

Task id: 2479277
COM PR: odoo/odoo#69729

closes odoo/odoo#70954

X-original-commit: 53b4a7cf045df8828716e31e6d2a56cf93123bba
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-07 05:32:25 +00:00
Thibault Delavallée 71f19d55fa [FIX] phone_validation: add country trigger on sanitize phone computation
If country is updated on a record inheriting from mail.thread.phone
its sanitized number should be computed again. Indeed without this
trigger it is not computed and may lead to inconsistencies between
phone numbers and sanitized number.

Task ID-2528169

closes odoo/odoo#70734

X-original-commit: odoo/odoo@d00b291167
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-12 13:59:36 +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
Julien Banken 0bc56aa7a2 [IMP] phone_validation: improve mobile/phone search
PURPOSE

This commit aims to simplify the phone filter of the lead search view
to better manage phone numbers containing letters.

SPECS

The current phone filter will remove all non-digit characters from the
input string. When the user enters an american phone number containing
letters, the filter can sometimes return phone numbers that do not match
exactly with the provided input string.

eg: If the user types "hello123" in the search bar, the filter will
return all phone numbers matching with "%123%". This pattern will indeed
match with "hello123" but it will also match with many other phone numbers
containing only "123".

To fix the issue, the phone filter will no longer trim all non-digit
characters from the input string. The filter will be more standard and
will better manage phone numbers containing letters.

LINKS

Task ID-2424185
COM PR odoo/odoo#64078

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-23 13:15:49 +00:00
Martin Trigaux 9741ef5ee6 [I18N] *: export saas-14.2 source terms
For odoo-master Transifex project, no demo data

closes odoo/odoo#66500

X-original-commit: 813931ac850e5ba4181259a5957ec72226fb670c
Related: odoo/enterprise#16510
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-02-19 08:02:58 +00:00
nounoubensebia cb311051cc [IMP] phone_validation, crm, sms: improve phone/mobile search results
Before this commit the user had to type in the exact same formatting to find contacts.
After this commit the user will be able to get better search results and does not have to type the same formatting.

To avoid code duplication, the existing _search_mobile_phone method has been moved to the mail_thread_phone class, so that it could be used by both the crm and res_partner models.

Task-2435233

closes odoo/odoo#64490

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-26 13:29:43 +00:00
Thibault Delavallée 75f23a6a89 [REF] phone_validation, various: remove phone.validation.mixin and inline it
PURPOSE

Remove complex or technical code adding few value.

RATIONALE

phone.validation.mixin is used in two models: crm.lead and res.partner. It only
add a phone_format method used in onchange. We can inline this code in those
two models and remove the whole mixin itself. It lessens inherit and class
complexity.

SPECIFICATIONS

Remove phone.validation.mixin. Inline code in crm.lead (CRM application)
and res.partner (phone validation module). Make phone_format private as
it is now some internal tool method on those two models.

Everything should behave as before this commit. No functional change is
intended.

LINKS

Task ID-2416789
COM PR odoo/odoo#63333
ENT PR odoo/enterprise#15296
UPG PR odoo/upgrade#2025

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-15 08:14:01 +00:00
Denis Ledoux 885977da13 [FIX] phone_validation: assign mobile_blacklisted and phone_blacklisted
Make sure to assign a value to the computed fields
`mobile_blacklisted` and `phone_blacklisted`
in their compute method for all record included in `self`

Otherwise, not assigning a value for one record included
in `self` can result in a cache missing error.

```
Traceback (most recent call last):
  File "/tmp/tmp3l14ain7/migrations/base/tests/test_mock_crawl.py", line 143, in crawl_menu
    self.mock_action(action_vals)
  File "/tmp/tmp3l14ain7/migrations/base/tests/test_mock_crawl.py", line 212, in mock_action
    mock_method(model, view, fields_list, domain, group_by)
  File "/tmp/tmp3l14ain7/migrations/base/tests/test_mock_crawl.py", line 238, in mock_view_form
    [data] = record.read(fields_list)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3001, in read
    return self._read_format(fnames=fields, load=load)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3021, in _read_format
    vals[name] = convert(record[name], record, use_name_get)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 5620, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/odoo/src/odoo/14.0/odoo/fields.py", line 980, in __get__
    raise ValueError("Compute method failed to assign %s.%s" % (record, self.name))
ValueError: Compute method failed to assign crm.lead(974,).phone_blacklisted
```

closes odoo/odoo#59870

X-original-commit: 55d7b9d3304f75aa2089c32c4a907066da4dc4b8
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2020-10-13 13:59:31 +00:00
Thibault Delavallée 5f37bad75d [FIX] crm: remove unnecessary warning in phone format
In this commit we remove the warning logger when not being able to format
a phone number. Indeed this does not indicate there was a real issue.
It simply indicates that either the phone number is not parsable or not
matching given country format.

It happens in a lot of situation that phone numbers are not valid: bad
encoding, country mismatch due to {lead, task, ticket} / partner not always
being the same, ... This should not raise a server warning.

When using frontend SMS composer for phone number, a warning is displayed
to the user telling the number is probably incorrect. This is considered
as sufficient from UX point of view as it warns users. We do not think
we should warn admins that some data is incoherent in database.

This commit also

  * Revert "[FIX] crm: avoid linking demo leads with an unrelated partner"
    This reverts commit 2c94c4c81ffa171158586cd64828d27c537cd1d6
    -> having "invalid" data should be a valid use case of real life

  * Revert "[FIX] crm: get correct country for phone validation"
    This reverts commit a58f9fc154c038d72031b281e2bec2c0fc2915ba
    -> country of a lead comes from its partner if set but can be different.
    Same for phone numbers. Values on a lead after a compute are considered
    as complete. Sales persons could effectively have incoherent data on their
    form view but that is the result of what has been encoded.

Task ID-2325228

X-original-commit: cecc4ca6f02e599e193c3fa688bfcbd02ac0580b
2020-09-28 10:12:23 +00:00
Martin Trigaux 90d85eb9c5 [I18N] export saas-13.5 source terms
Without demo data

closes odoo/odoo#56869

X-original-commit: 33f251b6489455cd7221f2c62dee0400a69784b8
Related: odoo/enterprise#12836
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-01 11:18:00 +00:00
Victor Feyens ad6b5e35f2 [IMP] *: do not translate logs
The logs should all be in the same language, s.t. one does not need to 
understand multiple languages when browsing/reading the server logs.

closes odoo/odoo#53984

Related: odoo/enterprise#11615
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-07-02 15:12:56 +00:00
Martin Trigaux 400cc4f14e [FIX] *: correct all or improve code translation lookup
This commit fixes all issues detected by the new pylint
gettext-variable test.
It converts some calls to the new syntax
  _("Foo %s", bar)

to progressively migrate the code to the new syntax.

A few calls were not technically incorrect but still detected by the
linter.

  _("Foo" +
    "Bar")

has been converted to

  _("Foo"
    "Bar")

as it has the same effect and make sure the argument is of type
asteroid.Const instead of BinOp).

closes odoo/odoo#53683

Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-06-30 10:19:59 +00:00
Martin Trigaux 80e97e98ce [IMP] *: use named placeholders in translated message
When more than one parameter is present in a message, it helps the
translation to use named placeholder. This way, the order can be
changed. It also helps the comprehension of the message.
2020-06-18 13:03:34 +02:00