Commit Graph
7424 Commits
Author SHA1 Message Date
Stéphane Bidoul 9d2b18f047 [FIX] core: don't fail on bad version for uninstallable addons
When an addon has an invalid version but is not installable,
there is no need to error out. This situation typically happens
when unmigrated modules are present in the addons path.

closes odoo/odoo#157657

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
2024-03-19 09:24:19 +00:00
Olivier Dony 4177e03c2d [FIX] tools: make module import order consistent
A long time ago, in a commit far far away: 65a3751613,
we introduced a mechanism to support the "import emulator" feature[^1] of
cPython. It's used by some C native modules to trigger an on-the-spot
module import during a low-level function call.

Some of the modules that do this are `datetime` and `time`:
- https://github.com/python/cpython/blob/b6535ea7ecf40c51a9a13089d961c29abeaffa5e/Modules/timemodule.c#L892
- https://github.com/python/cpython/blob/b6535ea7ecf40c51a9a13089d961c29abeaffa5e/Modules/_datetimemodule.c#L1654

Those `PyImport_ImportModuleNoBlock()` calls were initially understood as real
calls that needed to return the imported module. But the actual return value is
never used by PyImport_Import. As long as the call succeeds, it is
sufficient that the modules are imported and present in `sys.modules`
afterwards:
https://github.com/python/cpython/blob/b6535ea7ecf40c51a9a13089d961c29abeaffa5e/Python/import.c#L1825-L1834

In order to avoid randomizing the order of module imports, which can cause
unpredictable behavior depending on the timing of those "emulated imports",
it's simpler to provide a "no-op" import function, and ensure that all the
allowed modules are imported in advance, when the server starts.

This is what this commit does. For good measure, it will raise an error
if the module being imported is not already imported, which means it was
not one of the expected/allowed modules. In that case, it's sufficient
to pre-import the module.

[^1]: https://github.com/python/cpython/blob/b6535ea7ecf40c51a9a13089d961c29abeaffa5e/Python/import.c#L1756-L1766

opw-3721469
2024-02-07 13:48:01 +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
Julien Castiaux ca197d2a71 [FIX] base: log cron start/done also when running manually
The INFO "Starting job x" and "Job x done" logs are only logged for the
automatic executing of the cron by the cron worker. When running the
cron manually via its form view, no INFO was logged.

The technical support is reporting problems where a cron server action
is running twice at a same moment leading to problems such as
mass-mailing sending emails twice. There is a mutual exclusion mechanism
for cron workers but no exclusion mechanism seems in place for http
worker vs cron worker. Logging the "run manually" actions will help us
figuring out the problems.

X-original-commit: fcc2eabc671557e610688eac93bae333b0a2c119
Part-of: odoo/odoo#157203
2024-03-11 15:03:06 +00:00
Thomas Lefebvre (thle) 176f5ec4a2 [FIX] api: assert cr is a cursor when creating a new environment
`Environment.__new__` expects a Cursor.
Ensure developers pass a Cursor and not another kind of unexpected object.
Passing another object with the same attributes would work during
the creation of the new environment, but then would fail later,
when using the created environment with the wrong `cr` attribute,
with a less comprehensive error.

Task-3796479

closes odoo/odoo#80644

Signed-off-by: Raphael Collet <rco@odoo.com>
2024-02-13 09:07:38 +00:00
duongnguyen-viindoo 8d1b0f6a7a [FIX] core: post_load default value should be same as *_init_hook
-Step to reproduce: add a post_load method in the init of any module,
specify in the manifest like : 'post_load': 'post_load'. in v16 or above
Run
test_manifests of the test_lint module and we will get warning

closes odoo/odoo#156593

X-original-commit: f87473e82af8372346320ca747c1b41d3d5cf3c5
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-11 05:23:10 +00:00
Odoo Translation Bot 1b9fd01d46 [I18N] Update translation terms from Transifex 2024-03-10 00:13:03 +01:00
Xavier-Do 63214e55e8 [IMP] tests: add test for screencast
Screencast are not always enable and a recent change broke the ffmpeg
call. This call was already broken in some ffmpeg versions.

