Commit Graph
167551 Commits
Author SHA1 Message Date
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
tsm-odoo c9b72f09d8 [FIX] bus: fix im status not updating
Odoo periodically updates the user online status. This is
done every minute and is throttled in order to ensure it won't
be triggered more than it should.

Since [1], the underscore `throttle` function has been replaced
by the `throttleForAnimation` function. This is not equivalent:
the function won't be triggered if there is no animation which
result in an outdated user status.

This issue was highlighted by the live chat: the button does
not show up when there is no available operator.

Steps to reproduce the issue:
- Log in on Odoo with live chat installed
- Go to a web page that uses the live chat widget
- Wait more that one minute and refresh the page
- The live chat button is not shown anymore: the only
operator is considered as disconnected.

This PR fixes that issue by re-introducing the underscore
throttle function: it is robust and can be needed, not all
throttles are linked to animations.

[1]: https://github.com/odoo/odoo/pull/120437.

opw-3578517

closes odoo/odoo#142160

X-original-commit: f64a7cbad3dee3ffc365b931306b1c13c8bff536
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-11-15 13:56:35 +00:00
Pierre Masereel 307a2e0363 [FIX] base_import_module: no spaces in ir_model_data name
When we are importing a module and we need to create an attachment from
a file in static. We get an error if the file path of the file contains
a space.

We get this error becuase it takes the path to generate an xml id and
the name of an xml_id cannot contains spaces.

closes odoo/odoo#142113

Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
2023-11-15 12:34:24 +00:00
Florent de Labarre 0bf36e107a [FIX] mrp: add index
Before this commit in large database, the time to unlink some lot can take lot of time.

closes odoo/odoo#142105

X-original-commit: 654ee5c54db6d2cdf7a9d6797899d25a5b156059
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-15 11:26:13 +00:00
Gabriel de Paula Felix (gdpf) d9bc27b9ad [FIX] microsoft_calendar: traceback batch recurrence update in microsoft
A traceback was being thrown when multiple recurrent events were being updated by a batch microsoft update due to a `self.ensure_one()` validation:
```
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 106, in _sync_microsoft_calendar
    synced_events, synced_recurrences = self.env['calendar.event']._sync_microsoft2odoo(events) if events else (self.env['calendar.event'], self.env['calendar.recurrence'])
  File "/home/odoo/src/odoo/addons/microsoft_calendar/models/microsoft_sync.py", line 385, in _sync_microsoft2odoo
    update_events = odoo_event._update_microsoft_recurrence(mevent, microsoft_events)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/models/microsoft_sync.py", line 319, in _update_microsoft_recurrence
    odoo_event.with_context(dont_notify=True).write(dict(event_values, need_sync_m=False))
  File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 401, in write
    return write.origin(self, vals, **kw)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/models/calendar.py", line 180, in write
    self._recreate_event_different_organizer(values, sender_user)
  File "/home/odoo/src/odoo/addons/microsoft_calendar/models/calendar.py", line 203, in _recreate_event_different_organizer
    self.ensure_one()
  File "/home/odoo/src/odoo/odoo/models.py", line 5161, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: calendar.event()
```

After this commit, this traceback is now fixed because the validation iterates over each event, avoiding the batch conflict with the `self.ensure_one()` function and skipping the validation of recurring events since these updates are exclusively on the Microsoft side, which does not allow changing the organizer.

Issue from: 3450045

closes odoo/odoo#142099

X-original-commit: 7c064a1
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Gabriel de Paula Felix (gdpf) <gdpf@odoo.com>
2023-11-15 11:26:12 +00:00
roen-odoo 6ed92b6660 [FIX] point_of_sale: correctly print daily sales report
Current behavior:
When you link a printer to the sales detail report. The report will
contains no order. This happens because we are trying to assign docids
to the session_id.

Fix:
Docids represent the session_id only when the report is called from the
PoS directly. So we want to use it only when it's the only data passed
to `_get_report_values`. If session_id is not set in the data, but other
values are (date_start/stop, config_id) we should use those value in
priority.
When called from the frontend directly, docids doesn't represent a
session_id.

