Commit Graph
167709 Commits
Author SHA1 Message Date
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
Joseph Caburnay 6179637add [FIX] point_of_sale: properly save pos.config x2many modifications
When removing an item in x2many fields from the res.config.settings form, the
client interprets it as a set of link commands for the remaining items, as a
result, the items that should have been removed are not removed.

This generalizes the fix made for the splash screen images in pos_self_order by
which this issue was first observed.

The test is also moved to the point_of_sale module as it is not specific to
pos_self_order. Also note that the test is manually doing what is observed from
the client.

closes odoo/odoo#143165

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2023-11-22 18:12:40 +00:00
mano-odoo d62662effc [FIX] web: model_field_selector header and contrast
In commit b47be9f254b2f7327ea3e0e92c6b1b97bff016d0 we changed the
background of the popover selector making the title unreadable in
white mode.

This commit applies the text-dark color to make sure the title is
readable. It also removes the primary background on hover behind the
btns to use a color change instead. We will later on improve this
component with the btn-link + contextual class to manage the hover
effect in another task.

When a field is selected the active class is added on the parent <li>
rather than the <button>. This commit applies it on the button to
display an active state on the selected element.

task-3577065

closes odoo/odoo#143164

X-original-commit: 3d664d6e7daedecc5e995636bfe055c9ba800bb2
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-11-22 16:04:06 +00:00
Julien Van Roy 58479e5eab [FIX] account_edi_ubl_cii: standardise code Factur-X/UBL
After this fix, UBL now uses the same helper as Factur-X for the import
of the product. Also clean some dead code in UBL.

task-3559040

closes odoo/odoo#143160

X-original-commit: 59f2736023d6065522c4e89deebfa580fda0afd8
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Julien Van Roy (juvr) <juvr@odoo.com>
2023-11-22 13:24:51 +00:00
Abderraouf Ghrissi (abgh) e8824a3a55 [FIX] project_timesheet_holidays: adapt post_init domain
Description of the bug:
task field is displayed in leave type form when company field is False

Steps to reproduce:
- install time off app
- open a leave type form

Source:
When installling time off app,
_compute_{timesheet_project_id, timesheet_task_id, timesheet_generate}
work perfectly, when company = False => project/task = False
and timesheet_generate = True
Then, the post_init is executed. it will set the project and task
according to env.company when company is False. so now project and
task can have values even that the leave company is False.
Then in the xml, we hide project if company is null and task if project is null,
that's why project is not displayed but not task

Solution:
- In post_init method, we only get leaves types with a company set
and stop using env.company to be coherent with the compute methods.

closes odoo/odoo#143016

X-original-commit: e647374
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-11-22 13:24:50 +00:00
Andrea 8c7d968e1f [IMP] l10n_es: add 35% IRPF tax
Add IRPF taxes to Spain 35% and 19%

closes odoo/odoo#142927

X-original-commit: 049965ae1eed5e8d9727938cd91ba2a6bb7c140b
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-11-22 13:24:49 +00:00
snd 8720eec2c9 [FIX] stock_picking_batch: add unreserve action
Added a contextual action 'Unreserve' on batch pickings.

closes odoo/odoo#142556

Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-11-22 13:24:48 +00:00
Flotchet 8de77a3fb4 [FIX] hr: traceback when archiving employee
Step to reproduce the bug:
-Go to the employee app
-Go to an employee form view
-Click on the archive button
-Put a description
-Click on the archive button
-> Odoo error

Bug explaination:
The tracking is not implemented for the html field, so when we archive
an employee the tracking cannot work.

Expected behavior:
The employee is archived and the tracking is done without errors.

Bug resolution:
The tracking has been removed from the html field.
The tracking is now replaced by a message in the chatter
in the write method.

Behavior after this commit:
The employee is archived and the tracking is done without errors
with a mesage in the chatter if a value is entered for the
departure_description field has a value.

task-3576659

closes odoo/odoo#140527

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2023-11-22 13:24:47 +00:00
vifo f0fab284df [FIX] iot: check the URL before lauch the ws client
Add a condition that check if the DB is connected to the iot box before
the start of the websocket client, before, if no DB was connected the
Thread was lauched for nothing

closes odoo/odoo#143132

