Commit Graph
7274 Commits
Author SHA1 Message Date
Chong Wang (cwg) d94898a3ae [FIX] tools: remove nondeterminism in pot files
The test added in 09a4762b will fail randomly, because of the nondeterministic
os.walk access. This commit removes this nondeterminism in the pot.

closes odoo/odoo#143918

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-11-30 07:37:17 +00:00
Louis (wil) 2b7f88004d [FIX] base: correct wrong translation
'field' is the name of a variable and shouldn't be translated

closes odoo/odoo#143441

X-original-commit: 52ce28f8c2e7998e247d3291e57ddd1ca3d604b9
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-11-30 07:37:07 +00:00
Hugo Carlier (Huca) 9048f585c7 [FIX] models, *: make read_group domains coherent with access rights
* = test_read_group

Currently, a search with the following domain `[('m2m_field', '=',
False)]` will return only the records for which the m2m field is actually
empty and not take access rights into account. This means that, for a
given user and depending on access rules, `record.m2m_field` can give an
empty recordset while a search using the previous domain won't return
this record.

This behavior is problematic when such a domain is returned by the
read_group. Indeed, when using read_group to group on a m2m field,
records for which this m2m field appears empty for the current user will
be counted in the column 'False'. However, the domain associated to this
column is not always valid, as this m2m field can appear empty for the
current user but still have records in it that the current user does not
have access to. Such records won't be returned by a search performed
using the domain returned by the read_group for the False column.

closes odoo/odoo#143233

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-28 21:20:59 +00:00
Yolann Sabaux 0148f19f67 [FIX] account, base: prevent merging account.account
Steps to reproduce:

- Enable the merge on account.account in data cleaning APP (in debug)
- Create an invoice with a receivable account = A
- Define a lock  date after the invoice date
- Go to chart of accounts
- Select your receivable = A et receivable = B
- Action = Merge accounts where B is the MASTER

Issue:
Upon revisiting the customer invoice: Notice that the journal items have been updated.

Solution:
We simply prevent ~~the use of a nuclear weapon~~ the merge of `account.account` as there other possibilities less dangerous such as multi-edit + archiving

We also prevent the merge of `res.partner` if this one is used in hashed entries

oe:https://github.com/odoo/enterprise/pull/47053

opw-3389157

closes odoo/odoo#142937

X-original-commit: bc66f698e2c4edf2cedce4637dfb7aafaf119251
Related: odoo/enterprise#51170
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
2023-11-28 21:20:58 +00:00
Xavier-Do ad993e673d [FIX] base: avoid no autoinstall propagation
A custom script is modifying the output of
load_information_from_description_file to disable the
auto-install of modules during local testing. It was naively adapted for
v16.0 by replacing the corresponding methods. Since a lru cache was added
(nice optimization in most cases) this is an issue because running lint
test afterward will get the cached value with an incorrect autoinstall
value. It makes sens to avoid reading the file on the filesystem each
time, but making a deepcopy looks like an acceptable safeguard to avoid
hard to debug behaviors.

closes odoo/odoo#143628

X-original-commit: ad10ff4410ccf7c38f6154480484495bb57c53ff
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-11-28 06:19:55 +00:00
Nicolas Lempereur 7c7f927bef [FIX] core,account: no join for grouping by m2o id
When using account.root (through account.account().root_id or
account.move.line().account_root_id) in read_group, we can have
inconsistent results because of how account.root is defined.

account_root is a view with the id field computed out of account codes,
but there can be the same account for several companies, so we can have
several same ID for different rows => this is not expected by the ORM
who expects one record by ID => in result, we get for example the values
in the pivot table of journal items be multiplied by the number of
companies if we group by "Account Root".

With this changeset, we add a small optimisation in ORM so if a group by
is ordered by a many2one, if the order of the many2one is "id" we don't
add a left join for ordering.

note: without the change, the added tests failed:

- in account, with 1000 as balance, and 2 as number of root with id=90090
- in test_read_group with a query containing a left join to o2m table
- in test_new_api with a query containing a left join to o2m table

opw-2282699
opw-2289440
opw-3288390

closes odoo/odoo#143257