Steps to reproduce:
-Install pos_iot
-Link a printer from the demo iot to the sales_detail report (go in
 settings > reporting > reports)
-Do some orders on the PoS, and close it
-Go in the backend, and print the sales detail report
-You will see that the report is empty (You can put a breakpoint in
 get_sale_details method to see that it will be empty)

opw-3247196

closes odoo/odoo#142093

X-original-commit: d93ffa4c770364c31b2a2e0ad855bf8801f23c24
Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
2023-11-15 11:26:11 +00:00
Damien Decleire (deda) 3a61cefddc [IMP] partner_autocomplete: Integration of Indian GST Numbers
Until now, only Eyropean tax numbers were taken into account.
Now, Indian numbers are also considered valid and sent to IAP
for link creation.

This commit takes advantage of IAP changes, which now integrates
the Indian GST tax number system.

closes odoo/odoo#142082

X-original-commit: 1a1b9b27efda49fce6a61c0aeb8deb60e040771e
Signed-off-by: Louis Baudoux (lba) <lba@odoo.com>
Signed-off-by: Damien Decleire (deda) <deda@odoo.com>
2023-11-15 11:26:10 +00:00
Kevin Baptiste 150099e5f6 [FIX] hr_recruitment: don't use iap widget when not installed
The recruitment settings were using the iap_buy_more_credits widget,
even tho there is no hard dependency between IAP and Recruitment. Which
was causing a traceback when IAP was not installed.

The widget has been moved to the enterprise module
`hr_recruitment_extract`.

Closes #114747

closes odoo/odoo#142073

X-original-commit: 12f0730d75c2d3316fd7dc06f33a17d9b6ffd963
Related: odoo/enterprise#50658
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2023-11-15 11:26:10 +00:00
tsm-odoo f5e0ca51de [FIX] mail: fix dropzone background for live chat
Before this PR, the dropzone background was not showing on
the embed live chat. The dropzone is displayed as a `main
component`. In the Odoo frontend, the main component container
is displayed outside of the live chat shadow dom, where the
`bg-view` class is not available. This commit replaces this
class by the `bg-100` one that is almost the same and available
in the frontend.

task-3595537

closes odoo/odoo#142055

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-11-15 11:26:07 +00:00
Antoine Guenet 8c136b9882 [FIX] web_editor: mini clean up of serialize
An object was defined before a conditional return statement and as a
variable rather than a constant.

closes odoo/odoo#142049

X-original-commit: d6478d9af76422eccecffb79bfd6be90cc714342
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
2023-11-15 11:26:06 +00:00
Nicolas BayetandAntoine Guenet ac4adf0521 [FIX] web_editor: allow a node to not have oid in serialize
This commit addresses a traceback that occurs when trying to serialize a
node that has no `oid` property because it was added to the DOM while
the mutation observer was not active (eg, using `observerUnactive`).
This is the case with technical nodes added for managing the selection
around links ("link zws spans").

When serializing a node, we expect it and its descendants to have an
`oid` property so we throw an error if such is not the case. But we now
have a legitimate case where nodes have no `oid` property so this
removes the error. If the `oid` was in fact really supposed to be
defined (eg, the node we tried to serialize was the direct target of a
mutation), an error will be thrown soon enough after when trying to
access said property.

Note that other, more ad-hoc fixes specific to the link zws spans would
have been possible (and might still be useful in the future), such as:
- skipping said link zws spans when serializing
- adding a fake `oid` property to the link zws spans

task-3593081

X-original-commit: ba6a7fa4cf5ad422816e49b4d3b941297841ed3f
Part-of: odoo/odoo#142049
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2023-11-15 11:26:06 +00:00
JF Aubert 45825263a4 [FIX] mrp: avoid mo overview traceback
Opening the Overview of manufacturing orders containing work orders
without expected duration gives a division by zero.

closes odoo/odoo#141944

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-15 11:26:03 +00:00
Walid b7eaf02706 [FIX] stock: propagate package in multistep delivery
Steps to reproduce:
- Enable 3 step delivery (pick,pack,ship) in inventory settings
- Create and confirm an SO with a consumable product
- Put the first transfer (PICK) in pack
(check show detailed operation will make it easier to see the bug)
- Result package is correctly set and will be correctly set as source
package for the following transfer (PACK)