Signed-off-by: Yaroslav Soroko (yaso) <yaso@odoo.com>
2023-11-22 11:44:51 +00:00
william-andre 22a769aca0 [FIX] account: relax tax scope constraint for tax groups
* Create a tax of type `group` and with a `tax_scope` set
* Add a child tax without `tax_scope` set

This will raise an error because the `tax_scope` is not exactly the same
since it doesn't have a value.
We should be able to share sub taxes without a scope, exactly like for
`type_tax_use`. This is also what the message suggests.

closes odoo/odoo#143089

X-original-commit: 6101b2bbeaf996d4c3472ad36d740243bb0a5aa8
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-11-22 11:44:50 +00:00
David (dafr) 67260ed60e [FIX] purchase_stock: compute amount_currency from balance for valuation lines
Previously, 'amount_currency' was calculated using data from the purchase line. However, numerous variables could interfere with the accurate computation of 'purchase_price_unit' (e.g., taxes, taxes without account, standard costing method, kit product, and potentially more).

This commit revises the approach by utilizing the pre-calculated value and converting it to the desired currency. This maintains coherence between the balance and 'amount_currency' without necessitating the recreation of a function like '_get_price_unit()' in 'purchase_stock.'

## Reproduce Errors ##

### Tax Included in price without Account:
- Create a currency, CTest, with a conversion factor of 10 (10 CTest = 1 USD).
- Define a new tax:
  ° No accounts in repartition lines
  ° Rate: 15%
  ° Included in the price
- Create a Purchase Order:
  ° 1 unit | 100 CTest | Tax applied
- Receive the product.
-> SVL value is 10 USD, because tax without account increments the stock value. Refer to 'test_valuation_multicurrency_with_tax'.
-> Check SVL journal entry: credit / debit is 10, but amount currency is 86.96 CTest instead of 100 CTest.

### Reproduce With Kit:
- Create a currency, CTest, with a conversion factor of 10 (10 CTest = 1 USD).
- Create a Kit (storable, fifo), with 5 unit of CPM (storable fifo) in it's BoM
- Create a Purchase Order:
  ° Kit: 1 unit | 100 CTest
- Receive product
-> Check SVL journal entry: credit / debit is 10, but amount currency is 500 CTest instead of 100 CTest.

OPW-3453703

closes odoo/odoo#143033

X-original-commit: 5ea188fb65507d4bd06ab3361241d121ac2a468b
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
2023-11-22 11:44:48 +00:00
Sébastien Theys 544e094384 [IMP] mail: improve existing populate, add mail.notification
- add populate for mail.notification
- add batch processing and logging for a more pleasant waiting
- adapt existing numbers to find a better balance between usefulness of
  data and waiting time

closes odoo/odoo#142734

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-11-22 11:44:46 +00:00
Sébastien Theys c7b53b8f68 [FIX] mail: batch _inverse_notification_type
This makes the "medium" populate of `res.users` take few seconds rather
than 2min30 on my machine.

The issue was that `write` (not in batch) is calling
`_subscribe_users_automatically` not in batch, which is particularly
slow.

`discuss_channel_nosubscribe` is removed because it was uneffective. The
condition was only on create, but the group change in
`_inverse_notification_type` was systematically triggering the
auto-subscribe outside of create anyway, which is what we want.

Part-of: odoo/odoo#142734
2023-11-22 11:44:46 +00:00
Pierre Masereel 84764e62f5 [REV] point_of_sale, pos_discount: move discount data to pos_discount
This reverts commit 430f4904ed.

This should not be done in stable, for 3 reasons:
1: There is no migration scripts, so every people that will migrate from previous version will have a second product discount created in their DB
2: Existing DB that will activate discount will have 2 products discounts
3: It breaks an industry module that depends of this data

For those reasons, I'll revert this commit before it is deployed next week.

To correctly do your changes, you just need to do it in master and create a migration script that will rename the xml_id.

closes odoo/odoo#143104

Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
2023-11-22 10:23:50 +00:00
dhba-odoo dc43b1fd01 [FIX] web_editor: format and style are lost when copy content
Before this commit:

Format and style are lost when copying content that has some style or format
applied on it.

After this commit:

Now, able to copy content with its format and style.

Task-3263360

closes odoo/odoo#142984

