Commit Graph
6032 Commits
Author SHA1 Message Date
Xavier Morel 5c5876d74f [REM] osutil: deprecated code
We deprecated all those in 14.0, so 16.0 seems like a good time to
remove them.

`getppid` was not deprecated but it doesn't seem useful to keep

closes odoo/odoo#97987

Around: windows support was added to getppid in Python 3.2.
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-08-16 09:19:14 +02:00
Luis González 12dc06ebef [FIX] base: don't lose sudo when searching partners
Currently, when searching a partner through a related record using
`sudo()`, the superuser privileges are used when searching the record,
but not when searching the related partner. That's because the su flag
is lost during the call to with_user, even if it was to keep the same
user.

For instance, a code like the following wouldn't work if the current
user has no enough rights (e.g. the public user):

    self.sudo().search([('partner_id', 'ilike', 'John Doe')])

To solve the above, the with_user is called only when a specific
name_get_uid is given, as done in the _search implementation.

closes odoo/odoo#97920

X-original-commit: e5e12681437ae562517cc058e4ce0fab90cd0ae7
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-08-12 23:37:34 +02:00
Thibault Delavallée b3fc41cc44 [IMP] mail: add a post server action
Currently only an email action based on template exists in server actions when
having mail app installed. It basically sends an email based on a mail template.

However being able to post a message on record is also useful. Instead of
sending emails it post on a document as a comment or as a note, like what
users can do using the chatter. Notification flow for those cases is the
classic from post: followers, specified partners, Inbox/Email, ...

Task-2613245 (Server actions mail update / cleaning)
Closes #45640

Part-of: odoo/odoo#75906
2022-08-12 23:37:03 +02:00
Thibault Delavallée 138ab8ef14 [REF] base, mail, sms: cleanup ir.actions.server model constraints
In this commit we cleanup server actions model in order to make it a bit
more inlined with current code state of the art.

  * add no_create / no_open on technical fields (m2o towards fields notably)
    as creating or updating fields on the fly is not the purpose of base
    automation module;
  * rewrite onchange into compute or constraint methods;
  * add compute methods to cleanup data when changing configuration (model or
    trigger). Some fields have no usage except in some configuration better
    reset their value. Notably fields linked to the chosen model should be
    reset;
  * add constraints for invalid configuration, notably for models coherency
    with mail features;

Task-2613245 (Server actions mail update / cleaning)

Part-of: odoo/odoo#75906
2022-08-12 23:37:03 +02:00
Rémy Voet (ryv) f80d8e00e4 [IMP] *: optimize redundant calls to exists()
Making a `exists()` on a record got by a `search()` is useless and
lead to a extra useless query. Remove them.

closes odoo/odoo#97482

Related: odoo/enterprise#30133
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-08-11 17:56:38 +02:00
Julien Castiaux 4ec4ca4a83 [IMP] base: cover filestore gc with tests
closes odoo/odoo#96242

Signed-off-by: Raphael Collet <rco@odoo.com>
2022-08-11 17:56:31 +02:00
Adrien Widart 320025ee63 [FIX] base: convert barcode type if incorrect encoding
To reproduce the issue:
(Need stock_barcode)
1. Create a product:
    - Barcode: 1234567890123
2. Print the label
3. Try to scan the barcode and check the value read.

Error: The value is 1234567890128, the last digit is incorrect (8
instead of 3)

When printing a barcode, we use the library 'report-lab' to generate a
barcode image from a value and a barcode type. In case of EAN-13, if the
value contains a non-digit character, it will raise an error. We then
catch the error and retry to generate the barcode according to the
barcode type Code128:
https://github.com/odoo/odoo/blob/87698d90f02bfe93c6e643f4876a5ccd74788eff/odoo/addons/base/models/ir_actions_report.py#L569-L575
However, if the value contains only digits, the method will use the 12
first digits:
https://github.com/mattjmorrison/ReportLab/blob/dade0f303cb6fcdbe535c4cc92e6102c2417b699/src/reportlab/graphics/barcode/eanbc.py#L187-L188
and will then add the last one, the check digit, which is computed by
the library. This explains why, in the above use case, the barcode value
returned by the scanner is not the same than the expected one.

Note: Similar behavior with type EAN-8

OPW-2902150

closes odoo/odoo#97052

