Commit Graph
3736 Commits
Author SHA1 Message Date
Xavier Morel b01a190a97 [FIX] base: incorrect UserError initialisation
Apparently a migration error in
0fd773a486, probably never noticed
because nobody ever tries to copy config objects since there's a
bespoke widget, and it's specifically forbidden.

Also fix the signature of the method itself to match the normal one.

closes odoo/odoo#82711

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-01-13 14:35:51 +00:00
Xavier-Do 37227ad2cb [IMP] tests: avoid double logs on build page
Since auto-retry, real errors will lead to doubled errors on runbot.
This can be noisy and hard to understand.

This commit will help with this by using a lower log level on the first
execution. Log 25 are kepts.

closes odoo/odoo#80378

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-01-13 09:30:42 +00:00
Thibault Delavallée 37db926fe8 [REF] various: remove usage and dependency on html2text library
We have our own html2plaintext, already used in lot of use cases instead of
just a few for the html2txt library.

Notably for emails: most emails going through Odoo stack use our simple
html2plaintext to format the body alternative. When no body alternative
is given to ``build_email`` an alternative is built using the library to
remove. Using our own parser allows to have the same results compared to
using ``MailMail.send()``. Difference lies in spaces and new lines as well
as markdown. Our html2plaintext is a bit simple and does not try to generate
Markdown but generates a simple plaintext version.

This also helps solving some issues with depending on that library.

Task-2702034

closes odoo/odoo#82486

X-original-commit: b3b9627b655cd7cb928925affed6cc8d92661e8d
Related: odoo/enterprise#23364
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-01-12 16:43:16 +00:00
Thibault Delavallée be878f5d6a [IMP] base: test body alternative done in build_email
Purpose of this commit is to add some tests about body alternative done
in build_email when none is given. It uses a library we are about to
remove and testing it is therefore necessary.

Task-2702034

X-original-commit: 92b102c87bbdb9073f794a414a41460e4146acd2
Part-of: odoo/odoo#82486
2022-01-12 16:43:16 +00:00
Rémy Voet (ryv) 7968030e62 [IMP] test_performance: add test of reversed BaseModel
task-2687953

Part-of: odoo/odoo#79622
2022-01-12 10:17:35 +00:00
Fabien Pinckaers 8ae4d92a58 [IMP] base: remove postprocessing of rendered pages
First step to stream QWeb templates: removing the two post
processing operations applied on rendered templates. This
should slightly speed up the rendering of every page.

1/ Don't remove empty lines after rendering, but fix the root
cause of: view inheritancies and QWeb compilation that don't
add extra empty lines.

2/ handle page break in the two reports that uses it, rather
than processing every view produced.

closes odoo/odoo#82244

Related: odoo/enterprise#23328
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-10 19:28:29 +00:00
wan e6f891d80e [FIX] base: generic test for reports for l10n too
A lot of localization are inheriting reports and changing them.
This should be tested in a generic test like /base.test_reports to avoid
possible tracebacks.

closes odoo/odoo#82312

Related: odoo/enterprise#23299
Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-07 20:42:45 +00:00
Julien Mougenot 65d70acdbf [FIX] base,bus: Notify bundle change on version change
Before this commit: a notification asking to reload the current window
appeared as soon as the server detected a change in one of the assets
bundles, even on first load.

To fix this problem and make the feature more meaningful, it has been
decided to only notify the client when the server version (not the
bundle version) is outdated (i.e. on database upgrades, when the changes
in the code are actually relevant).

closes odoo/odoo#82032

X-original-commit: a3b5a9d715be6a93c7f2859074b916f3249f97c3
Signed-off-by: Antony Lesuisse <al@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-01-04 10:26:10 +00:00
Merlin (megu) 09a6df204f [FIX] base: error raised when automated action with many2many field and reference evaluation
Automated action with a many2many field and reference evaluation can be created but don't work