This test will help to ensure this feature continues to work, and will
also test it in different ffmpeg versions during distro builds.

closes odoo/odoo#156738

X-original-commit: a3d6ef64e218683f7455f60d20860b62780be3b9
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-03-07 08:25:55 +00:00
Nicolas Viseur (vin) d387f3d0d5 [IMP] l10n_nz: onboarding improvement
This tasks aims to improve the out-of-the-box configuration of the NZ
localization by updating some tax groups, taxes, accounts and default
COA settings.

Task ids 3647518 & 3647460

closes odoo/odoo#154541

Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2024-03-06 14:30:37 +00:00
Thomas Becquevort 751d555efa [ADD] l10n_zm: Zambia base package
Description of the issue/feature this commit addresses:

There is no localization for Zambia.

Desired behavior after this commit is merged:

This commit adds the base package of the Zambian localization including:
- Default Settings
- Chart of Accounts
- Taxes
- Fiscal Positions
- Reports (BS, P&L, Tax Report)

task-3391861

closes odoo/odoo#150134

Related: odoo/enterprise#54707
Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-03-06 14:30:35 +00:00
Julien Castiaux 52d7579435 [FIX] base: serve_fallback infinite redirection
Create an attachment with an URL to a static file that does not exists,
e.g. '/web/static/idontexist.png'. Inside your browser try to access
that file, open <localhost:8069/web/static/idontexist.png>. The browser
fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the
controllers, `_serve_fallback` kicks in and attempt to find a resource
outside of the router that matches the URL. In case it finds an
attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection
to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via `_serve_fallback`, only deliver stored
files.

closes odoo/odoo#156323

X-original-commit: d2bea592db6a66d531b83437d42b273606f629f1
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-05 14:22:20 +00:00
Xavier-Do d1a53e15e4 [IMP] tests: manage screencast frames after clear.
Reduce the log size in case of failure of a screencast frames
Avoid a race condition while removing tree.

closes odoo/odoo#156341

X-original-commit: 97dc741929eb9497f9b44c110607254f0a873698
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-03-05 10:03:19 +00:00
aamo-odoo 91e7c5313d [FIX] base : new attachement directory creation
Fix race-condition when a directory is created by two processes (python's os.py
handles it for all directories, but not for the last one). Happens sometimes
when generating assets for the first time (CSS, JS); one of the two times might
crash.

sentry-4417110945

closes odoo/odoo#156232

Signed-off-by: Fabien Pinckaers (fp) <fp@odoo.com>
2024-03-04 09:52:08 +00:00
Odoo Translation Bot cb45934163 [I18N] Update translation terms from Transifex 2024-03-03 00:09:56 +01:00
Benoit Socias 14221b5463 [FIX] base, website: include inherit_branding_auto in t-cache keys
When QWeb templates became cached and compiled in [1], the list of
default cache key elements did not contain `inherit_branding_auto`
(but it included the old `inherit_branding`).

Because of this the cache was shared between restricted editors and
public users, which could lead to problems such as missing the branding
on edited fields.

Steps to reproduce:
- Use a single browser instance and do not log any user out.
- Start with `website_sale`.
- Make "demo" user a restricted editor and a sales administrator.
- Connect on 127.0.0.1 as "demo" and go to a product website page.
- Go to 127.0.0.2 as a visitor and go to the same product page.

=> The product name field of the visitor page was branded.

If you swap the last two steps, the "demo" user's page lacks the
branding.

[1]: https://github.com/odoo/odoo/commit/7ede9bcb2de9d52994b3a6fcb84edc3f81d60284

task-3482439

closes odoo/odoo#156146

X-original-commit: 821888023db462d522c5d6de84fcab80a81c2713
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-03-01 18:23:56 +00:00
Jeremy Kersten 7cc2436405 [FIX] base: duration widget for unsupported babel format
In case of exception of type KeyError during the formatting with Babel
instead to raise a Traceback, we first retry with the en_US locale.

Babel fixes each week new bug of formatting like the one in the test,
but we cannot bump our default babel version since it is not in the
stable Ubuntu 22 so it is a best effort fix that will not hide all bugs
but is better that nothing.