X-original-commit: a2c7470f8fd46b2520f7b8f0750c63216273ce96
Related: odoo/enterprise#30160
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-08-11 12:51:05 +02:00
Chong Wang (cwg) 51c7734ef3 [IMP] base: allow non-administrators to search res.groups by names
before this commit:
users without read permission of ir.module.category cannot search
res.groups by names. An access error will be raised.

after this commit:
all users with read permission of res.groups can search res.groups
by names

closes odoo/odoo#97877

Signed-off-by: Raphael Collet <rco@odoo.com>
2022-08-10 19:15:53 +02:00
Julien Castiaux f213f7e349 [IMP] core: support partial http response
An HTTP Partial Request is a regular GET request with a Range header
that indicate what chunk of the data the browser wishes to download. It
is useful to peek in a video stream or to resume an interrupted
download. The server can respond with a 206 - Partial Content response,
set the appropriate Content-Length and Content-Range headers and only
send a chunk of the data in the body.

Werkzeug's `send_file`, the library function we use to stream files over
http, is fully compliant with partial requests and responses. It
understands the Range request header and create the corresponding
response.

NGINX does also comply with the Range header even via X-Accel-Redirect.

closes odoo/odoo#97422

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-08-10 18:10:40 +02:00
Rémy Voet (ryv) bfc2e76af2 [IMP] base: add index on key of ir_ui_view
The `key` field is often (`_get_view_id`/`_get_specific_views`) used to
find an ir_ui_view. Because `key` doesn't have index, PostgreSQL will
always do a SeqScan. Because the table is small, it doesn't create a
huge performance bottleneck, but it still not very efficient.

closes odoo/odoo#97478

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-08-10 14:43:26 +02:00
Rémy Voet (ryv) 63b2790eac [IMP] core: improve compilation result of qweb
`content = self._compile_to_str(content)` is done twice in the compiled
method of qweb. Remove it once.

closes odoo/odoo#95755

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-08-10 14:43:07 +02:00
Victor Feyens cfe9172884 [ADD] base: standard test commons
* Consistent currency used for tests
* Consistent base data (partner & users)

Part-of: odoo/odoo#96791
2022-08-08 12:33:02 +02:00
Victor Feyens e32bf2384a [IMP] base: setUpClass instead of setUp
Do the setup once by test class.

Part-of: odoo/odoo#96791
2022-08-08 12:33:02 +02:00
Audric Onockx (auon) bc880f2af0 [FIX] base: address operation context keys in calendar view
Prior this fix, creating an action with (e.g.)
additional_context : {create: 0} wouldn't have any effect
on calendar view.

Now, if this context key is added, the user won't be able to create.
Also true for delete and write.

closes odoo/odoo#97538

