Commit Graph
5702 Commits
Author SHA1 Message Date
Christophe Monniez 5e3d9305aa [FIX] base: use demo user of the test class
closes odoo/odoo#163274

Build-error: 55926
X-original-commit: a5bda29fbeae7d929f65b026a1e7a8bab7f80da1
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2024-04-25 06:11:10 +00:00
Denis Ledoux 130873b16d Revert "[ADD] tools: patch C types, e.g. str.format"
This reverts commit 66832f0ba0.
2024-04-24 23:59:28 +02:00
oco-odoo 436be43d49 [FIX] base: company branches: archive all sub-branches when archiving a company
Original issue:

1) Create a company "main", with 2 branches: "A" and "B"
2) Create a sub-branch for "A": "A1"
3) Archive company A
4) In the company selector, make "main" the active company. It will auto-select branch B as well.
5) Open the tax report, and try clicking the "Closing Entry" button
==> The button is disabled ; it shouldn't be.

This happens because Odoo considers the full hierachy of branches to submit together is not selected. The problem originates in the way _get_branches_with_same_vat searches for sub-branches, doing

self.env['res.company'].sudo().search([('id', 'child_of', current.root_id.ids)])

In our example, this search will return main, B and A1. We then compare that with the company selector, which only contains main and B.

This configuration of companies does not make sense functionally speaking, as a branch whose parent is inactive will not be usable anyway. Therefore, we now archive all the sub-branches when archiving a company.

opw-3877368
task-3878070

closes odoo/odoo#163078

X-original-commit: b5f297616e937535f2d0ba3f05fd905858741d53
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-24 09:28:17 +00:00
Jeremy Kersten 8fadfe88bd [FIX] base: ir_qweb, allow to use link with xmlns
Until now, it is impossible to do <g:title>xxx</title> because qweb
will autoclose the <g:link> because it checks if link is a void element
instead to check g:link.

Now we check the el_tag instead of unqualified_tag.

closes odoo/odoo#159476

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-04-24 09:28:14 +00:00
Julien Castiaux ef9010c6ed [FIX] base: store SSL key/cert for smtpd tests
The various keys and certificates used by the TestIrMailServerSMTPD test
suite were generated on-the-fly via a shell script present next to the
test. It is just easier to save the keys and certs in git rather than
re-generating them everytime.

Changed the private keys from RSA to ed25519 for the smaller files size,
changed the validity date to a thousand year.

task-3703209
opw-3640374

Part-of: odoo/odoo#151483
2024-04-24 07:55:42 +00:00
Julien Castiaux 3b493f5631 [IMP] base: test against a real SMTP server
A previous commit broke the smtp authentication using a TLS certificate
and we only figured it out after that a client created a support ticket
several weeks later. It turns out that there are no tests that validate
the various ways outgoing mail servers can be configured.

In this work, we add a test suite where a local smtp server is started
and controlled during the test execution. This makes it possible to test
all the possible outgoing mail server configurations, including TLS.

This work revealed several problems that have been sorted in other PRs,
a problem that is left to solve is to verify those certificates as shown
by the `test_man_in_the_middle` test. This will be sorted in a future
work.

We chose [aiosmtpd] which is a pure-python lightweight SMTP server that
aims at providing a programming API that is well-suited to be used
inside unittests.

task-3703209
opw-3640374
[aiosmtpd]: https://aiosmtpd.readthedocs.io

Part-of: odoo/odoo#151483
2024-04-24 07:55:42 +00:00
Ryan Cen 7dc51b3dee [FIX] base: avoid fail with wrong mimetype
Uploading a WEBP or SVG file disguised with a proper file extension (JPG, PNG)
will cause a traceback because img.image is
not populated when there is an empty source, SVG, or WEBP file uploaded
as this code should not be reached with these file types.

The reason this occurs is because we check for the file extension when
deciding to post process an image, but when we get to initializing the
ImageProcess object, we then check the actual file structure to verify
the type of file.

This is a workaround for the time being, but should not be a final
solution in future versions.