X-original-commit: 8083b990845eeb5b1fa6aaaa21617f16d4d5a780
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-11-22 10:23:48 +00:00
JF Aubert 4be8cac644 [FIX] mrp: fix _split_productions set_consumed_qty
Since https://github.com/odoo/odoo/commit/7dda6bb92715ea25b2818a62fec5e646f3678b81
_split_productions do not consume quantities anymore.
For example, mass producing a serial finished product built from components
moves the finished products but not the components.
This restores the expected behavior.

closes odoo/odoo#142895

Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2023-11-22 10:23:46 +00:00
Florian Charlier 35c9267790 [FIX] gamification, website_(slides,forum): ensure Marc Demo has karma
Without it, like in no-demo testing conditions, tests with rights
depending on Karma fail.

Task-3575692

closes odoo/odoo#142785

X-original-commit: c1ca12f4bf090761fc8c63eafc70ac47ae6851fe
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-11-22 10:23:44 +00:00
Abdelouahab (abla) 126e5a8354 [FIX] point_of_sale: receipt web print
To reproduce
============
on POS (without having a connected print), make an order and print the
receipt, the preview will show the receipt not well rendered

Problem
=======
we add the element that contains the receipt to the page, so we have
two copies of the receipt (the page using CSS `@media print` and the added
element)

Solution
========
hide the original element on the page while printing, and bring it back
after

opw-3596341

closes odoo/odoo#142699

Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
2023-11-22 10:23:43 +00:00
Jeremy Kersten d5c8abfd12 [FIX] survey: avoid traceback if you don't have finish the survey
If you have a survey of several pages, but don't valid all, you don't
have any survey_input_line for some question, so the [0] will crash.

Since the method wait only one input_line maximum, instead to force to
take the first one withtout take care if no reply, we just use the
browser record that will work in both case. If it is empty it will enter
in the 4th case, 'skipped' what is expected and was dead code before.

closes odoo/odoo#142500

X-original-commit: 02f49b726a40dc97f065ca40225411a208d65302
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-11-22 10:23:42 +00:00
Juan Jose Scarafia bf259290b7 [ADD] l10n_ar_withholding: new withholding module
withholdings is a legal requirement for many companies in AR that are withholding agents,
      where the company is meant to compute, create and share the Vendor WTHs (in this case the WTH
      is not electronic, but a PDF report with the details of the WTHs created need to be
      shared with the Vendor)

Task :
   latam 690
   adhoc 27675

closes odoo/odoo#140607

Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-11-22 10:23:41 +00:00
miad-odoo a697d7cf3d [FIX] event: fix foldable badges layout
Before the commit, there was a small issue where a foldable badge would be
slightly smaller in height than A4 paper.

This commit fixes this by giving foldable badges more height.

Task-3389338

closes odoo/odoo#143079

X-original-commit: 0bca59b43bb195f8fc5feef315c7694eba6df326
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-11-22 08:55:51 +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
Gabriel de Paula Felix (gdpf) bc21c5421c [FIX] microsoft_calendar: remove restriction changing organizer and remove useless call
Before this commit, when changing the event organizer to a new one, if the new organizer was not synced with Odoo a ValidationError was being thrown requesting that the new organizer must be added as attendee when it shouldn't (since the new organizer is not synced with Outlook). Additionaly, there was an extra call being made to the method `_is_microsoft_calendar_valid()` in the user synchronization checking which should be removed.

After this commit, this restriction is removed: the new organizer won't need to be added as attendee during this change of event organizers and the extra call to `_is_microsoft_calendar_valid()` is removed.

Issue from: 3450045

closes odoo/odoo#142989