X-original-commit: 8d108f32b8333f0698427f9a7f12765c8addd8ae
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-08-05 04:45:02 +02:00
Rémy Voet (ryv) e96666ccd4 [IMP] base: add the reason of skipped test in log
When test are skipped, we don't have any information of why.
It seems important to log also the reason, it can help
developers to find the source of issues (example: when your chrome
doesn't the devtools active: you just know that test is skipped, but
don't know why)

closes odoo/odoo#97481

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-08-05 03:38:23 +02:00
stefanorigano (SRI) 56064ff1e4 [REM] *: drop oe_clear class in favor of clearfix bootstrap default
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2918463

Part-of: odoo/odoo#97051
2022-08-04 13:54:14 +02:00
Xavier Morel bcb3e35754 [FIX] test_main_flows: properly terminate tours
- the community version would finish with a wizard opened in edition
  mode, add a "real" final step of waiting for the wizard to finish
  processing (the invoice to be marked as paid)
- the enterprise version would finish on the reconciliation widget,
  which is always an edition-mode form, check that the reconciliation
  succeeded and (as in the accounting tour) return to the accounting
  dashboard afterwards

Part-of: odoo/odoo#96517
2022-08-04 09:14:11 +02:00
Xavier Morel 992fb00b64 [FIX] test_new_api: properly conclude tours
- the x2many tour would finish on a click canceling the creation but
  not wait for that to resolve, leading to the driver catching it in
  the act (checking before the client had had the time to switch),
  just need to wait for the list view to be displayed
- the constraints tour would just drop in the middle of a creation
  with an error dialog open, so need to finish the entire thing and go
  back to the list view

Part-of: odoo/odoo#96517
2022-08-04 09:14:10 +02:00
Xavier Morel b31bb2cf98 [FIX] core: add missing timeouts on end-of-tour waits
Not entirely sure why they come into play, but apparently they
sometimes do.

Part-of: odoo/odoo#96517
2022-08-04 09:14:09 +02:00
Xavier Morel 07ecd396b0 [ADD] core: error if a test finishes with a form being edited
Since 54ea956490 the form view has an
"urgentSave" fallback when the page is unloaded (tab closed, page
navigated away from, ...).

In tours, this translates to new network requests being performed
during the browser cleanup, possibly chaining further into more
network events.

Flag these tours as incorrect (by making them fail if we find a form
in edition mode after receiving `"test successful"`).

Adjust testing of http cases because I've added an empty line between
the signal and the actual message for better readability on complex
error messages.

Also provide opt-out, as for some tours it's difficult to impossible to
truly fix them: the `allow_end_on_form` class attribute can be set to
`True` in order to disable the new behaviour.

To implement this, update the browser runner receive the test class
directly (rather than just the test class' name) for more
introspection flexibility.

Part-of: odoo/odoo#96517
2022-08-04 09:14:09 +02:00
Martin Trigaux ffc525419a [IMP] base: avoid render with env mixup
The render API was confusing as mixing the access to the report and
the rendering env.

The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.

This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value

This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.

Task-id 2670865

closes odoo/odoo#91341

Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-02 11:48:46 +02:00
jjbenavaz c724126791 [IMP] base: add index and unaccent to store_fname field on ir_attachment model
Improves the odoo garbage collector for large amounts of attachments.

The odoo garbage collector takes around 20 sec to process 1000 records. In one of our deployed projects with production data, there are 790,000 records. According to our tests, each batch of 1000 records takes 20 seconds and hence the whole process is currently taking around 4 hours to complete, as shown below:

(790,000 records / 1000) * 20 sec *(1 min / 60 sec) * (1 hour / 60 min) = 4.38 hours.

Since the Odoo garbage collector routine runs periodically and currently takes more than 4 hours, this behavior is not acceptable in this application, because if there is any other app that tries to use attachments at the same time (for instance invoicing), it will not be able to do it since the Odoo garbage collector will lock the table, leading to a deadlock.

After adding the index parameter to the store_fname field the total time decreased drastically from 4 hours to 10 seconds since now each batch of 1000 k records takes only 13 ms.

closes odoo/odoo#97281

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-08-02 10:32:11 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Xavier Morel 1a65d18ef7 [IMP] core: increase timeout in watch mode & tell client
Currently, when enabling watch mode on a tour the tour's timeout does
not change. This is usually an issue because:

- watch mode makes tours a bit slower, so they can timeout even
  without doing anything
- trying to diagnose what's wrong, it's common to add check steps with
  a long timeout or even a `debugger` statement, which trips the
  python-side timeout and kills the tour

To avoid needing to remember to update the timeouts (then revert them
afterwards), just bump the timeout to 1h by default, or 10x the
original time for very long tours (e.g. qweb test suite, which
currently has a 30mn timeout).

While at it, forward the watch mode status to the client via the QS,
so we can eventually make use of it for one reason or an other.

closes odoo/odoo#96994

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-08-01 07:32:39 +02:00
FrancoisGe a4df8804f4 [FIX] web: one2many contains at least 4 lines
An X2many always has at least 4 lines. If the X2many contains less
than 4 filled lines (Record or "Add a line") empty lines are added
to make up the difference.

For example, an X2many in edit mode containing only one record:
- Line containing a record
- Line containing "Add a line
- Empty line
- Empty line

closes odoo/odoo#97070

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-29 17:12:50 +02:00
Nicolas Lempereur 65a0eb7272 [FIX] base: fix autoresize and exclude gif
Odoo may resize attachment image with side larger than 1920 pixels.

But for animated gifs, this resizement seems to in general increase size
file which is not what we want (in some case making it grow from 3MB to
60 MB).

So with this change, we only resize and optimize images that are not
gifs.

Reasoning: pillow doesn't seem to resize GIF (and seems to only increase
their size, especially animated GIF, because each frame is not
optimized) so we should just not touch them.

Note:

- currently tiff were not resized (because of a mimetype typo)
- currently image dimensions were not resized (from our test, resizing
  on the dimension does not change the size much, quality is most
  important).

both of these issue have been solved in this commit.

opw-2897291

closes odoo/odoo#97083

X-original-commit: 6d903d61adba11c9e46009511fd4065dbc8a9e0c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2022-07-29 15:53:43 +02:00
Laurent Smet fd764968b8 [FIX] base: Fix pdf generation for l10n_ch QR-bill
When printing the qr-bill for multiple records, we are no longer passing the code spliting the pdf for each record since 'attachment' is not checked on the qr-bill action report.

Bug introduced by:
https://github.com/odoo/odoo/commit/38e4a5fbc35b6089ec70b27e5ae74cc83c981a17

closes odoo/odoo#97050

X-original-commit: afaf7c1db4500c6115f119ff3592027e7b3b550d
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-07-29 15:53:31 +02:00
Pierre Paridans 7d9faadc5c [FIX] web,base: switch to newly installed lang button color
Steps to reproduce:
- Open Settings
- Add Languages
- Select a language
- Click Add
=> Text in the "Switch to..." button is miss-aligned and color is
unreadable.

This commit fixes the alignment by removing an exception to the dialog
footer's buttons alignment selector which is no longer needed and to
avoid confusion between inner-fields and buttons container.

Also, it fixes the color by rendering the language name as a readonly
text instead of a link inside a button (sic).

closes odoo/odoo#97007

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-07-29 15:53:24 +02:00
Alvaro Fuentes 27854c787a [IMP] test_base: test add/remove implied groups
Given a recordset R of (at least two) groups, and a group A.
We want to ensure that:
* `R._apply_group(A)` adds A to the list of implied groups of _all_
  groups in R.
* `R._remove_group(A)` removes A from the list of implied groups of
  _all_ groups in R

This is especially problematic for config settings of the form
```
class MyConfig(models.TransientModel):
    _inherit = 'res.config.settings'
    group_imply_A = fields.Boolean('x',implied_group='A',group='B1,B2')
```
since activating the implication via `group_imply_A=True` currently
fails in case only one of B1,B2 already implies A.

opw-2832741

closes odoo/odoo#96928

X-original-commit: 81dc64740ba46355462ed2169e57fc0ce694ccdb
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
2022-07-28 10:28:03 +02:00
Alvaro Fuentes af886f3673 [FIX] base: correctly apply implied groups
If one of the groups in `self` implies the group `implied_group` then
the rest won't be updated.

This also contradicts the way the settings are later checked (which is
correct) on
https://github.com/odoo/odoo/blob/f2c214e227db7c9ec2340ef87644f2f7c2e370c5/odoo/addons/base/models/res_config.py#L508

See 4f19f29a

opw-2832741
upg-356843

X-original-commit: 1754c744c8d00925d40c44742de3600389f7af47
Part-of: odoo/odoo#96928
2022-07-28 10:28:02 +02:00
Lin WenwenandJulien Castiaux c06cee44fe [FIX] base: serialization bug when acquiring cron
Start Odoo with multiple cron threads (e.g. --max-cron-threads=4),
trigger many crons at once, there is a chance one of the cron thread
fails due to a serialization error.

Inside of the `_acquire_one_job` function, the query evaluates many rows
to find one that fit multiple requirements. Two of those requirements
are (1) that the `nextcall` of the row is in the past or (2) that it
exists a cron trigger for that cron with a `call_at` in the past.

In case the `nextcall` of one of those rows is modified or the cron
triggers are removed by another transaction then there can be a
serialisation failure in the current transaction. This serialisation
error is important, it prevents the current cron worker from acquiring a
cron job that has been processed in another cron worker.

The problem is that that postgres doesn't tell which row was modified by
the other transaction (=processed by another worker cron) so it is not
possible to just skip that cron and continue with the others.

Our solution is to limit the WHERE clause of the `_acquire_one_job`
function to a single row. In case there is a serialization failure we
know the cron was processed in another job and we can skip it.

Closes #96584

closes odoo/odoo#96926

X-original-commit: 684750a0c2c83acffb32e555bd3140a2c76d7219
Signed-off-by: Julien Castiaux <juc@odoo.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
2022-07-28 10:27:58 +02:00
Xavier Morel e75f2989b4 [FIX] core, web: Pillow 9.1 deprecations
Pillow 9.1 deprecates most if not all toplevel Image constants:
https://pillow.readthedocs.io/en/stable/releasenotes/9.1.0.html#constants

These constants have been moved to thematic enum classes (e.g. all the
resampling constants in `PIL.Image.Resampling`).

This triggers warnings in Odoo, and the removal delay is quite short
(slated for Pillow 10, release planned mid 2023). Pillow 9.1 is also
already in Debian Bookworm (current testing).

Fix by shimming at the import level: if the enums are available import
them into the local namespace, otherwise alias `PIL.Image` itself as
to the enum.

closes odoo/odoo#96799

X-original-commit: 7be04d31bad078681ef0a2919234c11840a2e8e2
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-07-28 02:40:23 +02:00
Nasreddin Boulif (bon) 00fe2a4ba2 [FIX] base: retrieve last rates only from current company
Steps to reproduce:

  - Install accounting module
  - Ensure there is 2 companies
  - Activate both companies (with company switcher)
  - Go to Accounting -> Configuration -> Currencies
  - Select currency `EUR`
  - Add a rate and set second company as company
  - Disable second company (with company switcher)
  - Click on `Show Currency Rates` in action menu
  - Click on create

Issue:

  Access Error

Cause:

  Currency Rate model have a compute field `rate`.
  This last one calls `_get_latest_rate` that will retrieve the last
  rate for the currency. To do so, it will first retrieve all rates for
  the currency (that might include rates with company not same as the
  current one) before fitering regarding company.

Solution:

  Use sudo(). Same issue/fix for `_get_last_rates_for_companies`.

opw-2832708

closes odoo/odoo#96714

X-original-commit: dda5c9084b9913968e67c8b280de870c81227e16
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2022-07-27 21:21:40 +02:00
Xavier-Do 555ef06fa5 [IMP] tests: allow to disable auto retry
Auto retry can be usefull to avoid breaking a build because of a
small tour or query count, but for long tests like qunit, this can be
painfull when a real error is triggered.

This commit proposes to disable autoretry on demand for some tests
to solve this issue.

This may be applied on all tests longer than a few seconds.

closes odoo/odoo#95440

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-07-27 16:33:56 +02:00
arg-odoo ef5a9612f7 [FIX] base: avoid KeyError in res_partner._display_address
In some case, users use custom `address_format` with keys that do not
exists. This lead to errors in odoo and upgrade process. Avoid
`KeyError` by using defaultdict with `str` value.

upg-361146
upg-361241

```
Traceback (most recent call last):
  File "/home/odoo/src/odoo/14.0/odoo/service/server.py", line 1201, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/odoo/src/odoo/14.0/odoo/modules/loading.py", line 457, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/home/odoo/src/odoo/14.0/odoo/modules/loading.py", line 349, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/home/odoo/src/odoo/14.0/odoo/modules/loading.py", line 227, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/home/odoo/src/odoo/14.0/odoo/modules/migration.py", line 180, in migrate_module
    migrate(self.cr, installed_version)
  File "/tmp/tmp1bew9m7l/migrations/website/14.0.1.0/post-adapt-footer-data.py", line 69, in migrate
    address = html_escape(partner._display_address(without_company=True))
  File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/res_partner.py", line 950, in _display_address
    return address_format % args
KeyError: 'town_name'
```

closes odoo/odoo#96703

X-original-commit: 81bf1d2101202a4a6cb832004500129905c2d3be
Signed-off-by: Christophe Simonis <chs@odoo.com>
2022-07-27 14:04:40 +02:00
Aurélien Warnon 2160315869 [FIX] tools: fix profiler datetime usage
This commit fixes the profiler datetime usage by properly using the
'real_datetime_now' as a callable.

This was breaking the output json file when profiling.

closes odoo/odoo#96456

X-original-commit: 5fec27e42b033f79933afb3d0c85b142360981f9
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-07-25 07:51:02 +02:00
+2 bc0a0cead6 [IMP] web,*: enable owl list & form views
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.

We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).