Bug:
result package is not set on the following transfers

Fix:
propagate the package by default (if it's disposable) since consumable
product do not have a stock.quant _check_move_lines_map_quant_package
will fail and package_level will not be created and result will not be
assigned

opw-3513870

closes odoo/odoo#141914

X-original-commit: 83996db3adaf44f5d4428d602071224095cd4790
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2023-11-15 11:26:02 +00:00
svs-odoo 5c199e60eb [FIX] repair: minor bugfixes
This commit fixes the following issues:

1. Before this commit, when adding a new move in a repair order, its
   default quantity was equal to the repair order's product quantity.
   The move's quantity should be 1 by default;

2. The `forecast_availability` is renamed from "Reserved" to
   "Forecasted";

3. Removes the "Clear Quantities" button since it does basically the
   same thing than the "Unreserve" button.

closes odoo/odoo#141849

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-15 11:26:01 +00:00
JF Aubert 13cb47d4f2 [FIX] stock_picking_batch: forward package
For multi steps batch pickings, the package is not forwarded
like it is for 'simple' pickings.

closes odoo/odoo#141822

Related: odoo/enterprise#50532
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-15 11:26:00 +00:00
anjeel.haria 14b2f0f0f7 [FIX] website_event: Add timezone in events website snippets
Added timezone for event_card snippet

closes odoo/odoo#141810

X-original-commit: fc4c4a272c55e45bcdbfaba4786f6afec963ac52
Signed-off-by: Jérémy Hennecart (jeh) <jeh@odoo.com>
2023-11-15 11:25:58 +00:00
anjeel.haria ffe75e09f7 [FIX] website_sale: make 'Quantity' table header editable on /shop/cart
This commit only purpose is to propagate the CLA that was
stopped manually in the FW.

The cart is a table with 3 columns: Product / Quantity / Price
Product and Price words are editable while Quantity is not.

This PR fixes that.

Fixes https://github.com/odoo/odoo/issues/135163

X-original-commit: 03e4648b94b262508b7eceb969d91d7033e28834
Part-of: odoo/odoo#141810
2023-11-15 11:25:58 +00:00
Nasreddin Boulif (bon) 4c38507c03 [FIX] mail: don't apply system timezone on tracked date value in chatter
Steps to reproduce:

  - Add a date field in a model with `tracking=True`
  - Log with a user with timezone set to UTC+2
  - Create a record and set the date field to any date.
  - Update the date value to another date
    (Should have logged a message in the chatter with changes)
  - Log with a user with timezone set to `America/Los Angeles`
  - Check the chatter of the record created above

Issue:

  New date value displayed in the chatter is wrong (set to one day
  before).

Cause:

  The value displayed in the chatter is the date value converted first
  as datetime (with Luxon library), then the system timezone is set on
  it and therefore might change the day.

Solution:

  Use `deserializeDate` instead, who has the same computation as
  `deserializeDatetime` (with the sole difference of date vs datetime)
  and therefore will not apply a timezone on the date.

opw-3427502

closes odoo/odoo#142034

X-original-commit: ca3254f8c7700fe78053072710f0c57fee60af5b
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2023-11-15 09:07:59 +00:00
Walid 361a5835aa [FIX] stock_picking_batch, delivery: put delivered batch in pack
Steps to reproduce:
- Install DHL delivery and enable batch transfers
- Create 2 SO with adding shipping
- Select the 2 delivery orders and add them to the same batch
- Put the batch in a pack
- Only movelines of the first delivery are put in the pack

Bug:
when delivery is Installed a Delivery Package Type has to be chosen
this will in turn put the active picking mls in pack
the case of batch picking was disregarded
https://github.com/odoo/odoo/pull/55096/files#r469780148

Fix:
implementing a method to get the movelines to pack will allow to simply
make an override in stock_picking_batch instaed of creating a new module
this has also the added benefit of unifiying the behavior accross the
different methods

opw-3357423

closes odoo/odoo#141473

X-original-commit: 2d2bfe7f01379beb695b1c8756be393e17faf7de
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-14 16:35:02 +00:00
Richard deMeester 0c85d03c23 [FIX] purchase: select sellers failing on empty date
Following  #133759 - The code will fail if the purchase_order has NO
date.

This is because

max(
  po.date_order.date_order and po.date_order.date(),
  fields.Date.today()
)

will try to compare False with a date, resulting in:

closes odoo/odoo#140006

Typeerror: '>' not supported between instances of 'datetime.date' and 'bool'
X-original-commit: 0831f6d0f2763e1ca8966c9a0b6c3186a847e733
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-11-14 16:35:01 +00:00
Gabriel de Paula Felix (gdpf) 83022f1799 [FIX] microsoft_calendar: fix recurrence being trimmed
Before this commit, recurrences were being cut off after being fetched when their length exceeded the range of the current calendar view. This was because we were fetching the new events within the `get_events_delta` function, but skipping their fetch at the `_get_occurrence_details` function for occurrences outside the current calendar view range, leaving them not created when they should have been. Additionally, the last day within the weekly view was not being fetched because the API request ignored the "23:59" hour/minute information and fetched events up to the "00:00" hour/minute of the respective day.

After this commit, they are now entirely created during their search in the `_get_events_delta` function call. This solves the problem of leaving occurrences uncreated and maintains the improvement of not fetching all recurrences every time as in the previous code after the performance task. In addition, to correct the substitution of the hour/minute "00:00", a day is now being added to the end date to fix the interval obtained.

Benchmark test with 300 recurrences of 500 events each (150.000 events):
- Before the performance task: 01:02:09 (hour/min/sec)
- After this PR: 00:09:51 (hour/min/sec)

Issue from task-id: 3525764

closes odoo/odoo#142014

X-original-commit: 18b978e7a87e36b21449a7981720e4f24630b1c6
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Gabriel de Paula Felix (gdpf) <gdpf@odoo.com>
2023-11-14 15:16:10 +00:00
Antoine Vandevenne (anv) 7ec8e3454d [FIX] payment: don't suggest archiving acquirers when it's not possible
Payment acquirers don't have an `active` field, which makes users
confused when they try to delete an acquirer, and the error message
suggests archiving it instead.

opw-3579946

closes odoo/odoo#142000

X-original-commit: 69166117073f1bf255b62b81eaa744f81353f6b4
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-11-14 15:16:09 +00:00
Sébastien Theys d3b7ff500b [FIX] mail: fix race condition in load_message_order
- adapt test to ensure consistent (scroll) state at each step

The issue is hard to reproduce, so the complete resolution of the issue
is not guaranteed, but the current change should do the job, and if it
doesn't, it will help to pinpoint the issue.

Estimated issue: the thread doesn't load more messages when scrolling to
bottom because the scroll to bottom is overriden by the auto-scroll top
when clicking on pin. Adding extra wait point should solve the issue.

runbot-24512

closes odoo/odoo#141999

X-original-commit: 477b1c3aa1da7261273341338f3d37ee828715f8
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-11-14 15:16:08 +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
Paolo Gatti (pgi) a14c9f6c86 [IMP] account: Send and print, better no-email partner handling
When you open a Send and Print dialog, if the partner had no email,
then the form to edit the partne appears.
We're removing this behaviour and let the user decide if he wants
to check the partners or not

closes odoo/odoo#141549

Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-11-14 15:16:04 +00:00
Djamel Touati 1b1d2d110e [FIX] stock: fix batch transfer validation
Steps to reproduce the bug:
- Go to inventory > operation > batch Transfer > new:
    - Select 2 picking out
- Confirm
- Try to validate

Problem:
A traceback is triggered:
ValueError: Expected singleton: stock.picking(7, 2)

“self.hide_picking_type = self.state != "draft" and self.ids and
'default_picking_type_id' in self.env.context “

opw-3583908

closes odoo/odoo#141975

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-14 13:49:30 +00:00
Michael (mcm) 5094cdcc9d [FIX] purchase_stock: fix tour steps builder
Before this commit, the builder called `this._super` which is not
defined anymore by `patch` and thus caused an error.
The call to `this._super` was useless as it does not use the returned
steps so this commit simply removes the line.

Fixes #141112

closes odoo/odoo#141968

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-11-14 13:49:29 +00:00
Arnaud Joset 1e1add8014 [FIX] calendar: test_event_creation_mail was faulty
The following commit updated the test to use freezegun. One of the event start
date was not properly set before the freezegun date. As a result a notification
mail was sent.
https://github.com/odoo/odoo/commit/080688868e6acf31d3bd624798559852272bcc1a

Strangely, the test was passing during our tests even if the date was in the past.

Runbot issue: https://runbot.odoo.com/web#id=36179&view_type=form&model=runbot.build.error&menu_id=405&cids=1

closes odoo/odoo#141959

X-original-commit: f5a131931583a5d6c415742b3a65793b10e60daf
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-11-14 13:49:28 +00:00
Louis Baudoux ef8461d78b [FIX] iap: remove IAP neutralization
Since commit 550595d, it's no longer necessary to change the endpoint to
the IAP services test server.

closes odoo/odoo#141930

X-original-commit: 16a649231fcf98f2b3bae9e297ea892b9c93e3f9
Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
Signed-off-by: Louis Baudoux (lba) <lba@odoo.com>
2023-11-14 13:49:24 +00:00
Djamel Touati 8c4e775cea [FIX] stock: fix production_lot settings
For existing users who had previously disabled the "Lots & Serial
Numbers" settings, by applying this fix: https://github.com/odoo/odoo/pull/138907/commits/376ee1289eba840f1d8b2b6149d933bdedd47518

They will get the user error each time they try to access the settings.
Therefore, we prefer to prevent this and trigger the error only when
necessary.

opw-3452946

closes odoo/odoo#141921

X-original-commit: 608439b09cb68409dec10427d5b927ce0a27d526
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-11-14 13:49:21 +00:00
Djamel Touati f2ba305e23 [FIX] mrp: don't set qty_done in finished move lines
Steps to reproduce the bug:
- Create a tracked product with BoM “P1”:
    - component: add any storable product e.g “C1”
    - byproduct: add any storable product e.g “B1”
- Update the stock of C1
- Update the stock of “P1” with two SN
- use the 2 SN of P1 as component in any MO and mark the MO as done
- Create a new MO to produce 2 units of P1
- Confirm the MO
- Click on “Mass produce”
- Generate two new SN

* First error : The byproduct quantity is not set

- Try to Mark as done the new MO

Problem:
A user error is raised: 'This serial number for product P1 has already
been produced'

When splitting the MO into two, a “stock.move.line”  are created with
a qty_done = 1, leading to an error when verifying if the serial_number
of the move_finished has already been produced.

When clicking the "mark as done" button on the MO, the function
"_check_sn_uniqueness" is triggered and since the finished product is
tracked and there is a serial number set in the MO, the function
"_is_finished_sn_already_produced" is called:
https://github.com/odoo/odoo/blob/c84d80cc71ca0e7120dd293bfc56f9027bfdf9fc/addons/mrp/models/mrp_production.py#L2158-L2162

Within this function, we verify if the move lines of the finished move
have a lot and qty_done set. If this condition is met and we do not need
to exclude this move, an error is triggered.

https://github.com/odoo/odoo/blob/77ca3a830d0f61ee8a5ba31b3b79e80e85c08e79/addons/mrp/models/mrp_production.py#L2063

https://github.com/odoo/odoo/blob/77ca3a830d0f61ee8a5ba31b3b79e80e85c08e79/addons/mrp/models/mrp_production.py#L2086

Solution:
Set "qty_done" to 1 only within the move lines of the components.

Opw-3566259

closes odoo/odoo#141521

X-original-commit: e0e6aed35d0f75c3ad01fbc329d7189f9e8d82f4
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-11-14 13:49:19 +00:00
Djamel Touati cf2d37ecd3 [FIX] mrp: allow use kit as component in MO without BoM
Steps to reproduce the bug:
- Create a kit product
- Create a storable product without BoM “P1”
- Create a MO to produce one unit of “P1”
- Add the kit product as component
- confirm the MO

Problem:
The Manufacturing Order is cancelled. This is because the MO contains
a kit product, and we need to generate moves based on its Bill of
Materials. However, at the same time, we cancel and remove the move
associated with the original product, which is no longer relevant.
But We remove it before creating the moves generated from the phantom
product. Consequently, since we cancel the move, the 'compute_state'
of the MO is triggered, and as there is only one 'move_finished' status
in 'cancel,' the status of the MO is set to 'cancel:

https://github.com/odoo/odoo/blob/5c238bbb18c682ff2d25f740aad604feb7bb5bbc/addons/mrp/models/mrp_production.py#L462-L463

Opw-3548464

closes odoo/odoo#140016

X-original-commit: baa0924974fee0115a0bce117141a8096455b88d
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-11-14 13:49:18 +00:00
Nicolas Bayet 6f599655e4 [FIX] web_editor: prevent the avatar to be loaded
In some undeterministic circumstances the tests in
`test_wysiwyg_collaboration.js` tried to load an image with a wrong
url (`/web/image?model=res.users&field=avatar_128&id=undefined`). It
is `undefined` because in the testing context, `this.getSession().uid`
is `undefined`.
It is not necessary to load these images in these tests so this commit
prevents the loading of these images.

runbot-24600
task-3566600

closes odoo/odoo#139958

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
2023-11-14 13:49:18 +00:00
vava-odoo 8e69a3cc73 [FIX] website_sale_stock: fix warning message if unavailable
Before this commit, the warning to inform the user that a product has
become unavailable was the same, whether the user was on the cart or on
the product page. This commit makes sure that the message is adapted to
the context.

closes odoo/odoo#139332

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-11-14 13:49:17 +00:00
Victor Feyens bd07557b16 [FIX] website_sale: overlapping x in cart alert
Bootstrap already adds a X on btn-close buttons automatically

Part-of: odoo/odoo#139332
2023-11-14 13:49:16 +00:00
vava-odoo bfe857db1d [IMP] website_sale: display warning in notifications
When adding items to the cart, the server returns warnings that are
never displayed to the customer. This commit makes use of the new
notification system of website_sale to display it.

task-3502911

Part-of: odoo/odoo#139332
2023-11-14 13:49:16 +00:00
Anh Thao Pham (pta) ce5fc3a1f2 [FIX] l10n_it_edi_withholding: fix install with multiple IT companies
Steps to reproduce:
- Install Accounting
- Create a Company located in Italy (e.g. Company A)
- Create another company located in Italy (e.g. Company B)
- Switch to Company A and set its fiscal localization to Italy in Accounting settings
- Switch to Company B and set its fiscal localization to Italy in Accounting settings
- Try to install "Italy - E-invoicing (Withholding)" module (10n_it_edi_withholding")

=> An User Error is raised:
"Incompatible companies on records:
- 'account.tax.repartition.line,688' belongs to company 'Company B' and 'Account' (account_id: '160900 Receivables for withholdings incurred') belongs to another company.
- 'account.tax.repartition.line,690' belongs to company 'Company B' and 'Account' (account_id: '160900 Receivables for withholdings incurred') belongs to another company.
- 'account.tax.repartition.line,692' belongs to company 'Company B' and 'Account' (account_id: '260200 Payables for withholding taxes to be paid') belongs to another company.
- 'account.tax.repartition.line,694' belongs to company 'Company B' and 'Account' (account_id: '260200 Payables for withholding taxes to be paid') belongs to another company.
- 'account.tax.repartition.line,696' belongs to company 'Company B' and 'Account' (account_id: '160900 Receivables for withholdings incurred') belongs to another company."

Cause:
When installing "10n_it_edi_withholding" module, some tax data are updated
for each Italian company.
These data are "generic" (not linked to any company) data, but some treatment
is performed on them for the first Italian company, linking them to the account
ids of that company.
The following companies are then updated with data linked to the first company.

opw-3538921

closes odoo/odoo#141898

X-original-commit: 9939789fd7024d864c365fe8f3ce311b96ba652c
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
2023-11-14 12:38:30 +00:00
David Monnom (moda) bde8ac7505 [FIX] point_of_sale: proxy_ip validation error at demo data loading
The demo data of point_of_sale module was failing to load when pos_iot
module was installed due to proxy_ip validation error. In fact, the iot
module overrides this field by creating a relationship to iot_ip.
When the demo data is created in the pos, the iot does not yet exist,
so proxy_ip is empty, so it trigger the validation error.

Error validation is triggered only when proxy_ip is empty and
printer_type is set to "iot". In the point_of_sale data demos, we set
printer_type to false, which fixes the problem.

closes odoo/odoo#140457

X-original-commit: 2f1af3a39b0d61dbf7c70e4fbc6421af906854d0
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: David Monnom (moda) <moda@odoo.com>
2023-11-14 11:14:37 +00:00
Arnaud Baes eb5385b04a [FIX] website_event_track_live: Properly catch youtube_video_id
On live youtube videos, url are in reality like this:
`https://www.youtube.com/live/<video_id>` which was not properly
caught by the regex in its compute

Reported during OXP

closes odoo/odoo#141910

X-original-commit: fd348c6778138240d67aa778866cd9e4d49c5021
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-11-14 09:49:05 +00:00
Pierre-Yves Dufays 239ea215da [FIX] test_mail: fix activity test failing randomly
Each failing of the test "activity menu widget: activity menu with 2 models"
was close to midnight. And that was actually the cause of the error.

Actually, when executing that test very close to midnight, the test activities
are set up for a day and the check happens the day after (actually a few second
after). As we check in this test "overdue", "planned" and "today" activities,
the tested value are not inline anymore with the test setup when switching from
a day to the next (passing midnight). For example, "today" activities become
"overdue" activities. To avoid that we patch the date to be far from midnight.

Task-3592798

closes odoo/odoo#141762

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-11-14 06:43:54 +00:00
Pierre-Yves Dufays 644c27a784 [IMP] test_mail: use "await contains" instead of "assert" on dom
We replace the immediate dom checks with the more robust and standard construct
"await contains".

Task-3592798

Part-of: odoo/odoo#141762
2023-11-14 06:43:54 +00:00
Louis Baudoux 99b868f3d4 [FIX] l10n_in_edi: remove IAP sandbox reference
The support for IAP sandbox platform will soon be dropped, so all
references to it need to be removed.
This reference wasn't necessary in the first place since, in test mode,
the service doesn't require credits to run.

closes odoo/odoo#141939

X-original-commit: 66fcf2bc1360d42baa346d7447caa87ac511d127
Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
Signed-off-by: Louis Baudoux (lba) <lba@odoo.com>
2023-11-14 01:56:39 +00:00
Aaron Bohy 7fc1c10a3a [FIX] web: cog menu: add description for command palette
The cog menu in the control panel (displayed next to breadcrumbs)
has a shortcut, so it is available in the command palette. However,
as is has no text content and no title/tooltip, the command palette
displays "No description provided". This commit adds a tooltip on
the icon, which is thus also displayed in the command palette.

closes odoo/odoo#141913

X-original-commit: 991e2e75d20bbb56b080c97e6b5ca96b746de3f3
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-11-13 23:41:55 +00:00
tsm-odoo 518bbbaaa8 [FIX] im_livechat: fix translations for embed live chat
Before this commit, the templates of the embed live chat were
not translated. This is due to the live chat embed app being
mounted without giving any `translateFn`.

This commit fixes this issue.

opw-3509309

closes odoo/odoo#141869

X-original-commit: 27aa2cb0ad1d279f72838000932d94e91cb436f3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-11-13 21:13:37 +00:00
guva-odoo 43dedb5f3c [FIX] purchase: payment_reference purchase autocomplete
When selecting a purchase order on a vendor bill,
the payment_reference is replaced even it was
manually filled.

Steps:

- Create and confirm a PO
- Create a vendor bill, set the bill ref and
  the payment reference (different than bill ref)
- Select PO as purchase_vendor_bill_id
-> payment_reference is replaced by bill ref value

With this commit, we keep the payment_reference
as it is if not empty.

opw-3549673

closes odoo/odoo#141853

X-original-commit: 77a0449938dafdd234ecd5bf469ef3800336ba27
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
2023-11-13 19:03:35 +00:00
Antoine (anso) 8e659d3ba7 [FIX] website_sale: remove background on open category accordion
This commit removes an undesired background on collapsible categories
when they are displayed in the left filter sidebar

task-3593419

closes odoo/odoo#141826

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-11-13 19:03:33 +00:00
Levi Siuzdak (sile) dec902180f [FIX] hr_timesheet: show all tasks assigned to user
Versions:
---------
- 15.0+

Steps to reproduce:
-------------------
1. install project & hr_timesheet;
2. create a follower-only project with timesheets enabled;
3. assign a task to a non-follower with user-level access rights;
4. log in as user;
5. go to timesheets app;
6. add a line.

Issue:
------
The assigned task doesn't show in the search results.

Cause:
------
The task's `allow_timesheets` field is set to be `related` to its
project's `allow_timesheets` field. This field is inaccessible for
private projects the user doesn't follow, so it doesn't show up when
searching tasks assigned to user where `allow_timesheets=True`.

Solution:
---------
Add compute and search methods to have `sudo` access without having to
make to field storable.

opw-3450671

closes odoo/odoo#141760

X-original-commit: 06e67687cf944ea14d38d3bf0272aece15d44faf
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-11-13 19:03:32 +00:00
Gabriel de Paula Felix (gdpf) 1bcc41f7fe [FIX] microsoft_calendar: validation error creating events from microsoft
Before this commit, for some synced users, a weird behavior was happening when an event was created in Microsoft: the event info was being sent to Odoo with a different organizer than 'self.env.user' even though it was the same user creating the event.

After this commit, a condition checking if the event was created in Microsoft is added for skipping the checking since only events created in Odoo can have different organizers during their creation.

Issue from: 3450045

closes odoo/odoo#141481

X-original-commit: 176ca9789b0c2e032773f3ba2c72ab7e2ed24d91
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Gabriel de Paula Felix (gdpf) <gdpf@odoo.com>
2023-11-13 19:03:30 +00:00
Benjamin Hanquin (beha) 8c19636fd7 [IMP] Stock Production Lot dissociate last_delivery_partner_id computation
In stock_production_lot model, there is a field last_delivery_partner_id which is displayed in a Tree View. This fields require to compute ALL the delivery_ids of each LOT, only to display the last_delivery_partner.

This implies a big performance issue for big lots with huge tracability needs in it. The idea is simple, dissociate the computation for delivery_ids, which is only used in Form View and the last_delivery_partner_id which is only used in the Tree View.

I do agree that if both are used in the same view, it would double the computation time. But currently there is a lot of useless computation. Currently the only way to mitigate is by removing the field last_delivery_partner_id in the Tree View, but if client needs that field, it doesn't works.

Benchmark

|Lots/Serial |# Lots | # Delivery | Before PR | After PR |
|:------------:|:---------:|:--------:|
|Lots| 3 | 3  | 0.2723 s |0.0091 s |
|Lots| 4 | 6699 | 307.98 s | 0.0059 s |
|Lots | 13 | 9575 | 569.85 | 0.0036 s |
|Serial | 80  | 80  | 0.30 s | 0.42 s |
|Serial | 150 | 150 |0.39 s | 0.51 s |
|Serial | 7000 | 2000 | 0.50 s/Batch of 1000 | 0.60 s/Batch of 1000|

closes odoo/odoo#141301

X-original-commit: 9ed2b69cc06b1da481dfdc376dab50738a0471dd
Signed-off-by: Benjamin Hanquin (beha) <beha@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-13 17:53:39 +00:00
Demesmaeker 19ca6e12d6 [IMP] website_sale: reactivate cart testing tour
task-3547913

closes odoo/odoo#139589

Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-11-13 17:53:38 +00:00