X-original-commit: 79ec916580452a49147600441eb8d09a98322665
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-11-22 08:55:47 +00:00
Gabriel de Paula Felix (gdpf) 94e9138a1b [FIX] microsoft_calendar: outdated sync token error fetching events
Before this commit, when Odoo faced an internal error and lost the current synchronization token with Microsoft, after fetching events from Graph API an `410 Gone` was being thrown carrying the `SyncStateNotFound` code.
Since we didn't handle this error code, we were experiencing a traceback after the request:
```
2023-11-15 09:16:15,046 4 ERROR report-one-16-0-staging-1-10315840 odoo.addons.microsoft_account.models.microsoft_service: Bad microsoft request : b'{"error":{"code":"SyncStateNotFound","message":"The sync state generation is not found; generation=25;[highest=28][28][26][27]."}}' !
Traceback (most recent call last):
  File "/home/odoo/src/odoo/addons/microsoft_account/models/microsoft_service.py", line 154, in _do_request
    res.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 410 Client Error: Gone for url: https://graph.microsoft.com/v1.0/me/calendarView/delta?%24deltatoken=MOCK_TOKEN_HERE
2023-11-15 09:16:15,051 4 ERROR report-one-16-0-staging-1-10315840 odoo.http: Exception during request handling.
Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 2003, in __call__
    response = request._serve_db()
  File "/home/odoo/src/odoo/odoo/http.py", line 1589, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/home/odoo/src/odoo/odoo/http.py", line 1616, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/home/odoo/src/odoo/odoo/http.py", line 1820, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/home/odoo/src/odoo/addons/website/models/ir_http.py", line 237, in _dispatch
    response = super()._dispatch(endpoint)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 697, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/controllers/main.py", line 55, in sync_data
    need_refresh = request.env.user.sudo().with_context(sync_context)._sync_microsoft_calendar()
  File "/home/odoo/src/odoo/addons/microsoft_calendar/models/res_users.py", line 99, in _sync_microsoft_calendar
    events, next_sync_token = calendar_service.get_events(self.microsoft_calendar_sync_token, token=token)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 20, in wrapped
    return func(self, *args, **kwargs)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 152, in get_events
    events, next_sync_token = self._get_events_delta(sync_token=sync_token, token=token, timeout=timeout)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 20, in wrapped
    return func(self, *args, **kwargs)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 111, in _get_events_delta
    raise e
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 105, in _get_events_delta
    events, next_sync_token = self._get_events_from_paginated_url(
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 20, in wrapped
    return func(self, *args, **kwargs)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/utils/microsoft_calendar.py", line 76, in _get_events_from_paginated_url
_, data, _ = self.microsoft_service._do_request(
  File "/home/odoo/src/odoo/addons/microsoft_account/models/microsoft_service.py", line 173, in _do_request
    raise error
  File "/home/odoo/src/odoo/addons/microsoft_account/models/microsoft_service.py", line 154, in _do_request
    res.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 410 Client Error: Gone for url: https://graph.microsoft.com/v1.0/me/calendarView/delta?%24deltatoken=MOCK_TOKEN_HERE
```

After this commit, everytime we receive the `SyncStateNotFound` code from Microsoft, we will trigger the full synchronization with Graph API. This way, the outdated token will be replaced with a brand new token. A function which checks if the full sync is required was added in order to be mocked by the new unit test, since it is necessary mocking its return value for testing if a given `HTTPError` with the 'SyncStateNotFound' error code will call the all events fetching.

closes odoo/odoo#142982

Task-id: 3597211
X-original-commit: 54ae2f2b469e3bd5294386b882e57d7519dc044a
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-11-22 08:55:46 +00:00
alsh-odoo 12b921f4c9 [FIX] hr_homeworking: give valid domain format to search records in hr work location
This traceback arises when the user tries to delete 'Work Locations'.

To reproduce this issue:

1) Install 'hr_homeworking'
2) Open 'Employees/Configuration/Work Locations'
3) Try to delete multiple record

Error:- 'ValueError: too many values to unpack (expected 3)'

An invalid domain format is used when searching for the record in
'hr.employee.location'.
See:

https://github.com/odoo/odoo/blob/def16f3725f8005874a18eb28b171523af1a0ecf/addons/hr_homeworking/models/hr_work_location.py#L17

sentry-4644429734

closes odoo/odoo#142866

Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
2023-11-22 08:55:43 +00:00
Wolfgang Taferner 039407cf29 [FIX] delivery: avoid endless loop
- Have a delivery order sent to a shipper and done
- Return this delivery order completely (without a shipper, might not be important)
- Return of the return to resend to the customer (with a shipper and therefore a tracking number)

This will lead to a endless loop as the move_origin_ids say so (might be a bug or not)

Anyway, we make sure that the logic makes sure that we do not process twice the same stock move.

closes odoo/odoo#143076