[1] odoo/odoo#92475

Part-of: odoo/odoo#78221
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2022-07-22 16:21:45 +02:00
Jorge Pinna PuissantandSamuel Degueldre 2c9db825c1 [REF] base,web,*: convert settings form view to owl
*hr_timesheet,point_of_sale,website

This commit moves the settings form view implementation from base
to web, and converts it to owl.

The setting's search has been improved to take into account more
elements. Before, it was possible to only search on the field's
labels. Now, we can also search on the field's description, and
the titles of setting's group.

Part-of: odoo/odoo#78221
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2022-07-22 16:21:42 +02:00
Simon Genin (ges) aba9f9d25b [FIX] base: restore partner's kanban badge hover effect
This commit fixes the background/text color inversion when hovering the
badge in the Partner's Kanban cards.

This was due to the missed conversion of `.badge-pill` class in BS5,
which removed it in favor of the more generic `.rounded-pill`. For
simplification, the selector is adapted to the more generic `.badge`
(independantly to its form).

closes odoo/odoo#96360

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-07-21 00:50:23 +02:00
Abdelouahab (abla) 5bc83b046a [FIX] base : fix importing file with special character
To reproduce
============

for example on accounting, attempt to import a record from excel containing a special character like `%`.
Gets error stating the system doesn't support these