https://github.com/python-babel/babel/pull/827

closes odoo/odoo#155909

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2024-02-29 17:43:07 +00:00
Ashith Farhan (asfa) c0166b9535 [ADD] base: Add country states for Jordan
closes odoo/odoo#155010

Signed-off-by: William André (wan) <wan@odoo.com>
2024-02-29 16:00:30 +00:00
Maksym Yankin 1c9e1f51a8 [IMP] ir_actions_report: maintainability improvement
Add a hook to prepare attachment values needed for attachments creation
during the pdf report generation

closes odoo/odoo#155518

X-original-commit: 9dd56a625f2b613a68746a80ee552bffbeb87455
Signed-off-by: Laurent Smet (las) <las@odoo.com>
2024-02-29 14:07:44 +00:00
Jeremy Kersten ea6aad812e [FIX] base: ir.qweb.field.contact handle null value
In case where display_name is null, the widget contact crash
 - AttributeError: 'bool' object has no attribute 'split'

On odoo.com we have around 3K of partner that have name with null value.
So calling so widget Contact on linked res.users will crash since the
display name is False

closes odoo/odoo#155735

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-02-29 12:13:38 +00:00
Daniel Kosky (dako) f9c209d356 [FIX] base: RDC/Congo phone codes
Phone codes for the Democratic Republic of the Congo (CD) and The
Republic of the Congo (CG) are the wrong way around, and ought to be
reversed.

This commit is based on a commit that was not merged in v14.0 in this

closes odoo/odoo#155680

Pr: https://github.com/odoo/odoo/pull/133287
X-original-commit: 230914dfce7de121ad81444d953a828620177eae
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
2024-02-27 22:35:24 +00:00
Nicolas Viseur (vin) 9e6afbd114 [ADD] Starshipit as a delivery provider
Starshipit is the leading provider of integrated
and automated fulfilment solutions for online businesses
integrating with the main carriers used in Australia and
New Zealand, such as Australia Post, DHL, Aramex, CouriersPlease and more

This PR will add support to integrate with starshipit directly in Odoo,
providing rates and shipping for users who need it.

Task ID # 3041982

closes odoo/odoo#135839

Related: odoo/enterprise#47569
Related: odoo/documentation#7798
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2024-02-27 17:40:49 +00:00
Chong Wang (cwg) 8ccde3f101 [FIX] core: fix translation typo fixing
for model_terms translated fields, for sake of typo fixing feature
if a term is removed after write its translations might be reused by another
close term which has totally different meaning

this fix removes the typo fixing if the matched closest term exists before write

closes odoo/odoo#155476

X-original-commit: 38ec36e9b5dde0c02a4ff47714b1056e0db76812
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
2024-02-26 23:09:37 +00:00
Ricardo Gomes Rodrigues 50d8450b6e [FIX] base: update pot
The pot file of the base module hasn't been updated in some time.
This commit takes care of that.

closes odoo/odoo#155375

Related: odoo/enterprise#57503
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2024-02-26 21:23:01 +00:00
Thomas Lefebvre (thle) 66ea20b16d [FIX] base: force xmlns definition to string
It is necessary to force the definition of a namespace in the string type,
as it may come from an external context.

See odoo/odoo@13af401bc2

opw-3767015

Signed-off-by: Christophe Matthieu (chm) <chm@odoo.com>
2024-02-15 17:59:55 +00:00
Thomas Lefebvre (thle) c6c2486e59 [FIX] core: evaluate representation of field as a string
In some scenarios, it is necessary to evaluate the representation
of fields as a string (which triggers issues if this is not the case).

closes odoo/odoo#155299

X-original-commit: e89b47f44548170abff088427149337411fcc47b
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2024-02-26 06:24:25 +00:00
Odoo Translation Bot 4f4ca50e8d [I18N] Update translation terms from Transifex 2024-02-25 00:13:04 +01:00
Julien Banken 1324bc72bb [FIX] base: allow fetching property field definition on unacessible parent record
When the user creates a new record having a property field, the system
fetches the property definition of the parent record to retrieve the
field's default values (see: `_add_default_values`). If the user lacks
read access on the parent record, the user gets an access error when
retrieving the property definition of the parent record.