Steps to reproduce:
1. Install Automated Action Rules module and Contacts app
2. Create an automated action for model 'Contact' with trigger 'On Creation' and action 'Update the Record'
3. Add a line to the automated action 'Data to Write' for the field 'Tags (res.partner)' with evaluation type 'Reference'
4. Go to Contacts, create and save a new one
5. An error is raised when trying to execute the automated action

Solution:
Raise an error when a many2many field is of evaluation type 'Reference'

OPW-2673939

(This PR is a duplicate of https://github.com/odoo/odoo/pull/82035 which for some reason couldn't do the forward ports)

closes odoo/odoo#82168

X-original-commit: 8d45823f2dda24c03b427ecbe7003a64b63d01b7
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-01-03 16:35:56 +00:00
Tom De Caluwé 51facb3933 [IMP] core: always log console.error during HttpCase
When running test tours logging a message to console.error causes the
test tour to fail. Only one such message can cause the tour to fail, if
other message are written on the console they are simply logged in the
odoo logs. The offending message, however, is only shown at the end of
run, as part of the failing test logs. Arguably, it is better to
include it in the browser logs as well.

closes odoo/odoo#75197

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2022-01-03 12:33:50 +00:00
Romain Derie 90a9dce222 [FIX] base, (test_)website: remove the copy_ids orphan leftover
Before this commit, if a theme record (eg `theme.ir.ui.view`) was deleted,
its copy_ids would not be.
While this is perfectly normal and wanted behavior when this is done in a
website context (to not alter other websites), it shouldn't be the case when
performing a theme update through CLI/Migration (or if the user find a way to
update the module through the UI).

Fixes https://github.com/odoo/upgrade/pull/3048
task-2593407
opw-2680866
opw-2685951
opw-2685124
opw-2679040

closes odoo/odoo#81953

X-original-commit: 3146dd72e6cb07d6e78ca763325f13dd54de0086
Related: odoo/design-themes#548
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2021-12-28 11:47:05 +00:00
Fabien Pinckaers 14b24c338a [IMP] remove _read_template cache as it's already cached by _compile
closes odoo/odoo#81921

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2021-12-27 10:25:23 +00:00
Xavier Morel 74241b3766 [FIX] test_lint: support fstrings in sql injection checker
Those were not accounted for, leading to fstrings passing through
unflagged.

Also update the SQL checker to be stricter but smarter:

The previous version would "fail open", unknown nodes would be allowed
through hence f-strings not being flagged when they started appearing
in arg0 position, should now fail-closed, anything that's not allowed
is forbidden.

This flags a few more cases, all of which seem acceptable upon review.

However the previous version would also only resolve arg0 (in case it
had a `NAME`, to see if that resolved to an acceptable form of
query-building). The new version performs resolution during
`_check_concatenation` and should thus allow e.g. format strings to be
separate variables (though not e.g. module-level constants, yet
anyway).

In resolution, replace the ad-hoc process by astroid's built-in
`lookup` which seems to provide the same information. Slightly more in
fact, as it yields every assignment in case of e.g. conditionals, but
making use of that would require a lot more changes in the checker so
leaving the behaviour as-is for now.

It's important to *not* use `ilookup` here, because ilookup is not
"iterable" but "inferring", and we don't want values, we want
expression ASTs for analysis.

NOTE: previous improvements as well as fixes to existing code were
only implemented in 14.0, hence this being merged in 14.0 not 13.0
despite 13.0 still being supported.

closes odoo/odoo#81721

X-original-commit: 376ccf0944dae1bc53ae9c5385977c4e6b23e083
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-27 09:36:42 +00:00
Jeremy Kersten 6c5a93b6b2 [IMP] base: use new filter_ext parameter
Added at 49429f986a, needed to select proper assets

Closes #68043.
2021-10-12 14:55:39 +02:00
Xavier Morel 8d7a9162f9 [IMP] core: set CSP header on some non-HTML resources
Core client remains incompatible with CSP, however it can't hurt to
CSP the sub-resources.

Current scheme is simplistic, however if useful of necessary it could
be made more flexible e.g. there could be a map of mimetypes to CSP
configuration, that sort of things.
2021-12-13 14:46:14 +01:00
Thibault Delavallée 14bbac3f35 [FIX] base: temporary files were not correctly attached 2021-12-23 12:50:14 +01:00
Gorash 34956c2b7c [FIX] Qweb: tag '>' char is inserted after the default content
All textual content generated by opening the tag must be flushed before
inserting the default content

closes odoo/odoo#81700

X-original-commit: effeba10787388ee0a3d153c984fab5731fc9b1a
Signed-off-by: Thibault Francois <tfr@odoo.com>
Signed-off-by: Olivier Dony <odo@odoo.com>
2021-12-25 06:30:06 +00:00
Rémy Voet (ryv) 147f66dbc2 [REM] core: deprecate _execute_sql
This feature is no longer used for years.  Remove it and add it in the
test which raise for depreciated method.

Part-of: odoo/odoo#79563
2021-12-24 14:56:57 +00:00
Rémy Voet (ryv) cbb563fd98 [REM] core: remove deadcode from models.py
- Remove unused imports `AsIs` and `Collector`
- Remove unused logger _schema
- Remove unused function same_name
- Remove unused attribute `_needaction`
- Remove backward compatibility of `__new__` and `__init__`
- Remove backward compatibility of `__export_rows`

Also:
- remove deprecated warning in api.py
- remove the `__init__` from `ir.ui.menu`, it was useless
because the cleaning of cache (`clear_caches`) is global (a call of
`clear_caches` clean all cache method with a ormcache decoration)

Part-of: odoo/odoo#79563
2021-12-24 14:56:57 +00:00
Rémy Voet (ryv) 3346008c43 [REM] core: remove useless view_init
The method view_init() is a hook called from default_get(). We can get
the same result by overriding default_get directly.

Part-of: odoo/odoo#79563
2021-12-24 14:56:56 +00:00
Olivier Dony ea0e9ec0aa [FIX] tools.mail: ignore original email during encapsulation
When the system broadcasts an email response to document followers,
if the config parameters `mail.force.smtp.from` or
`mail.dynamic.smtp.from` are defined, it will rewrite the `From`
address to avoid spoofing the sender's domain.
**NOTE**: As of 15.0, this is based on the `from_filter` setting on the
corresponding ir.mail_server, rather than the abovementioned config
parameters, but the rest of the discussion stands.

For example, if the `mail.catchall.domain` is set to `example.com` and
an email response comes from:

   "John D" <john@doe.com>

it will rewrite it to:

   "John D (john@doe.com)" <notifications@example.com>

This will make sure the system never sends outgoing email for an external
domain, as it has no authority for doing so, and that could
break mail filtering/authentication rules (SPF, DMARC, etc.)

During this "encapsulation rewrite step", both the original Sender name
and their email are preserved, and put into the quoted "name" field of
the rewritten address. It seems sensible to preserve as much information
as possible about the original sender.

Unfortunately, the inclusion of the Sender email in the final name makes
it appear to some inbox providers as if the message is trying to
deceptively impersonate another person (as many phishing schemes would).
As of November 2021 GMail at least does this, and will hide the name in
the UI when it happens. It will keep only the rewritten email, which is not
very useful in the case of a notification (even though it's more
technically correct, of course).

This patch removes the original email from the rewritten notification,
keeping only the name, considering that the email is not the most
important part, and it's better to have one of the two than none.

So after the patch, the rewritten address is now:

   "John D" <notifications@example.com>

When there is no name in the original address, we keep only the local
part of the email, to avoid the same display issue. The recipient will
have to identify the sender based on the context / past messages.

closes odoo/odoo#81807

X-original-commit: 3c65ec5a8191a392980ceb0a8c584767eae405f1
Signed-off-by: Olivier Dony <odo@odoo.com>
2021-12-22 15:45:53 +00:00
Aktiv Software c510df4201 [FIX] base: duplicate mandatory field while creating contact
Description of the issue/feature this PR addresses:
duplicate mandatory field in popup when save the contact record.

Current behavior before PR:
Its showing same field name twice in popup which asking invalid fields.

Desired behavior after PR is merged:
it should show 'name' field only once.

Fixes #79753

closes odoo/odoo#81727

X-original-commit: eb4b49e7078f4aa90f9d652de10386da38ded2dc
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-21 12:55:05 +00:00
Xavier Morel 209429f946 [IMP] base: increase password work factor
And make configurable via an ICP. Provide a reasonable default value,
and use it as a lower bound so user error can't lead to an insecure /
unsustainable amount of hashing.

Aside from being somewhat overdue on account of age (passlib's current
default were last updated 6 years ago), this is also made much more
feasible by API keys, meaning non-interactive use (RPC) is less
strained by the (interactive) password hashing.

Also modernize passlib usage:

* Remove global `DEFAULT_CRYPT_CONTEXT`, create inline (as overhead
  should not be too huge given what we're doing with it), and
  `ormcache()` for safety, the caches should be invalidated on any ICP
  addition, removal, or update, so user update to the rounds
  configuration should get reflected immediately.
* Switch on `deprecated=["auto"]`, feature was added in 1.6 and we now
  depend on 1.7.
* Remove mentions of `encrypt`, it is deprecated in 1.7.

closes odoo/odoo#81498

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-12-16 14:13:43 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Julien Castiaux 2e29a93503 [REF] core: remove http.addons_manifest
The http.addons_manifest is a map {module: manifest_dict} that is
populated upon the first http request. This map is basically a module
manifest cache with an extra `addons_path` key, the path of the module
on the file-system. This cache is eagerly populated upon the first http
request, the map is empty in non-http contextes (e.g. cron) which have
been a source of bugs (e.g. 50c8eb1).

A manifest cache is necessary because reading and parsing python files
from the file-system is not that cheap but there is no reason that cache
is located in `odoo.http`. A thin cache layer now wraps
`load_information_from_description_file()`/`load_manifest()` and is
lazily populated.

The `http.addons_manifest` have been removed. The extra `addons_path`
key is now present in the "normal" manifest. The `read_manifest()` was
hardly used so it has been deprecated. The only way to retrieve a
manifest is now `load_information_from_description_file()` which was
renamed `load_manifest()` (no cache) and `get_manifest()` (cache).

Side note about performances, the cache is necessary. Addons manifest
are read-only and reading + parsing python files from the file system is
not a cheap operation. Running the e-commerce tour
`@website_sale.test_04_admin_website_sale_tour` without cache on
`load_manifest()` requires 68,29 secs to complete on my laptop,
exceeding the default 1-minute time frame allowed in tests. Using a
cache the time is down to 36,53 secs. The performance impact is huge.

Part-of: odoo/odoo#79977
2021-12-14 12:39:54 +00:00
Alvaro Fuentes c5ae057618 [FIX] base: in res.config.settings, field.related is a string
It used to be a tuple.
Cf: 1abe965b59

opw-2681777

closes odoo/odoo#81312

X-original-commit: aa74f51db7bf5a8ad1f4e309b6352df3c31037ec
Signed-off-by: Raphael Collet <rco@odoo.com>
2021-12-13 14:11:51 +00:00
std-odoo 84a63205f8 [FIX] base: allow setting default from-filter per database
Purpose
=======
When there are multiple databases on a single server, it is necessary
to be able to set the "from_filter" for the implicit SMTP server
on a per-database basis, to allow 'opt-in' to the automatic wrapping
of email notifications.
When set to e.g. `notifications@example.com`, and a default SMTP
server is defined in the server-wide config or CLI, outgoing emails
will be automatically rewritten to come from this email, unless the
From/Return-Path domains match the `mail.catchall.domain` parameter.

Task-2710632

closes odoo/odoo#81277

X-original-commit: 8b468e1f7a3dfeb2bcfa83bff55c4b5adf6b2212
Signed-off-by: Olivier Dony <odo@odoo.com>
2021-12-13 09:49:12 +00:00
Sébastien Theys 303cf54a76 [FIX] base: add index for partner on user
Without this index, finding the user(s) of a partner makes a seq scan, which
could take up to 100ms on my machine with only few thousand users. By adding the
index, the time is reduced to around 5ms.

Part of task-2702450

closes odoo/odoo#81176

X-original-commit: 372f1c5ebac4b9b542994ea5aaad59abe7290918
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-12-09 18:40:52 +00:00
Xavier Morel bdc9d9d369 [FIX] core; base: lots of docstrings
* add configuration for `flake8[flake8-rst-docstring]`
* enable docstring-related checks
* fix invalid docstrings in odoo's core & `base`
* fix a few more bits (mostly missing or incorrect `:param:` info
  fields) are out of scope for the lint but my editor catches

closes odoo/odoo#74604

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-12-09 14:36:58 +00:00
Antoine Guenet aceb086854 [FIX] base, web_editor, mail, digest: preserve comments in sent e-mails
For email design in the context of Microsoft Outlook, we want to keep
some magic Microsoft comments (Outlook conditional comment), which -
until this commit - were skipped by QWeb. These allow us to change the
rendering exclusively for Outlook so as to overcome some of its
limitations. This commit introduces a qweb rendering option
(`preserve_comments`) for when - like in mass mailing and digest - we
want to keep comments.

Part-of: odoo/odoo#80621
2021-12-08 09:35:03 +00:00
Raphael Collet 6af689fd0a [FIX] base: fix search on company depend fields
This is a bunch of fixes (65 corner cases) for the search on
company-dependent fields:

Without a default value:
- `char` fields:
    - operators `not like`/`not ilike` don't return records with unset value
    - `(..., '=', False)` doesn't return records with unset value
    - `(..., '!=', '<string>')` doesn't return records with unset value
    - `(..., 'in', [..., False])` doesn't return records with unset value
    - `(..., 'not in', value)` without `False` inside `value` doesn't return records with unset value
- `date` and `datetime` fields:
    - `(..., '!=', <Date/datetime>)` doesn't return records with unset value
    - `(..., '=', False)` doesn't return records with unset value
- `many2one` fields:
    - operators `not like`/`not ilike` don't return records with unset value
    - `(..., 'in', [..., False])` doesn't return records with unset value
    - `(..., 'not in', value)` without `False` inside `value` doesn't return records with unset value
- `boolean` fields:
    - `(..., '=', False)` and `(..., '!=', True)` don't return records with unset and `False` values
- `integer`/`float` fields:
    - `(..., '!=', <number>)` doesn't return records with unset value

With a truthy default value:
- `many2one` fields:
    - operators `not like`/`not ilike` don't return records with unset value
    - `(..., '=', False)` returns the record with the default value (which isn't `False`)
- `boolean` fields:
    - `(..., '=', False)` doesn't return records with unset and `False` value
    - `(..., '!=', False)` returns records with unset and `False` value
- `integer`/`float` fields:
    - all `(..., operator, value)` which include value 0, return all records with unset value, even if the default value does not satisfy the domain

closes odoo/odoo#80994

X-original-commit: 3e3be652ece83420782070bdb13da2c3a4930046
Signed-off-by: Raphael Collet <rco@odoo.com>
2021-12-07 17:10:48 +00:00
Martin Trigaux d99cfd9416 [I18N] *: export saas-15.1 source terms
closes odoo/odoo#80964

X-original-commit: 0663892a34896980008eb0de69aeb58019a67e89
Related: odoo/enterprise#22759
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-07 13:48:53 +00:00
Nicolas Bayet f02b1727dd [FIX] base: allow the codeview for the user signature
Task-2674070

closes odoo/odoo#80897

X-original-commit: 17d9a044ff0cab09a40695da00769dd55135577f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-12-06 12:55:11 +00:00
IEL 64864a6402 [FIX] base, website: fix no web translation on duplicates
TLDR: if we have a term in python and js code, then js translation may not work

STEPS:

* install point_of_sale
* activate and switch to French translation
* go to "Point of sale >> Reporting >> Orders"
* Click "Time Ranges >> Range"

BEFORE: "This Week" is not translated

AFTER: All terms are translated

WHY:

* Translation imports merges translation if they have same src

  https://github.com/odoo/odoo/blob/1e39a2d3b8060963073a39d99ba3a14b07d03333/odoo/addons/base/models/ir_translation.py#L196
  https://github.com/odoo/odoo/blob/1e39a2d3b8060963073a39d99ba3a14b07d03333/odoo/addons/base/models/ir_translation.py#L111

  So, we get either js term for "This Week" or py term, but not both

* web/webclient/translations loads only translation with comments==openerp-web

  https://github.com/odoo/odoo/blob/1e39a2d3b8060963073a39d99ba3a14b07d03333/odoo/addons/base/models/ir_translation.py#L900

  So, if we don't have js term, then the translation is not loaded to UI

* This only fix problem of no translation, but doesn't fix overriden
translation (i.e. when same english term, e.g. Free, has different translation
in frontend and backend). This part can be fixed by changing english term to
something more unambiguous.
---

opw-2357399

closes odoo/odoo#80875

X-original-commit: 4b4234134bcb139c6c6a12992c5ab6195c3b2710
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-04 06:35:56 +00:00
Martin Trigaux b50a705d04 [FIX] base: ensure all attachments are in sudo
>>> u1 = self.sudo(False).browse(1)
>>> u2 = self.sudo().browse(2)
>>> (u1 + u2).env.su
False
>>> (u2 + u1).env.su
True

Ensure all attachments are always in sudo

Before this commit, a portal user could not go in debug asset

Introduced at 3a98996eed

closes odoo/odoo#80807

X-original-commit: 9f0ce611b2acf5927a7703a7811081c4adbc3f41
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-03 07:27:40 +00:00
Victor Feyens 69dc4bba42 [IMP] core,sale: enforce batch creation support for sale order (lines) 2021-12-02 12:12:04 +01:00
Yannick Tivisse 232d66069a [IMP] sale: Make some field precomputed 2021-12-02 12:12:03 +01:00
std-odoo 3b97f601be [FIX] base: avoid variable name collision with functions in QWeb
Bug
===
The arguments of the lambda function might be the same as other
variables in the QWeb. In that case the template rendering will crash.

To avoid this issue, we encapsulate the name of the argument to be sure
it's not the same as other variable in the QWeb engine (so the name of
the argument can no longer make the QWeb rendering crash)

Task-2674716

Closes #78392.

Forward-port of 96b09b127028e5c9a83c89acce86e1b6df904c6f
2021-12-01 17:30:51 +01:00
Julien Castiaux 12589081b0 [FIX] base: cron "run now" button runs without ctx
Change the lang of your user, translate the name of some records (e.g.
translate the "Customizable Desk" product to "Bureau personnalisable")
and create a cron that simply log the name of that record. Schedule the
cron to be automatically executed, check the created log entry (setting
> technical > logging) it is the default english name. Go back to the
cron, click "run now" contextual button, check the created log entry: it
is the translated name.

When they are automatically executed by the cron worker, crons run with a
minimal context without lang. When the user clicks on the "run now"
button his context was wrongly used while executing the code.

Closes #45388

closes odoo/odoo#80532

Signed-off-by: Julien Castiaux <juc@odoo.com>
2021-11-29 16:27:58 +00:00
Victor Feyens cfda86fa53 [IMP] base/settings: avoid forcing the flush
when no modules needs to be (un)installed.

closes odoo/odoo#62249

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-26 09:44:58 +00:00
Victor Feyens 76982c059c [IMP] base: do not apply/reset unmodified settings
When "Saving" a settings wizard, all its settings are written, even if
not modified.

This implies updating ir.default and ir.config.parameter models.
By verifying whether there were effective changes, we can
avoid:

1) the searches to get the corresponding records from database
2) the cache clear triggered by default/parameter updates/creation