Purpose
=======

the issue is caused by misfromatted error string :
https://github.com/odoo/odoo/blob/b859d78c3d56526f44fbdd9ce5e84d34cf8a0a35/odoo/addons/base/models/ir_fields.py#L410-L411

Specification
=============

to solve the issue use :
`str(value).replace('%', '%%')`

opw-2838573

closes odoo/odoo#96336

X-original-commit: eb0152d4c5ec38c33ccc5381d1277543354e3456
Signed-off-by: abla001 <abla@odoo.com>
2022-07-19 21:22:09 +02:00
Pierre Paridans 69f047c26d [IMP] web,tests,test_main_flows: Chrome headless touch option
Before this commit Chrome's "touch mode" was enabled in both desktop and
mobile-like tests suite (when run headless).

To better match real usecases, this commit adds an option to
enable "touch mode" only in mobile tests suites; keeping it disabled in
desktop ones.

Part-of: odoo/odoo#95924
2022-07-19 11:50:51 +02:00
MAHAMADASIF ANSARI 6807eea38c [FIX] various: display full name/title in form views
With commit[1], we added `o_text_overflow` classes at several places to avoid
long names going out of the boxes. However, for the name/title fields in the
form views, we should always show the full name.

So this commit replaces `o_text_overflow` class with `text-break` from
name/title fields in the form views to display full string in the read
only mode, but also keep them from going outside of the form view.