Adding a null check on img.image in the _postprocess_contents method
in order to avoid attempting to access the size of this image when it is
null.

Raises a user error in order to trigger the catch and exit the code
while logging the error and 'Post processing ignored:'.

Includes test for this new workflow with no errors.

opw-3672250

closes odoo/odoo#162976

X-original-commit: e9750b16a61c3598f7a2b14a1552fcb4ecf1a293
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Ryan Cen (ryce) <ryce@odoo.com>
2024-04-23 23:18:06 +00:00
Xavier-Do 4eaea4c374 [FIX] base: test profiling
This test can sometimes fail randomly

    FAIL: TestProfiling.test_sync_recorder
    Traceback (most recent call last):
    File "/data/build/odoo/odoo/addons/base/tests/test_profiler.py", line 440, in test_sync_recorder
        self.assertEqual(stacks_methods, [
    AssertionError: Lists differ: [['a'[114 chars]], ['__exit__', '_remove'], ['__exit__'], ['__exit__', 'stop']] != [['a'[114 chars]], ['__exit__', 'stop']]

    First differing element 11:
    ['__exit__', '_remove']
    ['__exit__', 'stop']

    First list contains 2 additional elements.
    First extra element 12:
    ['__exit__']

    [['a'],
    ['a', 'b'],
    ['a'],
    ['a', 'c'],
    ['a', 'c', 'd'],
    ['a', 'c'],
    ['a', 'c', 'd'],
    ['a', 'c'],
    ['a'],
    [],
    ['__exit__'],
    -  ['__exit__', '_remove'],
    -  ['__exit__'],
    ['__exit__', 'stop']]

Since we don't care about the last lines, just remove them from the
assertion.

closes odoo/odoo#163016

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-23 17:09:50 +00:00
Christophe Monniez 29fb4ac761 [FIX] base: fix similar attachments
While searching for a similar attachment, as the fallback url pattern is
the same as the url pattern, the condition is never satisfied.

With this commit, the ignore_params parameter is used to find a similar
attachment.

closes odoo/odoo#162654

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-22 17:04:37 +00:00
vava-odoo 91be775b6f [FIX] base: no client action of tag 'apps'
Since 17.0, the tag `apps` of ir.action.client was removed with the
legacy code of javascript. This commit removes the only usage in
`res.config.installer` (not used in standard) to avoid a traceback at
install.

Fixes #160293

closes odoo/odoo#162228

Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2024-04-22 08:27:08 +00:00
Odoo Translation Bot 459412b860 [I18N] Update translation terms from Transifex 2024-04-21 00:08:43 +02:00
66832f0ba0 [ADD] tools: patch C types, e.g. str.format
Monkey-patching C types is not straightforward.
It relies on changing the attributes or methods in memory
at the right address with the exact right size.
This requires the greatest caution.
A simple mistake can mess up the memory used by the Python interpreter,
and for instance lead to `SegmentationFault` exceptions
or unforeseen behaviors.

However, being able to patch C type is a very powerful tool.

With great power comes great responsibility.

`patch_c_type` is implemented with the greateast caution.
The Python C-API documentation has been thoroughly followed
and understood.
In addition, this patch has been battle tested in real
conditions.

In the end, this allows to patch unwanted behaviors
from types implemented in C.

Co-authored-by: Denis Ledoux <dle@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
Co-authored-by: Mathieu Walravens <wama@odoo.com>
2024-03-26 16:51:36 +00:00
Julien Castiaux 1d49034782 [FIX] base: smtp_auth=certificate with SSL/TLS
Start a SMTPS server with client certificate authentication. In Odoo
configure an outgoing mail server with encryption="ssl/tls" and
authentication="certicifate". Load a valid client certificate and key to
use with the SMTPS server then test the connection.

The connection fails because the client certificate wasn't sent during
the TLS handshake.

If you're having trouble running a SMTPS server, I made a script here:
https://gist.github.com/Julien00859/5090d1cff6c02197e5854aabb67bf5ac
It uses aiosmtpd, a light pure python smtp server, install it with pip.
You'll need to copy your snakeoil ssl key + cert inside your /tmp
directory and to expose them to your current user:

    # public cert
    cp /etc/ssl/certs/ssl-cert-snakeoil.pem /tmp

    # private key
    sudo cp /etc/ssl/private/ssl-cert-snakeoil.key /tmp
    sudo chmod 400 /tmp/ssl-cert-snakeoil.key
    sudo chown $USER /tmp/ssl-cert-snakeoil.key

task-3703209

closes odoo/odoo#162297

X-original-commit: b3d7c1fc9c017a4354dc4a6f8abfbf590bc26a51
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-04-18 07:28:35 +00:00
Julien Castiaux 41ccb102c1 [FIX] base: bad logging argument in test_smtp_connection
task-3703209

closes odoo/odoo#162262

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-04-18 00:32:47 +00:00
Hesham 0d5f278067 [FIX] base: fixed inverse currency rates in list view
In the currencies list view, the current rate and inverse rate were swapped.
Their strings were also changed to match the string in the form view.

Currency rates were inversed in the currencies list view.

task-3856386

closes odoo/odoo#160882

Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-17 22:47:11 +00:00
Alvaro Fuentes b278241a71 [FIX] base: ensure existing ir.model.constraint xmlids are loaded
When we load a module and the SQL constraints exist both in the table
and in `ir_model_constraint` we need to ensure the xmlid is loaded.
Otherwise the record in `ir_model_constraint` is removed.

Since 4c9968397b we skip returning
existing non-updated constraint records in `_reflect_constraint`. This
leads to them being removed by the ORM. At the end of the load the ORM
sees the record in `ir_model_data` but not in the xmlid pool, thus it
removes it.

closes odoo/odoo#162105

X-original-commit: b5670c7f0d35d13affee2ae93158556346b7dd23
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
2024-04-16 17:38:14 +00:00
lase@odoo.com 094447485c [FIX] base: change the adress format in Luxembourg
Steps to reproduce:

Create and print an SO for a customer based in Luxembourg

Expected behavior:

According to Bpost and to the Post of Luxembourg, the zip code should be
displayed before the city name in the address format in Luxembourg.

Current behavior:

The zip code is displayed after the city name.

opw-3791142

closes odoo/odoo#161738

X-original-commit: 83b38fab6cc69d0ed2c6abae34f2b4e76ef8a601
Signed-off-by: Lancelot Semal (lase) <lase@odoo.com>
2024-04-15 09:10:19 +00:00
Odoo Translation Bot 3275156773 [I18N] Update translation terms from Transifex 2024-04-14 00:09:33 +02:00
Paul Morelle 6788f43d6b [IMP] base: avoid infinite loops in _update_category
When updating the categories, if by any chance there is a loop in the
category hierarchy, the current code was falling into an infinite loop.

With this commit, the graph loop is broken by clearing a parent_id, and
if the resulting module category path is wrong, a clean new one will be
recreated anyway.

This allows unblocking uncomfortable situations where people cannot
update the modules list any more. In 15.0, [a check][1] has been
introduced to prevent the existence of recursive categories, but as it
is a python check it doesn't prevent corrupted data to remain corrupted.

OPW-3704007

Related to odoo/upgrade#5574

[1]: odoo/odoo@6932714200

closes odoo/odoo#161583

X-original-commit: f2765d2cab5671a010404c36842bf1b4c4d6350b
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
2024-04-12 11:26:47 +00:00
mizosoft 32313aac78 [FIX] base: refresh res.currency cache before premature return
Issue
-----

The cache is not updated properly when the configuration of a currency changes.
This leads to reading stale values in other places. For instance, changing currency
symbol position isn't reflected in invoice tree views unless after a server restart.

Steps
-----

 - Open Accounting -> Configuration -> Currencies.
 - Pick the active currency, say USD.
 - Change 'Currency Symbol Position' to a different value.
 - Go to Accounting -> Customers -> Invoices. The displayed amounts don't reflect
   the change.

Cause
-----

Cache refresh was misplaced after a premature return, so the cache wasn't refreshed
when 'digits', 'position' or 'symbol' fields of `res.currency` are written, although
that was the intent.

opw-3849155

closes odoo/odoo#161036

Signed-off-by: Moataz Hussein (mohu) <mohu@odoo.com>
2024-04-11 11:22:44 +00:00
Nguyễn Đại Dương aac2f49acf [FIX] http_routing: can't redirect the user to friendly access error
-Step to reproduce: create a custom module and try to extend method in
website_slides controller like this:
@http.route(sitemap=sitemap_slide_view)
def slide_view(self, slide, **kwargs):
    return super(WebsiteSlidesSeo, self).slide_view(slide, **kwargs)

From there, 'rule.endpoint.original_routing' will take the value from
the extend method not the original one therefore user will one again go
to the the forbidden error page which is'n friendly. We shouldn't access
original_routing because that's the "function's specific @http.route"

closes odoo/odoo#160864

-solution: we only need rule.endpoint.routing because it is the one holding the "merged @http.route accross inherited controllers".
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2024-04-11 09:50:45 +00:00
Xavier-Do 308326816f [IMP] base: fix test_tz to work with if target is missing
The test test_tz_legacy will fail if the taget does not exist on the
operating system. This is breaking in some versions of the tz-data
package. Don't make this test fail if the target is missing.

closes odoo/odoo#161341

X-original-commit: 276eb0192fdddb736453857c18bf9f0cccecb4a3
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-11 06:34:43 +00:00
Florent de Labarre 7f947871f0 [FIX] base: logger show cron done even if it is not done.
The logger show "Job done" before the flush. But if during the flush an
error appear (sql constraint, validation error during computed field,
...), the log contain "Job done", but is not True.

The time to compute the cron is not good because it doesn't contain the
flush time.

closes odoo/odoo#161204

X-original-commit: 0cde9c7238ece225ebd50c50f4a78d16ac6b5226
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-04-10 09:44:14 +00:00
Xavier-Do e73094c19a [FIX] base: adapt patch.dict for noble
closes odoo/odoo#160842

Related: odoo/enterprise#60219
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-07 10:03:48 +00:00
Xavier-Do e531d8ed18 [IMP] support deprecated timezone resolution
In ubuntu noble, some timezone where removed leading to errors when
trying to assign/access them.

This was partially fixed in the code by removing all references to old
timezones but one issue remains: if a database contains timezones that
are not defined in the os, the resolution will fail and break at runtime

This patches proposes to alter timezone to fallback on the new canonical
timezone if the timezone was removed.

This list was generated by checking all symlink in /usr/share/zoneinfo
in ubuntu 22.04 that disapeared in ubuntu 24.04

This solutions will work when moving a database from one server to
another, even without migration.

The all_timezone is not modified on purpose to avoid breaking existing
logic. This list may be used to define if a timezone is known by
postgress, define selection fiels, .... we don"t want to increase the
list in those case.

Some other logic using all_timezone may need to be updated but This
will be done in master.

Part-of: odoo/odoo#160842
2024-04-07 10:03:48 +00:00
Xavier-Do e9b62b47dc [FIX] *: adapt tz for Ubuntu Noble
Some of the non canononical timezones are not present in Ubuntu Noble,
it would be a better practice to only use canonical timezones in data
and tests.

Note that this is not a real fix for all cases since the database that
ran on Ubuntu Jammy and are moved to an ubuntu Noble server will have
the issue with timezones already in database.

One of the possible fix would be to manage that during upgrades, but
this isn't a verry flexible solution since upgrade are meant to manage
chyange of version, not change of server. If an old 17.0 versions needs
to be moved to a Noble server, this won't work.

Another solution would be to install package like tzdata-legacy that may
keep the old timezones but it is not the only think since TAI-10 are
also in this package. This solution is not ideal because non canonical
timezone will still be shown in the dropdown. We would need to filter
them.

A last solution would be to add the support for those old timezones by
monkeypatching the lib. This way, only new timezones would be shown but
non canonical one won't crash when used. This is not ideal either
because we may need to keep this for a while. But in combination with
the upgrade solution, it may work proprely.

Part-of: odoo/odoo#160842
2024-04-07 10:03:48 +00:00
Odoo Translation Bot a19537ea69 [I18N] Update translation terms from Transifex 2024-04-07 00:08:33 +02:00
Maira Salazar (srma) d3f5a4aee7 [IMP] base: display only company name in duplicate Tax ID warning
When creating a new company from a move, if the tax ID is repeated, a warning is displayed.
The warning includes the company name, address and VAT, if those have been added. In this case,
address is shown in an extra line, which looks broken.

This commit removes additional partner information by updating the context,
displaying only the partner name.

It also slightly rewords the warning, from "are you sure to create a new one?" to
"are you sure you want to create a new one?".

To replicate the issue:
1. Create an invoice
2. Click on the empty field next to Customer, type a new name and click "Create and edit..."
3. Add a Tax ID that is already in use (e.g. US12345673)
4. Warning of duplicate Tax ID shows, displaying company name, address and VAT

task-3829641

closes odoo/odoo#160373

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2024-04-05 14:01:09 +00:00
Chrysanthe (chgo) cef76872f8 [FIX] base: fix password edition modal weird design
This commit removes an unwanted `bg-primary` class applied to the change
password modal, making it weird and unconsistent regarding others modals
across Odoo.

=========
Steps to reproduce
=========

> Open a database
> Click on your avatar in the top right corner
> Click on `Preferences`
> Go to `Account Security`
> Click on `Change password`

>> The modal has a `bg-primary` class, making it look purple.

task-3836699

closes odoo/odoo#160462

X-original-commit: 2813540aba7556b915185e482cbb6d9500db7af1
Signed-off-by: Chrysanthe Gomrée (chgo) <chgo@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-04-04 13:26:32 +00:00
Odoo Translation Bot 684745f5de [I18N] Update translation terms from Transifex 2024-03-31 00:09:16 +01:00
Martin Trigaux (mat) aa84ccfa61 [ADD] test_translation_import: export source terms
Add a test for exporting the source terms of modules.
This will allow automated scripts to fetch latest terms

Backport save_test_file with a parameter on date_format to have
predictable filenames

closes odoo/odoo#159373

X-original-commit: e7246ea48828746471a2e3a485bee30687eeee80
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2024-03-29 07:53:00 +00:00
nda 6c897df473 [FIX] base: prevent ir.ui.view double display
Steps to reproduce:

- Remove all permissions to write/create/delete a view for the user "demo"
- Open a view form with "demo" user

Actual result:

- View code is displayed in plain text and with formatting

Expected result:

- View code is displayed with formatting only
- You can't edit the view or the translations

opw-3776073

closes odoo/odoo#159592

X-original-commit: a1f4e3de224d91e49d5adb2a6385d76c3282d206
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Nicolas Danhier (nda) <nda@odoo.com>
2024-03-28 14:16:52 +00:00
Julien Castiaux bfc62bc3ef [FIX] base: cron indeterministic test
Upon calling `invalidate_recordset` the current recordset present is
flushed. That recordset can be active=True which override active=False
set `_process_job()`. Flushing the recordset *before* calling
`_process_job` makes sure that there is no dangling data to be flushed.

closes odoo/odoo#159262

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-26 15:40:32 +00:00
Xavier Morel 7f5f296396 [REM] base: broken method Partner._email_send
The underlying `odoo.tools.email_send` was removed in
82de620424 (merged in 14.5) but this
callsite was missed, this method has been broken ever since.

I really want to remove this method directly, but technically it's an
expensive no-op if called on a recordset of partners without emails
set (or an empty recordset), so instead make it trigger a warning &
remove in master.

closes odoo/odoo#159177

X-original-commit: 457a4be9d6bb1e15b996a5a14468f9b0d88e0b0f
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2024-03-26 08:20:25 +00:00
Alvaro FuentesandChristophe Simonis c18b9f44be [IMP] *: optimize multi-company rule
When we use the `|` (or) version of this rule the ORM generates two
sub-queries when checking the company. This causes sub-optimal and in
some cases really bad planning for the queries and thus PG takes hours
to complete them.

Example (formatted):
```sql
    SELECT "mrp_routing_workcenter".id
      FROM "mrp_routing_workcenter"
 LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
        ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
     WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
       AND (  ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE ("mrp_bom"."company_id" in (1))
                   )
              )
           OR ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE "mrp_bom"."company_id" IS NULL
                   )
              )
           )
  ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
           "mrp_routing_workcenter__bom_id"."id",
           "mrp_routing_workcenter"."sequence",
           "mrp_routing_workcenter"."id"
```

If we use the single term version the generated query has only one
sub-query:
```sql
    SELECT "mrp_routing_workcenter".id
      FROM "mrp_routing_workcenter"
 LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
        ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
     WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
       AND (  ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE (("mrp_bom"."company_id" in (1))
                        OR  ("mrp_bom"."company_id" IS NULL))
                   )
              )
           )
  ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
           "mrp_routing_workcenter__bom_id"."id",
           "mrp_routing_workcenter"."sequence",
           "mrp_routing_workcenter"."id"
```
In this version PG is able to produce a better query plan resulting in
better execution times.

Also, the `company_id` field is required on some models, so the "= False" comparison is useless.

closes odoo/odoo#159123

X-original-commit: 1b5c41f36801fb886ec591f29dba42787d698526
Related: odoo/enterprise#59378
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
2024-03-25 17:50:06 +00:00
vava-odoo 3a5c85fe19 [FIX] base: ValidationError for required m2o with 'set null' on_delete
Before this commit, when creating a many2one field from an xml, with an
impossible combination "`required=True` - `on_delete='set null'`", the
column was not created in the database without any notice to the user.

This commit adds a constraint checking that any attempt to create a field
with this configuration would raise a ValidationError. This constraint
replaces the previous onchange method.

closes odoo/odoo#158778

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-03-25 14:39:17 +00:00
Xavier Morel 429a37b395 [FIX] base: allow finding states by display_name
That is how states are (might be?) exported, so it should be possible
to find them the same way.

closes odoo/odoo#158984

Task-id: 3644762
X-original-commit: 26df8e2858d8bcaa11dfae68be328388b1983745
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2024-03-25 08:33:16 +00:00
Yannick Tivisse c8456e2f3e [FIX] base: Prevent user_admin deletion
Purpose
=======

Tremendous amount of support tickets (ex: 3800405) are opened because the user_admin
has been removed and is referenced everywhere, leading to tracebacks or
the impossibility to install a new application as res.group configurations
all relies on this, like:

<record id="group_helpdesk_manager" model="res.groups">
    <field name="name">Administrator</field>
    <field name="category_id" ref="base.module_category_services_helpdesk"/>
    <field name="implied_ids" eval="[(4, ref('group_helpdesk_user'))]"/>
    <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>

We could adapt all the occurences (severeal hundreds) to ensure robustness
but this won't prevent developer from introducing new use cases + the user
can be archived instead if we want to remove him from the pricing.

closes odoo/odoo#158885

Taskid: 3802440
X-original-commit: b55994b4c5e737aae593eb0419f96347ad90bebb
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2024-03-25 08:33:15 +00:00
Benjamin Hanquin (beha) 331d8451d9 [FIX] base, website: Avoid .cache confusion with Environment
The attribute cache is mainly used from the Environment class. The
ormcache attribute using the same name leads to confusion.

Related task:
task-3818968

closes odoo/odoo#155264

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-02-28 08:24:13 +00:00
Odoo Translation Bot 395140671f [I18N] Update translation terms from Transifex 2024-03-24 00:12:07 +01:00
Rémy Voet (ryv) 3c7db87ade [IMP] core: add warning for malformed aggregate specification
_read_group doesn't raise an error when we have an aggregate
specification like `order_id.create_date:min`, instead it silently
ignores the `.create_date` part.

We only add a warning in the stable version to avoid breaking any
change.

closes odoo/odoo#158777

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-03-22 16:49:49 +00:00
Paolo Gatti (pgi) efd89d8483 [FIX] base, web: BooleanFavoriteField wasn't translated
- BooleanFavouriteField wasn't translated as the component was using
  an untranslated variable instead of relying on the translation of
  the template.

Some other translation fixing:
- ID Azienda is very generic, the correct name is Numero REA:
  See: https://www.registroimprese.it/codice-fiscale-p.iva-rea
- No one calls a mobile phone "Dispositivo mobile", we already
  translate it as the more common "Cellulare" even in the same file

task-3263708

closes odoo/odoo#157949

Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
2024-03-22 14:47:53 +00:00
Julien Castiaux 7a73e120ca [FIX] base: inf. loop when cron interval_number=0
Create a cron with an `interval_number` of 0 and change its nextcall so
that it is called soon. When the cron gets executed, the cron worker
enters an infinite loop during the computation of the next nextcall.

The cron now gets disabled with an error message. On the form view,
users now get a warning when `interval_number` is invalid.

closes odoo/odoo#158519

X-original-commit: aaf498ff2acf39f73fe408eab74e82a8d58f6f1b
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-21 23:03:03 +00:00
Raphael Collet 268d8b830e [FIX] base: don't check access rules on new records
This fixes an issue where access rules are checked on a new record: the
rule domains are evaluated with method filtered_domain(), and one rule
uses the operator 'child_of', which is implemented with a call to
search().  When used with a new record, filtered_domain() returns an
empty recordset instead of the record itself.

By design, the ORM doesn't check security on new records.  A base
automation of type 'onchange' will run some server action on a new
record.  The server action may still check access rights on the model,
but should not check access rules.

closes odoo/odoo#158309

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-03-20 19:56:40 +00:00
Odoo Translation Bot c4bc200b47 [I18N] Update translation terms from Transifex 2024-03-17 00:11:43 +01:00
Florent de Labarre 8a985113d8 [FIX] base: prevent random ordering
Before this commit, ir.actions.report can be randomed orderer.

closes odoo/odoo#157616

X-original-commit: 1a2b83d8a4fc956e07d6009eb7fc308eb16eedd2
Signed-off-by: Raphael Collet <rco@odoo.com>
2024-03-15 15:28:02 +00:00
MélanieandYannick Tivisse 941dc4cee0 [FIX] base,hr: Ensure employee/user image at creation
Ensure an avatar is generated based on the employee/user name
if no image is provided at the record creation (for internal users only).

closes odoo/odoo#147446

Taskid: 3637523
Related: odoo/enterprise#58646
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2024-03-15 13:04:43 +00:00
Daryl Chen 9967a5cb99 [FIX] Base: Remove invalid User-Defined Filters
closes odoo/odoo#156622

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-03-12 11:55:40 +00:00
Rémy Voet (ryv) b9bfc0bb6e [FIX] core: sorted of new records + prefetch
BaseModel's sorted() has two problems:
- It breaks the prefetch of self for no reason
- When it is called without an argument, it filters out new records
because the search() used in sorted() doesn't return new records.

Keep the same prefetch as self to fix the first problem.
We partially fix/support the second issue, we just avoid filtering out
new records (but we don't actually sort them)

closes odoo/odoo#157145

X-original-commit: 0551c3b7e8e1469dabdb19d6420c544a1654fec5
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-03-12 10:34:51 +00:00
Julien Castiaux 822ab043f0 [FIX] base: concurrent cron worker and manual run
It is possible for a cron to be executed twice at a same moment if the
cron is currently being executed by a cron worker and that a user click
on the "run manually" button from its form view.

closes odoo/odoo#157203

X-original-commit: a45f171eabdb571465d6245bf2a6bccecab53fa0
Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-11 15:03:06 +00:00