X-original-commit: 73b41f5fa403f2737302441ce0039ee138a408c0
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Wolfgang Taferner <w.taferner@wtioit.at>
2023-11-22 07:43:12 +00:00
Mattis Megevand (mmeg) 90cd47424a [FIX] l10n_eg_edi_eta: division by zero during computation exchange rate
Steps to reproduce:
- Install modules: 'account_accountant', 'l10n_eg', 'l10n_eg_edi_eta'.
- Switch company to "EG Company".
- Configure "Large Cabinet Accounting" with ETA item code "10001138" and set Customer Taxes to "VAT 14%".
- In "Journal Customer Invoices", disable "Factur-X (FR)" under Advanced Settings -> Electronic invoicing. Also, set Branch to "Deco Addict", ETA Activity Code to "Accounting, auditing, bookkeeping and tax advice activities", and ETA Branch ID to 0.
- Update "Deco Addict" with Tax ID "204899053" and set building number to 2.
- Update "Azure Interior" with Tax ID "204899052" and set building number to 2.
- In Accounting -> Configuration -> Thumb Drive, create a new record using "EG Company" with 123 as both the ETA USB Pin and Access Token.
- Manually set the certificate in the Thumb Drive record.
- Create a new Customer Invoice with Customer set to "Azure Interior", Invoice Date as today, add a line item "Large Cabinet", set the Price to 0, remove "0% taxes" and add "VAT 14%", and set Journal to "Customer invoices in EUR".
- Confirm the invoice and attempt to "Sign Invoice".

Issue:
A traceback occurs with a divide by zero error in the invoice calculation when different currencies are involved.

Solution:
Refined _l10n_eg_edi_exchange_currency_rate function to calculate the currency exchange rate. Now, it ensures the division by amount_currency only occurs when it's not zero, preventing divide by zero errors during currency conversion in invoices.

opw-3580529

closes odoo/odoo#143064

X-original-commit: 14af8243188b86a0d654298feca6dc0980cbebeb
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-11-22 07:43:11 +00:00
Maximilien (malb) 34453bafc8 [FIX] account: report description
Before this commit, when creating a move with a product having no label. The
label will be automatically fill with "Bacon Burger" in the report.
By adding a condition on the span, the span will be empty if the label is empty
and can still be modified in studio if needed.

closes odoo/odoo#143050

Task: 3604617
X-original-commit: c0ddba176e9837ed1808b772237dff51c99a430d
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
2023-11-22 07:43:10 +00:00
Aaron Bohy c9e3866b5f [FIX] web: fix SelectCreateDialog test failing randomly
Before this commit, the modified test sometimes failed on runbot
because it couldn't click on "Create and edit..." in the many2one
dropdown. Here's what happened:
 1) call editInput to write something in the many2one input
 2) call selectDropdownItem to select "Create and edit..."
This was done without mocking setTimeout.

The problem is that editInput triggers the opening of the dropdown,
but as setTimeout wasn't mocked, that opening was delayed. Then,
selectDropdownItem first clicked on the input to open the dropdown,
and then clicked on the requested item. It might happen that the
click on the input actually closed the dropdown instead of opening
it, if it had been already opened via editInput. In that case, the
test failed because it couldn't click later on on "Create and edit".