Below are the modules affected:
 - base
 - coupon
 - crm
 - event
 - mass_mailing
 - mass_mailing_sms
 - project
 - sales_team

commit[1] - a0ebb46

task-2889845

closes odoo/odoo#96132

X-original-commit: 4a74c7af6b54bd771f50d3885813f4aae442c9e7
Related: odoo/enterprise#29552
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-07-18 18:42:03 +02:00
Raphael Collet 519d8fe492 [FIX] core: complex flushing when searching on one2many fields
Consider two models A and B, where
 - model A has a many2one_reference field 'res_id' with model field 'res_model';
 - model B has an auto-join one2many field 'stuff_ids' to A using field 'res_id';
 - the field 'res_model' is not flushed on some record.

      model     | A                 | B
     -----------+-------------------+-------------------
      memory    | res_model = B     |
     -----------+-------------------+-------------------
      database  | res_model = NULL  | id = 42
                | res_id = 42       |
                | foo = 'bar'       |

Now, perform a search on model B that should return record with id=42 by
matching some condition on the unflushed record in model A, like:

    B.search([('stuff_ids.foo', '=', 'bar')])

Before this patch, the search method would not flush the field
'res_model', which causes the method to return incorrect results.  This
patch fixes the issue by ensuring that searches on one2many fields flush
all the fields on which the one2many field depends.

The issue was discovered while working on task 2735672.

closes odoo/odoo#96115

Signed-off-by: Raphael Collet <rco@odoo.com>
2022-07-16 17:05:45 +02:00
Raphael ColletandVincent Schippefilt 384fda2c2a [REF] core: replace towrite by dirty flag in cache
Merging both the memory of field values and suspended updates has
several advantages:
 - avoid inconsistencies between cache and towrite
 - cache updates can be made safer w.r.t. dirty flag

However, the dirty flag in cache does not go well with context-dependent
fields.  When a context-dependent field is dirty in cache, the value to
store in the database is accessible through some context values.  But
when the model is flushed, the context values on the current environment
may be different.  When this happens, the method flush() fails to
retrieve the data to flush.

The proposed solution is to store the "dirty" value in cache under
conventional context values, and to retrieve them under the same
conventional context values to flush them.  For instance, when storing
the value of a binary field, it will be stored once under the context
value `context.get('bin_size')`, and a second time under the context
value `None`.  The flush implementation will then retrieve the value
using the context value `None`.