X-original-commit: 674bdd1ac2cf9a4a3748b85f71ebbd01137485ce
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-27 12:39:55 +00:00
Chong Wang (cwg) 9e32ac4292 [IMP] core: support field.export_string_translation
Some auto-generated field labels don't make sense for translators. For example
field: needed_terms_dirty label: "Needed Terms Dirty"

After this commit, if the field.export_string_translation is False, we don't
export their labels when export translations.

closes odoo/odoo#142329

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-11-27 12:39:51 +00:00
Chong Wang (cwg) 09a4762be4 [IMP] test_translation_import: support testing exported pot files
test exported pot files

Part-of: odoo/odoo#142329
2023-11-27 12:39:51 +00:00
Odoo Translation Bot 3ffba892de [I18N] Update translation terms from Transifex 2023-11-26 00:20:02 +01:00
Raphael Collet 425a6054ec [FIX] core: modified() for context-dependent non-stored recursive fields
When recursing on non-stored recursive fields, modified() only considers
the records that have some value in cache.  But when fields are context-
dependent, we may miss some records because we look up for cache values
in the wrong context.  Instead, consider cache values in all contexts
for that matter.

closes odoo/odoo#143644

X-original-commit: f19732c199e6bb2b8bdd55808658cb82c8cd44b4
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-11-25 06:43:38 +00:00
Raphael Collet 232f34d226 [FIX] core: modified() on recursive fields before unlink()
The following situation happened with module industry_fsm, when trying
to delete a cancelled sales order corresponding to a task.  When doing
so, the server crashes with error "Could not find all values of X to
flush them", which means that a dirty field (pending update) has lost
its value from cache.

The issue is related to recursive computed fields.  Before deleting a
record, method unlink() invokes modified(), which determines all the
fields that depend on the record to be deleted, and marks them to
recompute.  Those fields should be recomputed after the record is
deleted, and not before.  We found out that the recursive call to
modified() made for recursive fields can force the recomputation of the
recursive field itself before the record is deleted, which causes
unlink() to crash.

The fix consists in marking the fields for recomputation at the very end
of method modified(), after all the fields to recompute have been
determined.  This ensures that the processing of recursive fields always
uses the current value of the field instead of its recomputed value.

X-original-commit: 1f5293bc63ae7b06fd0df8d509dc7fafaa016a22
Part-of: odoo/odoo#143644
2023-11-25 06:43:38 +00:00
nda dd94201d0f [FIX] core: perform one validation in convert_to_column for HTML field
This commit removes an unnecessary field validation for HTML field.

closes odoo/odoo#143307

Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Nicolas Danhier (nda) <nda@odoo.com>
2023-11-25 01:23:20 +00:00
nda b478c42beb [FIX] core: avoid infinite loop during HTML sanitize
During an onchange, fields read from database are validated again. This causes
an infinite loop with HTML fields since Odoo 16  because we're revalidating a
value we're reading from the database, which triggers a sanitisation check,
which fetches the original value, etc etc.

Even if the functional bug only appears in 16.0 and above, the root cause is
also present in 15.0 so this commit targets 15.0

steps to reproduce (in 16 or next versions):

- Change Marc Demos's access rights Website = Restricted Editor
- Bypass HTML Field Sanitize = Off
- Inventory / Products / Product Variants
- Studio on the Sales tab and add website_description under Website Sequence
- Go to product [E-COM07] Large Cabinet and fill in the newly added website description
- Log out and log in as marc demo
- Navigate back to [E-COM07] Large Cabinet product variant and try to re-order the vendors on the purchase tab
- Error

before this commit:
Error (infinite loop) during onchange

  File "/home/nda/dev/odoo/16.0/odoo/odoo/models.py", line 6489, in onchange
    record[parent_name]._update_cache({name: record[name]})
  File "/home/nda/dev/odoo/16.0/odoo/odoo/models.py", line 5310, in _update_cache
    value = field.convert_to_cache(value, self, validate)
  File "/home/nda/dev/odoo/16.0/odoo/odoo/fields.py", line 1977, in convert_to_cache
    return self._convert(value, record, validate)
  File "/home/nda/dev/odoo/16.0/odoo/odoo/fields.py", line 2000, in _convert
    original_value = record[self.name]
  File "/home/nda/dev/odoo/16.0/odoo/odoo/models.py", line 5897, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/nda/dev/odoo/16.0/odoo/odoo/fields.py", line 1198, in __get__
    value = self.convert_to_cache(record._origin[self.name], record)
  File "/home/nda/dev/odoo/16.0/odoo/odoo/fields.py", line 1977, in convert_to_cache
    return self._convert(value, record, validate)
  File "/home/nda/dev/odoo/16.0/odoo/odoo/fields.py", line 2000, in _convert
    original_value = record[self.name]
  ...