To prevent this error, we will perform a sudo call on the parent record
before reading the property definition of the parent record. This allow
the user to create a new record, even if they do not have access to the
parent record.

task-3594814

closes odoo/odoo#155178

X-original-commit: 6f0fb8579d8230f91b7eefc5d29f8d61390dacc4
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Julien Banken (jbn) <jbn@odoo.com>
2024-02-23 16:43:35 +00:00
vava-odoo a37b0171dd [FIX] core: no warning in Graph for imported modules
Before this PR, after having imported a module, a warning appears in the
log, because it tries to update the graph which does not make sense for
an imported module.
This commit makes sure the warning is skipped if the module was
imported.

closes odoo/odoo#155096

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
2024-02-23 13:10:06 +00:00
Martin Trigaux 04587e1916 [IMP] base_setup: enable disabling default user rights propagation
When installing a new module, the access of the Default Template User
is propagated to any existing employee (introduced at
aefb05eb497a8a16a). This can be problematic in companies that don't
want all their employees to become manager by default.  Allow to
disable this behaviour in a settings.

This is the version of the patch targetting stable version that is not
configurable through the interface, manually creating an ICP
base_setup.default_user_rights_minimal=True as the way to change the
behaviour.

Closes odoo/odoo#149224
Task-id 3685856

closes odoo/odoo#154816

X-original-commit: 70f66f147bb0c133be6ae3fd2b11438afe2366a5
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2024-02-21 11:28:00 +00:00
Rémy Voet (ryv) 86dd313d10 [FIX] core: fix read_group with groupby=['id']
Use read_group with groupby=['id'] raise a Exception:
```
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 2386, in _read_group_format_result
    m2x_records = self.env[field.comodel_name].browse(ids).union()
  File "/home/odoo/Documents/dev/odoo/odoo/api.py", line 521, in __getitem__
    return self.registry[model_name](self, (), ())
  File "/home/odoo/Documents/dev/odoo/odoo/modules/registry.py", line 190, in __getitem__
    return self.models[model_name]
KeyError: None
```
Even if it doesn't make lot of sense to do that (mostly equivalent to
search), it is preferable to manage the case correctly.

closes odoo/odoo#154799

X-original-commit: 75a259365989d469972c0616dba22a56bf218bb5
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-02-21 09:41:26 +00:00
Raphael ColletandLucas Perais 15bfff301c [FIX] web: onchange() does not handle _inherits parent field in one2many
Consider models A and B such that B inherits from A (with _inherits),
and a form view of A with a one2many field that inverses the many2one
"delegate" field from B to A.  When adding a new record in the one2many,
onchange() crashes while trying to update the cache of an empty parent
record.

The situation is caused by how onchange() initializes the new record of
model B, and the fact that the form provides a value for the delegate
field.  The new record is actually initialized with an empty value for
the delegate field, which causes the code to crash.  The fix simply
consists in updating the parent record only if is nonempty.

opw-3744514

closes odoo/odoo#154735

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
2024-02-20 14:57:35 +00:00
Odoo Translation Bot 1cf48deef9 [I18N] Update translation terms from Transifex 2024-02-18 00:12:23 +01:00
flvr-odoo f6212e4554 [FIX] base : make the module list sorted
Make the set() of module sorted, aka a list.

We can be pretty sure that nobody relied on the order of this set before
since it was completely underterministic. Therefor this change should
not break anything and make the testing on runbot more consistant.

This is mainly following the issue with the sql-injection testing
failing randomly with the order of the modules.

closes odoo/odoo#154324

X-original-commit: bbe33a1260ab3bfe97caa1197adbf00c661ddfb4
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
2024-02-16 13:51:53 +00:00
Ruben Gomes (rugo) b54df52774 [IMP] odoo.tools: add rounding_mode and amount_rounding to formatLang
Adds the possibility to give formatLang() a 'rounding_mode' (any Decimal rounding mode)
and an amount_rounding ('decimals', 'units', 'thousands', 'millions' and 'lakhs').

'amount_rounding' will display the amount in the given unit. For example, 10456 in 'thousands' will be 10.