Translated fields are also problematic when a value is put in cache with
an environment where lang=False, and the value is retrieved with another
environment where lang=None.  This issue is addressed by normalizing the
context key 'lang' to None when the context value is False.

Part-of: odoo/odoo#95325
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2022-07-14 22:45:44 +02:00
abd-msyukyu-odoo 40dda26350 [FIX] core, web: handle read_group ranges for multiple granularities
There was an issue with the computed `read_group` `__range` when grouping on
the same date/datetime field on multiple granularities (i.e. month, week).
Since the range was stored with the field_name as a key, the last evaluated
range would override the previous ones.

Impacted Versions:

  - master
  (- exists since 15.0 but it does not impact the user directly so it has been
  decided to fix this only in master, since the API is modified)

Steps to reproduce:

  1. Open a list view and group by a date field with at least 2 granularities
  2. Open the chrome debugger (network) and check a web_read_group rpc preview
  3. Find the web_read_group for groups related to one of the largest
     granularities and check the `__range`

Current behavior:

  - `__range = {field_name: false}`

Expected behavior:

  - `__range = {field_name: {from: range_start, to: range_end}`

Explanation

Since the smaller granularities are evaluated last, and the condition to update
`__range` is related to the field_name and not the granularity, the range is
always overriden by the smaller granularities (even if their value is False)
when grouping on the same field with multiple granularities.

Furthermore, there is a conceptual problem with the current solution: it does
not allow to store multiple ranges when the read_group is not lazy and when
grouping on the same field with multiple granularities.

Therefore, the proposed solution is to use the full groupby keys in the
`__range` to allow storing multiple ranges depending on granularity. The keys
in `__range` would thus match the group value keys and allow more flexibility
if a domain must be forged from the group(s) range(s).

Task-2894519

closes odoo/odoo#95193

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-07-14 18:03:50 +02:00
Florian Damhaut 8646ebb8f5 [IMP] base: On profile, open lang wizard instead of technical view
Step to  reproduce:
- Go to 'My Preference' or User profile as admin
- Click on the world icon to add a language

Old Behaviour:
- Open the technical view of languages

New Behaviour:
- Open a wizard to add a a language

taskid-2774319

closes odoo/odoo#92855

Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-07-14 16:41:56 +02:00
Denis Ledoux 5e4d697b24 [FIX] base: test_create_res_partner with only account_accountant
This is about the same than
d6ad39abba

but with account_accountant installed

```
FAIL: TestFormCreate.test_create_res_partner
Traceback (most recent call last):
  File "/data/build/odoo/odoo/addons/base/tests/test_form_create.py", line 35, in test_create_res_partner
    partner_form.property_account_payable_id = property_account_payable_id
  File "/data/build/odoo/odoo/tests/common.py", line 2179, in __setattr__
    assert not self._get_modifier(field, 'invisible'), \
AssertionError: can't write on invisible field property_account_payable_id
```

closes odoo/odoo#95903

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-13 16:22:55 +02:00
std-odoo e9f712278d [IMP] microsoft_outlook, fetchmail_outlook *: improve usability
* fetchmail, google_gmail, fetchmail_gmail

Purpose
=======
Improve the usability of the outlook modules.

Specifications
==============
Remove the checkbox "Use Outlook" and instead use the
smtp_authentication and the server_type, to be consistent with Gmail.

Hide the password field for Outlook / Gmail mail servers.

Add constraints on the outgoing mail server to force the user to use
the right configuration (e.g. the from_filter, so the sending does not
fail).

Add an option in the mail module to install Outlook.

Show a message for the outgoing mail servers to explain each
authentication methods.

Task-2811567

Part-of: odoo/odoo#88215
2022-07-12 15:36:50 +02:00
std-odoo eb2dd1d674 [IMP] base, fetchmail: improve the mail servers list
Purpose
=======
Improve the incoming mail server list view and the outgoing form view.
Show the most used option first, and make the view more responsive.

Task-2811567

Part-of: odoo/odoo#88215
2022-07-12 15:36:49 +02:00
Xavier-Do d6ad39abba [FIX] base: manage non existing ref
If the test is ran on a database without account installed, it will fail
because of the missing ref.

closes odoo/odoo#95735

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-07-12 13:21:24 +02:00