after this commit:
no error

opw-3575865

X-original-commit: 24d804e
Part-of: odoo/odoo#143307
2023-11-25 01:23:20 +00:00
Martin Trigaux 072f49fad2 [ADD] base: add es_419 flag
The language was added at dccc8f39d0
419.png as odoo thinks it's a country...

closes odoo/odoo#143439

X-original-commit: 3bb58958c8f5f98da21bdac411bd226d03e1591b
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-11-24 23:57:33 +00:00
Abdelouahab (abla) 6021fd883f [FIX] base: report html must be parsed as unicode
To reproduce
============
having a special character in url like `à` (it's possible)
try to print an invoice, a weird character is printed next to currency symbol

Problem
=======
Apparently the method responsible of converting from string to html
analyzes the few first characters to determine the encoding,
so having the base url in the beginning with its special character
leads to wrong encoding.

Solution
========
convert using html parser with unicode encoding

opw-3415418

closes odoo/odoo#143462

X-original-commit: b1cf2a209230b4ace817ff51ab5f55f19b586b11
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
2023-11-24 11:17:03 +00:00
Isaac Gallart Bochons ca217195d7 [FW][FIX] base: postgres subprocess error when dumping database
When Odoo is installed with the latest version of the PostgreSQL client (postgres-client or postgres-client-16) and running in Docker (possibly other environments as well but not reproduced so far), executing `pg_dump` via `exec_pg_command` fails with

    Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmpmnqiktog/dump.sql', '15TEST') error 1

This seems to be because `os.devnull` is being opened in *read* mode which is incorrect (as it's written to). It's not entirely clear if older `pg_dump` simply ignored the non-writable stdout or if docker adds some restrictions which cause the failure.

Either way this can be solved by either opening `os.devnull` in write mode or switching to the `DEVNULL` constant. While the function is deprecated in 16.0 (7f14631fe8) and removed in master (ae3056f3f4fca82c6aee69bf201532e14829c45e) the latter is not a huge change and it a touch cleaner.

fixes #139687

closes odoo/odoo#143198

Forward-port-of: odoo/odoo#142987
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-11-22 21:45:11 +00:00
Adrien Widart (awt) c5fbdcf1c6 [FIX] base: import record using database identifier
Suppose a user who imports a new picking thanks to this:
```csv
location_id,location_dest_id,picking_type_id
WH/Stock,Partners/Customers,YourCompany: Delivery Orders
```
Then, on the inferface, for one of the fields, he sets the value as
"Database ID" (for instance "Destination Location/Database ID").
When trying to import the file, an error is raised, which could make
sense since the provided value is not a DB identifier, but the error
is actually incorrect:
> Odoo Server Error. Current transaction is aborted, commands ignored
> until end of transaction block

When looking for the destination location in the database, it will
raise a legit error since the domain does not make sense:
`[('id', '=', tentative_id)]`
Hence this:
> ERROR: invalid input syntax for type integer: "Partners/Customers"

The good point is that everything in the code already handles this:
we catch the error and add some detailed explanations in the import
error report, but... The SQL transaction is now broken. So, as soon
as another SQL request is executed, it will trigger an
`InFailedSqlTransaction` error, we will not catch it and this error
will be returned to the frontend (we lose the import report).

sentry-3969379125

closes odoo/odoo#143010

X-original-commit: b0e86e5c6d4b54134b91dbde3a145b551158b76d
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-22 08:55:48 +00:00
Victor Piryns (pivi) 3abe01923e [REM] base: removing slow partner cycle search dead code
Description:
Since 54857ec409 , the results of the
expensive recursive CTE on `res.partner` were never used. So the query
doesn't do anything at all, besides slowing down the whole process
for minutes on databases with a large volume of `res.partner` entries.

Fix:
Removing the dead code

Reference:
task-3601394

closes odoo/odoo#142914

X-original-commit: 29223533f625d579e424bdc133d0cfc472946b6b
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2023-11-21 23:24:04 +00:00
william-andre 7c1256a302 [FIX] tests: do not assertQueries before warmup
Just like for `assertQueryCount`, we should not take into account
queries that are not run after a warmup, for consistency.
This allows to easily interchange both context managers for debugging
purpose for instance.

closes odoo/odoo#142450

X-original-commit: aaa1d287085c8b2fe20b6591ca9f1b5bbe65d3db
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-11-20 03:46:43 +00:00
Odoo Translation Bot f6fe982853 [I18N] Update translation terms from Transifex 2023-11-19 00:28:08 +01:00
Thibault Delavallée 795091c69d [FIX] base: fix 'extract_rfc2822_addresses' in case of email-like name
Remove quotes when name of a formatted email is also an email, as indicated
in tests. We still get two emails being sent for a given outgoing email
when the name part is an email but that would be difficult to avoid.

Task-3566542

closes odoo/odoo#141856

X-original-commit: odoo/odoo@d3cdaa6c18
Related: odoo/enterprise#50892
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-11-17 16:11:51 +00:00
Thibault Delavallée cd5727c488 [IMP] base: add test cases for 'extract_rfc2822_addresses'
Add test cases related to an issue found during mail gateway testing. When
an email_to is formatted like '"robert@notgmail.com" <robert@notgmail.com>'
the tool finds two emails. As it is used in IrMailServer it sends two emails
insted of one. This may happen notably when partners are automatically created
based on an email only in which case it is put in both name and email.

Task-3566542

X-original-commit: odoo/odoo@312323e0d9
Part-of: odoo/odoo#141856
2023-11-17 16:11:51 +00:00
Thibault Delavallée a03ae3765e [IMP] base: fallback on 'email_re' when getadresses fails
When 'getadresses' fails at parsing some input and give us a result like
'gmail.com' (see previous commit adding test cases) we fallback on using
'email_re' which is better at finding email addresses in a global string.
We use it only in this specific case as fallback mechanism to rely on
'getadresses' when possible.

Task-3572208

X-original-commit: odoo/odoo@8e61a3b690
Part-of: odoo/odoo#141856
2023-11-17 16:11:51 +00:00
Thibault Delavallée d5b39338ff [IMP] base: add test cases for 'email_split'
Add test cases related to issues found in various leads management. All those
email inputs lead to an email found being '@gmail.com' (or equivalent) which
is not a valid email.

A consequence of that behavior is that 'email_normalized' for several leads
is the same ('@gmail.com') and they are considered as being the same email
identity. They could be included in a pack of leads to merge (see 'crm').

Task-3572208

X-original-commit: odoo/odoo@7498b9a0a1
Part-of: odoo/odoo#141856
2023-11-17 16:11:51 +00:00
Lucas Perais e08ddc21a6 [FIX] web: reload on usable view when switch company does AccessError
Be logged in multiple companies (A and B).
Be on a form view of some record which is visible only on company B via ir.rules.

With the company switcher, unlog from company B.

Before this commit, the user received an AccessError and arrived on a blank webclient.
To say the least, it was rather inelegant.

After this commit, the user ends up on the multi-record view of that model, provided that it is available for use.

Task-3029616

closes odoo/odoo#141796

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-17 16:11:50 +00:00
Martin Trigaux 9429986b63 [FIX] base: join correctly the path
os.path.join(..., <absolute>) returns <absolute> path

closes odoo/odoo#142307

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-11-17 04:35:40 +00:00
nda 4612f6a7ee [FIX] auth_signup, website: make reset password multi website friendly
The "reset password" feature does not take into account
multi-website.

steps to reproduce:
- create a website A
- uncheck 'Shared Customer Accounts' on website A
- create a portal user user@example.com on website A
- create a website B
- uncheck 'Shared Customer Accounts' on website B
- create a portal user user@example.com on website B
- reset password for user@example.com on any website

before this commit:
An error is raised "No account found for this login"
(which is false, actually 2 accounts are found)

after this commit:
Only the user linked to the current website is properly
selected

opw-3551540

closes odoo/odoo#142110

X-original-commit: a2196253d6cf90dca3042a777703e0679f74f542
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-11-16 23:35:57 +00:00
Raphael Collet f1b1a2b44d [FIX] tests: make server-side Form use web_save() like the web client
closes odoo/odoo#142275

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-16 11:44:57 +00:00
FrancoisGe f10e7e01e4 [FIX] test_main_flows: edit record after Save & New
Since the commit afdcf9a5d5cd0d25b2ba61167d3ae6726a97d554, the mobile main flow tour
fail sometimes. This is due to the fact that the tour try to edit the record
before the new record is displayed.

The solution is to wait for the new record to be displayed before trying to edit it.

closes odoo/odoo#142124

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-11-15 15:03:54 +00:00
Rémy Voet (ryv) 444dbf2001 [FIX] core: avoid quadratic complexity for partial compute methods
For a compute store field with new records (e.g. during an 'onchange'),
the compute method can be called multiple times on the same records
without changing the dependencies. Moreover, it can lead to have N² / 2
complexity for a trivial compute on N records.

With partial (where we don't always change the value) compute method:
```
@api.depends('reward')
def _compute_has_been_rewarded(self):
    for rec in self:
        if rec.reward:
            rec.has_been_rewarded = 'Yes'
```

If every `reward` of `self` (N records) is `False`, when the ORM needs
to recompute `has_been_rewarded` of `self`: the compute will be batched,
but only the first record in the batch will be set (to `False`) each
time (due to the current fallback - "fallback to null value if compute
gives nothing"). This means that we will call the compute method N
times, and the compute itself will loop on an average of N/2 records
(the prefetch set decreasing at each step).

Fix this quadratic behavior by setting the cache to `False` for every
record not set during the compute method (instead of just the current
record).

closes odoo/odoo#142162

X-original-commit: 1604ee983aadc0cbee0cd50cbea2b09572905b04
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-15 13:56:36 +00:00
flvr-odoo 3e3843114f [FIX] test_lint: add support for %d in string format
This commit add and test the support for string format with %d. this
is because python will fail if a string is passed to a %d, and
therefore we can consider it safe.

closes odoo/odoo#141993

X-original-commit: 37157cfa5df1201ffd51520969a3fb6b8a9dfdb1
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
2023-11-14 15:16:07 +00:00
Xavier Morel bc81230311 [FIX] core: skip marking completed tours as failed, restore had_failure
Succeeds #140464

Misunderstood `had_failure` and should not have reused it, its goal is
to avoid eagerly aborting some JS tests -- specifically the unit test
suites -- while still logging errors normally (useful when watching
interactively, or for the runbot's own reporting).

So the *checks* added on `had_failure` should in fact be checks on
`_result.exception()`, and as it turns out on `_result.done()`: if a
tour is already marked as successful we can't fail it either.

So we should not, we should log an error (to notify the caller /
runbot) and then bail. While #140464 did improve some things, we could
still lose legit errors and get pages of unhelpful `InvalidStateError`
if a tour would succeed *then* failures would occur, as the guard only
checked that the tour had already failed.

closes odoo/odoo#141815

X-original-commit: 87fcf66203dcbd281470285d648365d33d0e2fca
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-11-13 14:38:40 +00:00
Jorge Pinna Puissant d1fed769d6 [FIX] base, test_assetsbundle, web: multiple broken XML files in assets
When there are multiple broken XML files in an assets bundle. During the
bundle processing, a template containing the parsing error message is
returned for each XML file that is broken.

Before this commit, each of the returned templates had the same name,
raising another error ("Template already exists in module").

Now, all the returned templates has unique names.

closes odoo/odoo#141568

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-13 10:31:46 +00:00
Odoo Translation Bot b61c1ac0b3 [I18N] Update translation terms from Transifex 2023-11-12 00:21:23 +01:00
Jorge Pinna Puissant afc8dde97a [FIX] base, web: log correctly error in assets
Since [1], when an error exists in an asset, the assets raise a not
found exception. The issue, is that, there is no feedback for the
developer to find the error.

Now, a new console log with the error details is shown.

[1] : bf3b6b0b8b

closes odoo/odoo#141705

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-11-10 12:33:40 +00:00
Louis (wil) b6b093b06f [I18N] base: fix bad translations
closes odoo/odoo#141704

Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-11-10 08:31:43 +00:00
MerlinGuillaume cdcdee40f4 [FIX] base: error when setting a too big default value for integer
Setting a default value for an integer that is greater than that allowed
by a 32-bit integer raises an error when we save a new record so it
isn't clear that the issue comes from the default value

Steps to reproduce:
1. Install Contacts and Studio
2. Go to Contacts and open any contact
3. Toggle Studio and add an integer field in the view
4. In the Studio sidebar, set the default value to 3 000 000 000
5. Save and close Studio
6. Create a new contact, give it a name and try to save the record
7. An error is thrown

Solution:
Raise an error if we set an integer field's default value out of the
bounds of a 32-bit integer

opw-3360160

closes odoo/odoo#141339

X-original-commit: 85978e4c6fb1199f5e6ec4dce5c45b9f09be9b77
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-11-09 14:51:21 +00:00
Odoo Translation Bot 593ac17031 [I18N] Update translation terms from Transifex 2023-11-09 11:30:34 +01:00
Louis (wil) 68b4dfc2bb [I18N] *: import translations
closes odoo/odoo#141655

Related: odoo/enterprise#50484
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-11-08 20:48:14 +00:00
Saurabh Choraria 90f235fcef [FIX] base: raise ValueError when user enters wrong path
When the user tries to add properties field in domain of a model
without property name the error occurs.

To reproduce the issue:
- Install knowledge module.
- Go to Settings > Technical > User Defined Filters.
- Enter a name, add 'Knowledge Article' as model and then add domain
[('article_properties', '!=', False)].
- Click on save button and then on refresh button below code editor of domain.
- The traceback will be generated

Error: IndexError: list index out of range

The issue is occurring because we are getting single element
in path over here -
https://github.com/odoo/odoo/blob/f4e60765db57fe3612f267e8fa44d10ccf5ff107/odoo/osv/expression.py#L649
but we are trying to access path[1] due to which IndexError is occurring
over here -
https://github.com/odoo/odoo/blob/f4e60765db57fe3612f267e8fa44d10ccf5ff107/odoo/osv/expression.py#L683
and here -
https://github.com/odoo/odoo/blob/f4e60765db57fe3612f267e8fa44d10ccf5ff107/odoo/osv/expression.py#L687

The condition is also wrong over here -
https://github.com/odoo/odoo/blob/f4e60765db57fe3612f267e8fa44d10ccf5ff107/odoo/osv/expression.py#L683-L684
in which we are checking length of path is not equals to 2 and then also
we are trying to access path[1], due to which ValueError becomes a dead code.

To fix this issue 'and' is replaced with 'or' in that condition.

sentry-4499339271

closes odoo/odoo#141533

X-original-commit: da41853fc93a60a0a05083d79f0bb08f429cded9
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Saurabh Choraria (sauc) <sauc@odoo.com>
2023-11-08 12:14:50 +00:00
Chong Wang (cwg) 1a7978e509 [FIX] base: fix update translations for base field
in #124402
`update_field_translations` will call `write` to trigger all override logics.
But for ir.model.fields, write will call init_model which may remove all
translations. This commit fix the issue by adding a bypass for translate_only
`write`.
(this commit is the merge of #141126 and #140695)

opw-3575512

closes odoo/odoo#141472

X-original-commit: 33f08c40c92429ada6c5b0387f36d32d4825fcb6
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
2023-11-08 04:09:54 +00:00
Antoine Vandevenne (anv) 1fb7571afb [FIX] *: retarget documentation links to 17.0
closes odoo/odoo#141406

Related: odoo/enterprise#50357
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-11-07 23:57:41 +00:00
Christophe Monniez 252becef19 [FIX] base: 3.11 compatibility
Complement of the previous complement e2752a04ff (#137099)

Those opcodes were added in Python 3.11 and we missed them.

Fixes #140588

closes odoo/odoo#141015

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-11-07 15:12:48 +00:00
wangting 1af1d03265 [FIX] base: fix ir.act.server _compute_webhook_sample_payload
closes odoo/odoo#141114

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-11-06 19:32:06 +00:00
Louis (wil) af5a5f4986 [I18N] *: export source terms
closes odoo/odoo#141127

Related: odoo/enterprise#50247
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-11-06 16:55:41 +00:00
Xavier ALT 9976d707f0 [FIX] base_import_module: fix crash for imported module icon
With normal module, the icon is always loaded from the filesystem but
when importing a module that contains a module icon (by default in
static/description/icon.png) it crash with a `FileNotFound` exceptions
because the image is not available on the filesystem but as an
ir.attachment.

This ensure that for imported module we load the icon from the
corresponding imported attachment

closes odoo/odoo#141133

Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
2023-11-06 12:32:03 +00:00
Rémy Voet (ryv) c1e8a32e7d [FIX] core,*: Fix display_name computations for new records.
As of https://github.com/odoo/odoo/pull/114024, `display_name` is
implicit in every form view (see the use of addFieldDependencies in the
Form controller). Therefore, when you create a new record for this
model, it calls the first `onchange`, which will compute display_name
for a new record (id without origin). Some `_compute_display_name` don't
handle new records correctly and raise a traceback. These models are
sometimes directly accessible:

- Accounting > Account Group > New => Traceback
- Contact > Contact Tags > New => Traceback

Other models are inaccessible by default (no view to access or create a
new record), but if someone creates a view for them with studio (or
modifies an existing one to allow creation):

- `crm.iap.lead.role`
- `crm.iap.lead.seniority`
- `chatbot.script.answer`
- `payment.token`

Change the code of `_compute_display_name` on these models to be more
defensive and avoid (potential) tracebacks. Similarly, change the
`convert_to_display_name` of `fields.Datetime` to take into account
`None` value.

closes odoo/odoo#139592

Related: odoo/enterprise#49721
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-06 11:16:31 +00:00
oco-odoo 1e0fa79719 [IMP] base: company branches: improve helper function
closes odoo/odoo#141033

X-original-commit: 5c05d8179ba757fc0b3067c8297e8636adc882e5
Related: odoo/enterprise#50190
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-11-05 00:55:47 +00:00
oco-odoo 5c38e8d9d6 [FIX] base: keep active company first in recordset when getting accessible company branches
__accessible_branches() used to call search() to get the children companies, but doing so, it returned them sorted according to res.company's _order, so (sequence, name). Because of that, a branch company with a name coming before it's parent's in alphabetical order, if they had the same sequence (which is the default), would always be returned before it by this function.

This behavior caused some issues, as it was assumed the order of the element it returned would be the same as in the company selector ; respecting the hierarchy of branches, with parent companies coming first.

This was spotted in Accounting, with the following setup:
- A company named "main", with one branch called "branch".
- "branch" has one sub-branch called "branch branch".
- Enable "main" and all its sub branches in the selector ; "main" is the active company.

Here are the issues that were found in Accounting:

1)  Click on the "new" button in the Customer Invoices' tree view. Don't change anything in the form that opens, and check the value in the company_id field of the invoice being created. It should be "main", but it's "branch" instead.

2) (when applying the fix commit on the enterprise branch related to this one)

When printing an accounting report, the route called to generate the file restores the active companies from the options' multi_company key https://github.com/odoo/enterprise/blob/16.0/account_reports/controllers/main.py#L21 . Because of that, if the report does not support multicompany, but only branches of the active company (see corresponding enterprise commit for details), if the first company in this list is one of the branches instead of the main company, the companies computed for the report will be different.

In our example, "branch" will be first in the list, so the options for the file export will be computed with "branch" as main company, enabling only its branches that are selected in self.env.companies ; so only "branch" and "branch branch" will be in the report ; which is wrong, as we also want "main".

X-original-commit: b0d716a0e618ddc78d6ca80b5bc7b796ed27905a
Part-of: odoo/odoo#141033
2023-11-05 00:55:47 +00:00
Odoo Translation Bot 5d2bc9e9b3 [I18N] Update translation terms from Transifex 2023-11-05 00:21:55 +01:00