task-3626894

closes odoo/odoo#151314

Related: odoo/enterprise#55218
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2024-02-16 12:12:41 +00:00
Ruben Gomes (rugo) a454456148 [REF] odoo.tools: clean up formatLang
Simplify and clean up formatLang code (in preparation for improvement).

Part-of: odoo/odoo#151314
2024-02-16 12:12:41 +00:00
Renaud Thiry ffda905ba7 [FIX] mail: consider empty "section" nodes to be empty html
Currently an empty section is not considered empty text.

As the web editor sometimes uses them, it is relevant to consider
them when asking whether some html will appear empty.

Currently, even completely removing the website description of an
exhibitor in website_event_exhibitor from the backend does not make
the 'missing description' tooltip appear in the front-end

task-3607615

closes odoo/odoo#154097

X-original-commit: 7dc376d4d2d2b4000de0da7573c30e4508f32318
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
2024-02-15 07:54:50 +00:00
Stanislas Sobieski ac572d1e76 [FIX] mail: setup system example email in base to avoid overwrite at mail install
closes odoo/odoo#153529

X-original-commit: bd4eedc3fbefb75381b2b6457e5145edac2be031
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Stanislas Sobieski (sts) <sts@odoo.com>
2024-02-12 20:24:13 +00:00
Alvaro Fuentes f3eb6f395a [FIX] core: ensure SQL formatter can handle large domains
In previous versions the max size of a domain was bounded by psycopg
memory limits. With the new SQL formatting mechanism the limit is bound
by the maximum recursion limit in Python side. The purpose of this patch
is to restore previous behavior.

In 16.0:
```
>>> def make_dom(N):
...     return [*('|' for x in range(N-1)), *(('login', '=', 'admin') for x in range(N))]
...
>>> u.search(make_dom(9984))
res.users(2,)
>>> u.search(make_dom(9985))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    u.search(make_dom(9985))
  File "/home/odoo/src/odoo/16.0/odoo/models.py", line 1520, in search
    return res if count else self.browse(res)
  File "/home/odoo/src/odoo/16.0/odoo/models.py", line 5140, in browse
    if not ids:
  File "/home/odoo/src/odoo/16.0/odoo/tools/query.py", line 217, in __bool__
    return bool(self._result)
  File "/home/odoo/src/odoo/16.0/odoo/tools/func.py", line 28, in __get__
    value = self.fget(obj)
  File "/home/odoo/src/odoo/16.0/odoo/tools/query.py", line 210, in _result
    self._cr.execute(query_str, params)
  File "/home/odoo/src/odoo/16.0/odoo/sql_db.py", line 321, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.SyntaxError: memory exhausted at or near ""login""
LINE 1: ...((("res_users"."login" = 'admin') OR ("res_users"."login" = ...
```
in 17.0 without this patch
```
>>> u.search(make_dom(1480))
res.users(2,)
>>> u.search(make_dom(1481))
  <shortened output ...>
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
    child = stack[-1].send(child)
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 86, in <genexpr>
    if isinstance(child, SQL):
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
    child = stack[-1].send(child)
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 86, in <genexpr>
    if isinstance(child, SQL):
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
    child = stack[-1].send(child)
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 86, in <genexpr>
    if isinstance(child, SQL):
  File "/home/odoo/src/odoo/17.0/odoo/tools/sql.py", line 85, in code
    child = stack[-1].send(child)
RecursionError: maximum recursion depth exceeded
```

This issue was observed in upgrades in multiple instances. Example: MRP
produces an OR domain with 2K terms for warehouse sub-locations that
fail.

closes odoo/odoo#153394

Signed-off-by: Raphael Collet <rco@odoo.com>
2024-02-12 20:24:08 +00:00
Thomas Lefebvre (thle) 90853ef0ab [FIX] im_livechat: add self writable fields for user
Issue:
------
Since this commit[^1], a user who is not in the `Administration/Access Rights`
group cannot modify certain fields available to him on his user profile
(`livechat_username` and `livechat_lang_ids`).