This commit thus reduces the queries triggered when saving settings,
but also the queries of future operations, since we avoid clearing
the ORM cache if not needed.

Part-of: odoo/odoo#62249
2021-11-26 09:44:58 +00:00
Victor Feyens 27fc76dcd1 [IMP] base: use cached reference when fetching groups in settings
The settings wizard provides the implied_group logic to add/remove
implied_groups to an existing group (by default base.group_user).
When verifying those special fields (onchange, default_get and execute
calls), ref is called once by group, by field.

E.g. a field
group_broll = fields.Boolean(implied_group="broll")
will trigger two refs ("broll" & "base.group_user") for each
onchange/default_get/execute call on res.config.settings.

This commit uses the cached method to fetch ir.model.data,
avoiding a lot of queries (depending on the fields defined on
res.config.settings model)

Part-of: odoo/odoo#62249
2021-11-26 09:44:57 +00:00
Victor Feyens 34dd6a2dba [IMP] base: provide a cached method to fetch module records
Following the API for ir.model records, the same logic is provided for
ir.module.module records.

This allows to avoid a bunch of queries when modifying/opening settings.

Part-of: odoo/odoo#62249
2021-11-26 09:44:57 +00:00
Victor Feyens 659bc441da [IMP] base: do not compute unwanted defaults for settings wizard.
At create, the ORM fills the missing create values with the defaults,
calling default_get.