This commit also improves the test utils to better log what really
happens: in this case, the dropdown isn't open at all, so we
detect that specific issue and log it with a proper message (which
is different than "the dropdown is open, but I can find the item
you're looking found).

Runbot issue 28207

closes odoo/odoo#143044

X-original-commit: 220d4325866330235ceccd61b8d1d00d8c919ba8
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-22 07:43:10 +00:00
Mahdi Cheikh Rouhou (macr) d3b92f1dc6 [FIX] l10n_ar_website_sale: process checkout using public user l10n_ar
Issue:
======
When using l10n_ar company , the public user (without sign in) will have
an access error on the address page when clicking on process checkout
from the website.

Steps to reproduce the issue:
=============================
- Install ecommerce + l10n_ar
- Go to website without signing in and add any product to cart and
  process checkout

Origin of the issue:
====================
Public user doesn't have the right to read
`l10n_ar.afip.responsibility.type` and `l10n_latam.identification.type`

opw-3591440

closes odoo/odoo#142997

X-original-commit: ed020ce2942c8fb2ef43ea44bd3768fcc14cb45f
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
2023-11-22 07:43:08 +00:00
Mahdi Cheikh Rouhou (macr) 6ae9c9c2f1 [FIX] website_sale: show pickup locations if case of 1 shipping method
Issue:
======
When we have 1 delivery method enabled that have pickup locations, it
will be selected by default and the pickup locations will never be
displayed.

Steps to reproduce the issue:
=============================
- Set up pickup locations carried for sendcloud (like mondial relay)
- Go through the website with just that shipping method available and
  add a product to cart valid with the configuration of sendcloud.
- Go to checkoutout you will get the shipping method selected but no
  pick up options

Origin of the issue:
====================
If the delivery method is already selected it will skip showing pickup
locations.

Solutions:
==========
Now there is another check to make sure that it will be skipped only
when the pick up locations are displayed.

opw-3569497

closes odoo/odoo#142958

X-original-commit: 7beb8767cd82f2938ffbb53ec496e1f817af8730
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
2023-11-22 07:43:07 +00:00
Thomas Lefebvre (thle) a173763331 [FIX] website_sale: use o_dynamic_empty for snippet
Steps to reproduce:
-------------------
- add an alternative product B for a product A;
- go to product A page on ecommerce;

Issue:
------
The alternative product B is not displayed below
the product A.

Solution:
---------
Use the `o_dynamic_empty` instead of `d-none` to manage
display of the snippet.

opw-3568699

closes odoo/odoo#143032

X-original-commit: a90cf72bed889424eceef4643c53434d1ab3bf51
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-11-22 06:28:41 +00:00
Nicolas Viseur (vin) 5c4868e126 [IMP] l10n_jp: tax group name update
Update the japanese tax group template names to
better fit the needs.

Task id #3315696

closes odoo/odoo#143091

X-original-commit: 580495a53cf61bd57c609856b48772c6b5c9fe25
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2023-11-22 03:24:33 +00:00
Walid 650a47ab5a [FIX] stock: picking type russian transtlation
Steps to reproduce:
- New DB
- Switch to russian
- Install stock app

Bug:
throw back is raised when setting up the data caused by a duplicate
operation type (Sequence Packing/Picking)

Fix:
apply the correct translation

note:
manual PR created since there's no russian translation on transifex
after 16.0

opw-3589539

closes odoo/odoo#143007

X-original-commit: 1486a08fd18fceba8c632141511354e9610f6dcc
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2023-11-22 00:46:24 +00:00
Mathieu Walravens c49ac84fb8 [FIX] stock_account: valuation change has always positive value
Steps to reproduce:
1. Create a new product with a cost of 10 (std, manual)
2. Create an inventory adjustment to set the quantity to -3
3. Change the product's category to real-time

Now the valuation for this product is -30€ but the accounting part
has 30€, creating a difference of 60€.

Before this commit:
Changing the valuation to real-time while having a negative
quantity/value gives a positive value in accounting.

After this commit:
Changing the valuation to real-time while having a negative
quantity/value gives a negative value in accounting.

opw-3390692

closes odoo/odoo#143000

X-original-commit: 9a0e620d2fa1d5e55d73bc4920f26ef2ba82ce9d
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
2023-11-22 00:46:23 +00:00
guva-odoo 453fe870c1 [IMP] account: add test
Test for 0c19497a482efe39a2c7778df4735ba548a847b4
Use case already covered since 16.0 but test was missing

opw-3600605

closes odoo/odoo#142986

X-original-commit: d9505dacffc045a24d77da75e8d3956703e0fbf3
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
2023-11-22 00:46:23 +00:00
qsm-odoo 2c3f0ead11 [FIX] web_editor: consider Odoo icons properly (as fa icons)
The editor has specific behaviors when it comes to icons. For instance,
marking them as `contenteditable="false"` so no text can end up into
their container element. Those behaviors were only enabled for fa icons,
this commit enables them for the new Odoo icons introduced at [1].

[1]: https://github.com/odoo/odoo/commit/546477dafab327d9990a5176bed4a9c2565eef74

closes odoo/odoo#142985

X-original-commit: 4e33b5e4956da53558b0a36ae2e6da13220290ab
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-22 00:46:22 +00:00
Sébastien Theys b316f9fc9a [FIX] mail: can open messaging menu if messaging is not initialized
closes odoo/odoo#142970

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-11-22 00:46:21 +00:00
Abdelouahab (abla) bab80a4cae [FIX] spreadsheet_dashboard_sale : Revenue must be in company's currency
To Reproduce
============
- enable a currency and make it for example = 0.01$
- create pricelist for that currency
- make sale order with that pricelist (let's say 1000 = 10$)
- on dashboards the Revenue will be 1 000$

Problem
========
on spreadsheet we use the field `amount_untaxed` from `sale.order`, which
contains the amount in the currency of the sale order and not the company.

Solution
========
as `sale.oder` module doesn't have any field containing the converted amount,
we will use the field `price_subtotal` from `sale.report`

opw-3527802

closes odoo/odoo#142930

X-original-commit: 99a6389905785ab7cb3a1b2b0d546170caaa28c9
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
2023-11-22 00:46:19 +00:00
Benjamin Hanquin (beha) aa5bf860bd [FIX] hr_referral: Fix referral module install
Issue:
The hr_referral application can not be installed with demo data.

Analyze:
The db is being auto locked. And transaction is not rollback due to the
xml failure.

Fix:
Add corresponding line into hr_demo.xml instead of hr_referral_demo.xml

Note:
It does not fix the root cause, but until the root cause is well defined
and fix, it is the best workaround.

Related ticket:
opw-3547638

Affected version:
16.0 and above

closes odoo/odoo#142928

X-original-commit: 436772ff0af5ae21043e4c0d60761c4f4149f7e7
Related: odoo/enterprise#51163
Signed-off-by: Benjamin Hanquin (beha) <beha@odoo.com>
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-11-22 00:46:17 +00:00
Claire Bretton (clbr) 0ab0ac683e [FIX] account: Fix error when installing localization demo data with Invoicing only
Steps to reproduce:
1. Create a database in demo mode with only Invoicing installed
2. Create a new company
3. Set any accounting localization package in Settings
4. Traceback because User doesn't have access rights on account.bank.statement

closes odoo/odoo#142915

Task-id: 3584244
X-original-commit: 7dd7fc9012a0738089c89a507dcd893e0ffdc09a
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
2023-11-22 00:46:16 +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
FrancoisGe d0b7736fa5 [FIX] web: fix profiling to show stats again
Since the refactoring to owl, the stats in the left zone were not shown
anymore and the hover was missing.

This was because the method that fixes the xpath to match line by line
the qweb, was done on a getter and not on the data itself.

Now we replace in the prop value, from this way, in every place we use
the getter, we have fixed the data with the xpath.

/t/div -> /t[1]/div[1]

closes odoo/odoo#142912

X-original-commit: 2124057052255d86591b9f3345bf7e62fcd8d3b3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-11-21 23:24:03 +00:00
Aaron Bohy 5bd6dcd944 [FIX] web: tests: fix SwitchCompanyMenu tests failing randomly
Before this commit, some tests of the SwitchCompanyMenu sometimes
failed:
   - "companies can be logged in even if some toggled within delay"
   - "can toggle multiple companies at once"

They failed because the debounce delay between the first click to
toggle a company and the moment the company service is notified to
actually select the companies was sometimes too short for the 2 or
3 clicks on the menu to toggle companies to occur, as those clicks
are separated by nextTick(), i.e. a mix of calls to setTimeout and
requestAnimationFrame.

In tests, we patch the debounce delay to 0 by default, and before
this commit we set a delay of 50 in the two faulty tests. This
commit fixes the issue by keeping the real delay in those tests (1s),
as they aim at testing the fact that the user has the time to do
multiple clicks before committing the company changes and reloading.

Fixes runbot error 29962

closes odoo/odoo#142904

X-original-commit: 2ec65691ac11cb4216d873dcab77a84e2c35ba17
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-21 23:24:00 +00:00
Florian Damhaut d099d8c5ae [FIX] sale_timesheet: onchange for product uom change po_uom
po_uom_id and uom_id should be from similar uom_group. It
was not the case by default using `'default_detailed_type': 'service'`.
This fix the issue

closes odoo/odoo#142887

X-original-commit: b557cc0831e2c6d0967c3d4420c1b89a0f5ce191
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-11-21 23:23:58 +00:00
Aaron Bohy 7cea6c5980 [FIX] web: fix form test failing randomly
The test 'buttons with attr "special" in dialog close the dialog'
sometimes fail on runbot because it can't click on 'Create and edit...'
inside the many2one dropdown. Before this commit, the test edited
the many2one as follows:
 1) edit input to write a new value (with editInput)
 2) click on the input to open the dropdown
 3) click on 'Create and edit...' in the input