Solution:
---------
As it is possible for a user to write to these fields, it is necessary
to put them in `SELF_READABLE_FIELDS` in order to obtain sudo rights
when writing if the environment user corresponds to the user
to whom we want to write the new values.

opw-3717266

[^1]: 78f6b83b34

closes odoo/odoo#152425

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-12 20:24:03 +00:00
Denis Ledoux b23cb16487 [FIX] core: restrict httprequest attributes
The version of werkzeug installed can vary from one deployment
to another, as we recommend to use the operating system package,
and the version can therefore change according to the operating
system version.

e.g. the werkzeug version installed using
`apt install python3-werkzeug` varies between
Ubuntu 18.04, 20.04, 22.04, 23.10, ...

We want to keep under control the attributes
developers use on werkzeug.wrappers.Request,
to avoid compatibility issues from one
version to another.

Therefore, this revision aims
to subclass werkzeug.wrappers.Request to limit
the attributes which can be used.

task-3734305

Part-of: odoo/odoo#78857

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-12-07 12:53:19 +00:00
Odoo Translation Bot dd40867949 [I18N] Update translation terms from Transifex 2024-02-11 00:14:17 +01:00
Gauthier Wala (gawa) c017f44f4f [FIX] tools: fiscal year of 30/12 is taken as 31
To reproduce:
- Put your fiscal year to the 30th of December (yes it's unlikely)
- Create an asset
- Compute depreciations
=> they are created for the 31th of December

It comes from the `get_fiscal_year` in `date_utils` which considers it as the case of the 28th of February

opw-3704466

closes odoo/odoo#153528

X-original-commit: cd0bb178441790e7e33c0d1c01b7ade82d4ab8c0
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2024-02-10 17:43:14 +00:00
sesn-odoo b499ab0540 [FIX] base: prevent deleting a company if it has children
Steps to reproduce
------------------
* create the following hierarchy of companies:
  ```
    Company
    └── Branch A
        └── Branch B
  ```
* delete `Branch A`

From then on, whatever you do will result in a Bad Request response.

opw-3662711

closes odoo/odoo#153264

X-original-commit: da803db384ec809a9c68dd379bf3c03f00d5a731
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2024-02-09 11:57:29 +00:00
Nikhil Kajavadra 2f5fd750d4 [FIX] tools: avoid updating translation of '__export__' module
If translation of '__export__' module record's source and translated value in
'en_US' language is different. In that case, record's value of en_US lang is
translated value. Also in most of the case export module records are set as
noupdate false due to this while upgrading the database to version 16 from lower
version, the record's value is changed to their source value for 'en_US' lang.

To avoid this problem of updating a record's value, this PR will not considering
'__export__' module records for translation updates. Hence,'__export__' module's
records translation remain same  as per original database.

Task : 3626386

closes odoo/odoo#148757

X-original-commit: 29341902bd6b6b7ff84eede2651251f6d2ce2faa
Signed-off-by: Raphael Collet <rco@odoo.com>
2024-02-08 15:07:54 +00:00
nda f67db6fe1e [FIX] core: remove control characters from strings for xmlrpc
According to https://docs.python.org/3.7/library/xmlrpc.client.html :

When passing strings, characters special to XML such as <, >, and & will be
automatically escaped. However, it’s the caller’s responsibility to ensure that
the string is free of characters that aren’t allowed in XML, such as the
control characters with ASCII values between 0 and 31 (except, of course, tab,
newline and carriage return); failing to do this will result in an XML-RPC
request that isn’t well-formed XML.

This commit implements the removal of control characters from strings. As we
convert binary data to a string and return it, the resulting string should not
contain forbidden characters neither. The modification of dump_unicode function
now fulfills this requirement and can be applied to dump_bytes, contributing
to a more consistent behavior overall.

steps to reproduce:
- create a product with an ASCII control character in its name (ex: \x03)
- read the product name using XMLRPC

before this commit:
- client can't parse the response, an error is raised

after this commit:
- we make sure the string is free of those characters

opw-3617458

closes odoo/odoo#153084

X-original-commit: 3fa92ff58daef0dd2464beadeafef208871deca6
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Nicolas Danhier (nda) <nda@odoo.com>
2024-02-07 18:34:24 +00:00