In the case of res.config.settings model, the default_get overrides triggers
a lot of operations to manage its custom field logic (config parameters,
defaults, modules installation, ...).

This slows down the creation (and application) of settings updates for "nothing".

This commit ensures the defaults are not recomputed for fields whose value
was provided to the create call, reducing the effective time of settings flow.

Part-of: odoo/odoo#62249
2021-11-26 09:44:57 +00:00
Goffin Simon 669976db67 [FIX] base: The symbol ANG must be before the amount
REF:https://www.xe.com/currency/ang-dutch-guilder/

opw:2690166-

closes odoo/odoo#80188

X-original-commit: e84af51ffbb550d069288e498e96604cb610443e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-11-24 15:49:11 +00:00
Elisabeth Dickinson 8a01be5d62 [IMP] base: redesign company image
Align style of company_image.png with avatar_grey.png to keep interface
and usage coherent.

Task-2487489
Task-2688887

closes odoo/odoo#80304

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-24 12:31:17 +00:00
Florent de Labarre 49a23bb3fa [FIX] base: simplify field dependencies to avoid costly invalidation
Consider upgrading module 'base' on a database with millions of 'res.partner' records.
The upgrade of country and country state data makes a very costly search to reverse
the dependencies of the non-stored computed field 'contact_address', just for the sake
of invalidating its value from cache, which is most probably not present at all.  The
cost of the search is so high that it may prevent from upgrading the module (timeout).

closes odoo/odoo#80251

X-original-commit: b7f9d0b7c3dfbca0f4897a650983a298da811ce1
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-23 13:55:01 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Julien Mougenot 54b45aec9e [FIX] base_import_module: Keep manifest assets of dynamic modules
The `ir_import_module` module is used by users to upload custom module
data via a zip file. The zip file can contain xml data, xml views and
static files.

Before this commit, the "import module" feature of this module was
broken since the imported module's manifest was lost after the import
was performed.

Now, 'ir.asset' records are created along with the attachments pointing
to the imported static files.

closes odoo/odoo#80120

X-original-commit: ec77577796e72707fbb2077f05067428cebc3c7f
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2021-11-22 11:12:44 +00:00
Jeremy Kersten 7f3a2b700f [FIX] base: fix acl error on wizard merge contact
Since 5dc4cff60a, we removed the access read on ir.model.*

Before this commit, an employee without admin rights cannot merge partners
because he doesn't have the right to read the model ir.model.fields.

Now with use a sudo to find the reference field and avoid the traceback.

closes odoo/odoo#80119

X-original-commit: 1815b108004b407714705b6f62b65f4cfc38a395
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-11-19 16:33:16 +00:00