But calling editInput opens the dropdown (even though the opening
is a bit debounced, which is why it only failed sometimes). So it
might happens, in rare cases, that the dropdown is already opened
when we click in the input (step 2), which closes it and makes
step 3 fail.

This commit changes the test to do something similar as what we do
in many2one_tests.js: we patch setTimeout to execute the callback
directly, and thus remove the opening delay. We call editInput
which triggers the opening of the dropdown, and we click inside
the dropdown.

Runbot issue 24739

closes odoo/odoo#142863

X-original-commit: 4a011149cba968585d5e74ee4f4fff7212c729e3
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-21 22:00:10 +00:00
FrancoisGe a24aa74602 [FIX] web: m2o field use the right context
When we save a many2one in a dialog opened by the external button, we
trigger a "read" of the "display_name" to update it if the changes made
in the dialog have had an impact on it.
Before this commit, the context used for this "read" was completely wrong,
it was an unevaluated string. This commit will therefore allow you to use
the evaluated context.

closes odoo/odoo#142862

X-original-commit: 7e9c8d41f5d035a00117198539ddebdbd8b4aa7c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-11-21 22:00:09 +00:00
FrancoisGe d71d52d16b [FIX] web: popover clickAway don't preventDefault by default
Since commit 3d218e1, clicking outside
a popover closes the popover and performs a preventDefault on the event.
As a consequence, changes made in the property definition popover are no
longer applied when the popover is closed by clicking outside.

Problem:
The preventDefault has the consequence of cancelling the input change
event allowing the change to be applied to the property definition when
the popover is closed.

Solution:
Remove the preventDefault by default and only use it in the case of the
calendar view, which is the only use case that wants to prevent the click
event so as not to open a record creation dialog (see commit 3d218e1).

How to reproduce the PropertyField bug:
- Go to a form view with a properties field
- Click on the edit property button
- A popover opens so that you can edit the field definition
- Type a few characters in the label input
- Click outside the popover

Before this commit:
    The value inserted in the popover is ignored

After this commit:
    The value inserted in the popover is applied to the property.

It is not possible to write a test reproducing this native browser behaviour.

closes odoo/odoo#142842

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-11-21 22:00:07 +00:00
Adrien Guilliams (adgu) 430f4904ed [IMP] point_of_sale, pos_discount: move discount data to pos_discount
Prior to this commit, the discount product was created at
the installation of the point_of_sale module which does not make sense
as this product is only used in the pos_discount module. We change this
in this commit to also prevent the discount product to be shown in the
frontend of the PoS when the user does not have the pos_discount module
installed and abling him to download demo data on the flight if he does
not have other products available.

closes odoo/odoo#142831

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-11-21 22:00:05 +00:00
Loan (LSE) bb7bbb80ac [FIX] setup: logline config saved in OS environment config file
To reproduce:
 1. on your windows computer, add a system environment variable with:
  - Key: ODOO_RC
  - Value: (path to any file except the `$INSTDIR\server\odoo.log`)
 2. Install Odoo Windows version
 Notice that the log are stored into the `$INSTDIR\server\odoo.log` file
 3. Restart Odoo's service
=> Odoo's log file does not log anything anymore

Cause:
As odoo will use in priority the environment variable as the config file path.
This will save the config change into that file instead of the intended one at
`$INSTDIR\server\odoo.conf`.
Due to this, the config file remain the default one created by the previous commands
but the log_file information get save to the wrong config file.
On restart of the service, as the parameter is not present,
it does not log in the intended way

After this commit:
 Logs are logged into the log file as intended

Was discovered accidentally while reviewing an IoT PR:
https://github.com/odoo/odoo/pull/137547

closes odoo/odoo#142796

X-original-commit: bbd06814a7e42c22206087c0df1e06d14dbba74e
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Loan Sens (lse) <lse@odoo.com>
2023-11-21 20:06:49 +00:00