Commit Graph
158441 Commits
Author SHA1 Message Date
Christophe Monniez a3dffa86f5 [FIX] base, tools: use getlocale vs deprecated getdefaultlocale
As getdefaultlocale is deprecated in 3.11 in favor of getlocale which is
available since at least 3.0.

Part-of: odoo/odoo#112450
2023-02-14 08:03:23 +01:00
Pierre Masereel 1e35315399 [FIX] odoo,base: new Python 3.11 opcodes
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.

Part-of: odoo/odoo#112450
2023-02-14 08:03:23 +01:00
Dylan Kiss (dyki) 8095e3f1e2 [FIX] base: change US tax id label
Since 16.0 the `Tax ID` field label is dependant on the company country.
For the US we chose `EIN` as the label.
Since there are multiple sources of tax ids in the US, it is better to leave it as the default: `Tax ID`.

task-3162675

closes odoo/odoo#112561

X-original-commit: f6846f5b9dcae6a0a9e26f3b847593a2e8a3222b
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-14 00:43:00 +01:00
Abdelouahab (abla) 82e17cff03 [FIX] account: print image in pdf
To Reproduce
============
- create a vendor bill and add an image as attachment
- print Original Bill -> the generated pdf can't be loaded

Problem
=======
when trying to add an image attachment to pdf report, the image needs
a special process.

Solution
========
add the image processing when printing pdf
fix inspired from 15 [commit](https://github.com/odoo/odoo/commit/b82a6cdea21a66588ddcafcdfb5026ec22546745)

opw-3127535

closes odoo/odoo#112596

X-original-commit: 41c79f66cfb5cdb558110d32842198157932397e
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-13 23:42:06 +01:00
Thibault Delavallée 03aa01aff7 [FIX] portal: fix recipients computation override
Portal defines the 'portal.mixin' that overrides a method from 'mail.thread'.
However no explicit inheritance is given between those two mixin. Some Odoo
models notably inherit from 'portal.mixin' and not from 'mail.thread'. It
makes no sense to override a method the model does not explicitly inherit.

In this commit we move the override on 'mail.thread' by checking the model
also inherits from 'portal.mixin' before doing portal-specific computation.
This fixes tests introduced previously.

Task-3175768 (Mail: check inheritances / overrides)

closes odoo/odoo#112573

Related: odoo/enterprise#37039
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-13 22:46:42 +01:00
Thibault Delavallée c70662b6c6 [IMP] test_mail_full: add tests for portal inheritance of thread features
Purpose is to add tests as there are some broken overrides in mail.thread
inheritance mechanism.

We see notably that bad override in portal make some override not being
called correctly.

Task-3175768 (Mail: check inheritances / overrides)

Part-of: odoo/odoo#112573
2023-02-13 22:46:41 +01:00
Julien Castiaux 36ef9cb30f [FIX] core: WatchedFileHandler compat for 3.7
Fine tuning of 8eaac97, the `errors` attribute was added in py38[^1]

[^1]: python/cpython@ca7b504a4d

closes odoo/odoo#112588

X-original-commit: c6c19ff6a3093fe64035d9f970ab35522f8080f5
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-02-13 21:28:15 +01:00
Ivan Yelizariev fa60348883 [FIX] web: properly handle error on copying link to clipboard
Promise error cannot be caught by try-catch, because execution doesn't happen
immedialty. Instead, `Promise.catch` must be used.

STEPS:

* Login native app
* Sales -> Quotation -> Open any quotation
* Action Button (cog icon) -> Share
* Click on Copy Button -> a Traceback appeared

opw-3077859

closes odoo/odoo#112584

X-original-commit: 9cdcd1c1f7219030386d2c90205ea083eb835a13
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-13 21:28:11 +01:00
luvi 48b8242d6f [FIX] web: fix placement of add icon in ExportDialog
This commit fixes the placement of the add icon that could be on top
of the next line in the export dialog, when the name of the field was
too long. This overlapping prevented to press the button of the next
line. This is due to a fix made in commit (1). Now, it is correctly
displayed without overlaying, both in ltr and rtl directions.

Also, because there was not enough padding and some browsers are using
overlay scrollbars on top of the buttons, it was in some occasions not
possible to press the buttons, because the scrollbar was covering the
whole area. In the list of fields, only the first level of elements has
the padding, to avoid having a cascade style when unfolding items.

Static props have also been added to the component, as the component was
introduced without them.

(1): https://github.com/odoo/odoo/commit/f10a4886d2c2bfc0d4643e0e4597e62c2ba4f94e

closes odoo/odoo#112570

X-original-commit: 66207b9ffc353bd52993622cc528494b49eedc27
Related: odoo/enterprise#37037
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-13 21:28:08 +01:00
Pierre Rousseau ac6db52173 [FIX] web: pivot view: use correct label for headers
Before this revision, the pivot view used the wrong label for the
headers in the case of the group by value was "0". This was due to
the use of the falsy value of the group by value to determine if
the label should be used or if the label should be "Total".

closes odoo/odoo#112571

X-original-commit: 97db8c975643bb79e95f7506da03c7142651a3cf
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-02-13 20:13:04 +01:00
Tommy (tong) d837d0b4e2 [IMP] hr_work_entry: allow change initial date to view work entries
- Add a new variable to view the initial date in calendar view.

closes odoo/odoo#112548

X-original-commit: e63993764d7e7206ed0bb97de30964b4776d6adb
Related: odoo/enterprise#37031
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-02-13 19:17:13 +01:00
Antoine Guenet 056af045be [FIX] web_editor: properly copy tables
A syntax error sometimes caused a traceback when copying a table.

opw-3166159

closes odoo/odoo#112562

X-original-commit: 7fdeced319902e26ce33b5ffd0dd08957c484eb4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-02-13 17:26:16 +01:00
amdi-odoo 2e6ae86c58 [FIX] website_slides: prevent stat button action
Purpose
=======
Prevent the 'Visits' stat button of the Course to
open any content action.

Task-3163777

closes odoo/odoo#112560

X-original-commit: ed064682a1e4aa8131665194a516a0a6652b74f9
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-02-13 17:26:11 +01:00
Audric Onockx (auon) cb459faa3b [FIX] project: allow computation of recurrence message when yearly
Steps:
Enable recurrence feature.
Go to Project > Office Design > Customer Review.
Enable recurrence on this task > Change month to year.

Issue:
Crash.

Cause:
`_get_next_recurring_dates` is called without a `repeat_month` arg.
Is is supposed to be a string which is going to be found in MONTHS keys.
Except it is False and so it is not in the list.

Fix:
If we don't receive it, deduce it from `date_start` arg.

closes odoo/odoo#112506

X-original-commit: 566c4904129dc7e81458871656d9b20b19b36246
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Audric Onockx (auon) <auon@odoo.com>
2023-02-13 17:25:54 +01:00
aliya b305899880 [IMP] account: improve expected payment dates with payment terms
Changing the expected payment date for an invoice with several installments is unclear, as there's no clear indication of what is expected when, except in the aged report.
This commit:
- Changes the default label of journal items if there is a payment term that splits it into several installments. Each journal item will now have "installment #<number>" appended to it.
- The installment label is added on all types of moves.

task-3137957

closes odoo/odoo#110955

Related: odoo/enterprise#36266
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-13 17:25:50 +01:00
Patrick Hoste 3e5f84cff3 [IMP] website_slides: add sanitize_overridable to html_content field
Following this PR odoo/odoo#97398 website_slides module was forgotten
This commit add 'sanitize_overridable' parameter to the html_content
field. This will allow one to use the embed snippet in an article
type slide.

Task-3134690

closes odoo/odoo#112534

X-original-commit: 627833e77eb8f7ef7850f1fdeeb115ee8870c7f9
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-02-13 16:20:56 +01:00
Maximilien (malb) c9e26ac79a [IMP] l10n_cl: translation
Before this PR, all this localisation was written in Spanish, but all the localisation have to be written in english and then translated back in the native language. This PR correct that.

closes odoo/odoo#112160

Task-id: 3166093
Related: odoo/enterprise#36801
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-13 16:20:52 +01:00
Arnold Moyaux a022fefbaf [FIX] purchase, purchase_stock: add price difference account
Version 16.0 removed the price different account following this pull request #99411

This decision has been made because it was only used anymore by standard cost method and real time valuation.
We thought that standard was not a valid accounting method and we didn't want to maintain code for it.

But:
- Standard could be valid if you manualy complete the accounting entries
by yourself (e.g. employees/machines cost in mrp).
- It's also valid if you record the difference between standard price and
vendo price (price diff)

If you want to have an estimation of your cogs (benefits and loss) during an
accounting period. People just do a manual correction at the end but they have
a real time reporting on the situation.

It's a too big regression to be acceptable. We apologize and reintroduce it for
16.0 and future version.

This PR reintroduce the fields in purchase and the fix module in 16.0 is
not needed anymore.

closes odoo/odoo#109924

Related: odoo/upgrade#4315
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-02-13 15:15:34 +01:00
svs-odoo 1547d66585 [IMP] stock_dropshipping: new picking type code
Adds a new picking type code, 'dropship', and adds a new action/menu
item to display only the dropshipping's operations.

task-3076044

closes odoo/odoo#109511

Related: odoo/enterprise#35613
Related: odoo/upgrade#4252
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-02-13 15:15:10 +01:00
svs-odoo 5f9ff7d442 [IMP] product_expiry, stock: toggle tracking
In the Inventory's Configuration, the option to enable expiration dates
depends of the activation of lot and serial numbers.
But if the user disables the tracking and the expirations dates were
enabled, they still are.
Also, if the module `product_expiry` is installed directly, the tracking
numbers aren't enabled alongside.

To fix that, this commit modifies the `res.config.settings` onchange
`_onchange_group_stock_production_lot` to disable automatically
expiration dates when tracking is disabled, and this commit also adds a
hook in the `product_expiry` init to enable tracking numbers at the
installation.

Part-of: odoo/odoo#109511
2023-02-13 15:15:09 +01:00
svs-odoo ae5ccb6ffc [IMP] stock: update product quantity on hand
Now, the button "Update Quantity" and the stat button "Qty. On Hand" on
the product's form view will both call `action_update_quantity_on_hand`,
which who can call `action_open_quants` is an advance option is enable
(multilocation, owner or package) or if the product is tracked by lot or
serial numbers.

Also, displays the product's UoM in the `stock.change.product.qty`
wizard and changes its style so labels have more space.

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:09 +01:00
svs-odoo 0e71e350e3 [IMP] product,stock: packaging product id
Makes the `product.packaging` `product_id` required in the model instead
of the view only, since a packaging is supposed to always be relative to
a product.
Edits some views to add the default product in the context and makes the
field readonly if there is no `product_id` (that way, the user can't
no more create packaging without product).
Also, removes the domain in the action to display the packaging list
view so the user can see if there are some packagings without product
and can eventually delete them.

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:09 +01:00
svs-odoo 4c4e18091b [IMP] barcodes: remove rule name size limit
task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:08 +01:00
svs-odoo 656d8ace87 [IMP] stock: backorder confirmation
In `_check_backorder`, changes the condition so it checks if the qty
done is enough compared to the actual reserved quantity (instead of the
demand).
Also, removes an unused bloack of code and makes minor visual changes.

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:08 +01:00
svs-odoo 4b6a0e6b5b [IMP] stock*,mrp: Operations' submenus
In the inventory menu, the "Operations" menu has now three sub items:
- Transfers
- Adjustments
- Procurement

All the existing `menuitem` go now under one of these sections.

Also, for the old transfers menu itme, this commit replaces it by three
other menu items: "Receipts", "Deliveries" and "Internal Transfers".
Each of them will display only the transfers with the matching picking's
type (depending of the picking type's code).
When a picking is created from there, its picking type will be set by
default according to it and the field will be filtered by its code.

When `mrp` is installed, adds a menu item for the manufacturing
operations in "Transfers" submenu too.

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:06 +01:00
svs-odoo 4dd3104b96 [IMP] product_expiry,purchase_requisition,stock*: visual changes
- The `picking_type_id` field in the pickings form view is not openable;

- Display the `description` field (optional) in the SVL list view;

- Add the `expiration_date` field (optional) in the quant list views;

- Add a description text for the landed cost;

- Renames field `requisition_id`: "Purchase Agreement" > "Blanket Order"

- In Inventory Adjustment, hides the "Apply All" button is at least one
  record is selected;

- In `product_expiry`, renames two views to stick to the XML's coding
  guidelines: https://www.odoo.com/documentation/16.0/contributing/development/coding_guidelines.html#xml-ids-and-naming

- For the replenishment:
  - Places the field `product_id` as the first option when the user
    writes something in the searchbar;
  - Renames `route_id`: "Preferred Route" > "Route";
  - Renames the button "Automate Orders" into "Automate";
  - Set the `route_id` field as "optional=hide" until `mrp_purchase` is
    installed (in this case, it will be set as "optional=show") because
    in this case, there is at least two routes (Buy and Manufacturing).

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:06 +01:00
svs-odoo dd42059db7 [IMP] stock: product's buttons
- Places the buttons added in `stock` before the "Print Labels" button,
  that way, the "Update Quantity" button is always the first button;

- Adds some depends on compute's methods, so that way it displays the
  "On Hand" and the "Forecasted" stat buttons, and the weight and volume
  UOM even if the product is new and the record wasn't saved yet;

- Adds the "Update Quantity" button in the product's forecasted report
  and removes useless attributes of the "Replenishment" button;

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:05 +01:00
Luis Torres 051178d374 [FIX] point_of_sale: Fixed key in dict for update
Taxes field is not defined in the pos.order model, so, if you call
the onchange you get the next error:

```
  File "/home/odoo/instance/odoo/addons/point_of_sale/models/pos_order.py", line 1159, in _onchange_amount_line_all
    line.update(res)
  File "/home/odoo/instance/odoo/odoo/models.py", line 5520, in update
    self[name] = value
  File "/home/odoo/instance/odoo/odoo/models.py", line 5860, in __setitem__
    return self._fields[key].__set__(self, value)
KeyError: 'taxes'
```

closes odoo/odoo#112524

X-original-commit: af35c97866fdb271881b7d2b007a3d79f41a910a
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2023-02-13 14:05:32 +01:00
william-andre a6b43db144 [FIX] account: time complexity of before2after
The function `_sync_dynamic_line`, which is called everytime we edit a
`account.move` or a `account.move.line` is tracking the values before
and after something changed.
Some part of that process was computed in `O(n^2)` where `n` is the
number of `account.move.line` related to the records; this commit is
making it `O(n)`, like the function is supposed to be.

Even though, these are light operations (no database queries, all in
memory), they obviously start to matter at a certain point.

The time to populate `account.move` (using the `populate` command) goes
from 224ms to 170ms per record (1000 moves with ~10 lines per move)

closes odoo/odoo#112522

X-original-commit: 99d2b818238b848125ec6696185ff1fca53d24cf
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-13 14:05:29 +01:00
pedrambiria 31f91e6a58 [FIX] google_calendar: avoiding return of recordset when using ormcache
Before this commit: In some cases where some events won't sync to
Odoo properly you got the "Unable to use a closed cursor." error. The
problem is that `_from_google_ids` function returns a recordset, and the
underlying cursor may be closed.

Steps to reproduce the issue:
 1. Create user_A and user_B in Odoo
 2. Sync user_A and user_B with Google calendar
 3. Create an event with user_B on the Google calendar
 4. Run the "Google Calendar: synchronization" cron
 5. Change the created event's owner to user_A on the Google calendar
 6. Run the "Google Calendar: synchronization" cron
=> You will get this error on the log, and the event won't sync:

```
Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/api.py", line 886, in get
    return field_cache[record._ids[0]]
KeyError: 99

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/fields.py", line 1061, in __get__
    value = env.cache.get(record, self)
  File "/home/odoo/src/odoo/odoo/api.py", line 889, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'calendar.event(99,).google_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/addons/google_calendar/models/res_users.py", line 91, in _sync_all_google_calendar
    user.with_user(user).sudo()._sync_google_calendar(google)
  File "/home/odoo/src/odoo/addons/google_calendar/models/res_users.py", line 70, in _sync_google_calendar
    synced_events = self.env['calendar.event']._sync_google2odoo(events - recurrences, default_reminders=default_reminders)
  File "/home/odoo/src/odoo/addons/google_calendar/models/google_sync.py", line 147, in _sync_google2odoo
    existing = google_events.exists(self.env)
  File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 180, in exists
    events.odoo_ids(env)
  File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 88, in odoo_ids
    found = self._load_odoo_ids_from_db(env, model)
  File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 111, in _load_odoo_ids_from_db
    mapping = {e.google_id: e.id for e in odoo_events}  # {google_id: odoo_id}
  File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 111, in <dictcomp>
    mapping = {e.google_id: e.id for e in odoo_events}  # {google_id: odoo_id}
  File "/home/odoo/src/odoo/odoo/fields.py", line 1087, in __get__
    recs._fetch_field(self)
  File "/home/odoo/src/odoo/odoo/models.py", line 3276, in _fetch_field
    self._read(fnames)
  File "/home/odoo/src/odoo/addons/calendar/models/calendar_event.py", line 436, in _read
    super()._read(fields)
  File "/home/odoo/src/odoo/odoo/models.py", line 3343, in _read
    cr.execute(query_str, params + [sub_ids])
  File "<decorator-gen-20>", line 2, in execute
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 89, in check
    raise psycopg2.OperationalError('Unable to use a closed cursor.')
```

The solution is to use ormcache on a function that returns the ids of the
events.

opw-3098799

closes odoo/odoo#112517

X-original-commit: 831e2e916541a95a1b932d9f58b3592ecee0c685
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-02-13 14:05:26 +01:00
std-odoo 6cc8cec5f1 [FIX] google_gmail: fix google gmail oauth crashing
Bug
===
When an error occurs, the error received is wrongly stringified.

closes odoo/odoo#112504

X-original-commit: b0641c5e85bf9d2e2c64ba548f7243e0a4196602
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-02-13 14:05:21 +01:00
std-odoo e75ea7db53 [FIX] mail: for the complexity of the mail message unlink method
Bug
===
When we remove some mail messages, we invalidate the cache of the
related documents. But in the same loop we call _invalidate_documents
which invalidate the cache, and so at the next iteration we will need
to make a new SQL query to know if the message is a "thread message".

So because of the prefetch ids, and because we invalidate in the loop,
if we unlink 1000 message, we will make 1000 SQL queries to fetch the
fields values of the 1000 messages.

Note that the unlink method will invalidate the entire cache anyway,
so unlike the write / create methods, we shouldn't need to invalidate
manually the related documents.

Task-3171093

closes odoo/odoo#112494

X-original-commit: f8958e9bbd4c7c37f614b20f7ed4d4825d438362
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-02-13 14:05:18 +01:00
Karl 5f7eaf34ed [CLA] Glo Networks Ltd
closes odoo/odoo#112491

X-original-commit: 9607e4ac87878bdcabbe1029f113b75a33199e69
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-02-13 14:05:12 +01:00
Denis Ledoux 2f5ed5f4ff [IMP] website_slides: removed unused member_values variable
The `member_values` argument of `action_add_member` is no
longer used in any call of `action_add_member`. We can therefore
remove it in standard, as it's completely unused.

Besides, after grepping the code for all calls to `action_add_member`
to check `member_values` was indeed unused, I saw this method
wasn't used by any views or Javascript code, but only
through Python routes, and therefore it can be converted
to a private method by prefixing it with `_`,
as our guidelines states to make private methods which are not used
by the web client.

closes odoo/odoo#111908

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2023-02-13 14:05:09 +01:00
rhe-odoo e75c5fc1af [IMP] point_of_sale: warning with cash payment methods
Currently, it is possible to assign the same "Cash" payment method to multiple PoS.
At the moment, when creating a new PoS, Odoo tends to assign it by default. Although this is highly not recommended as it can only lead to incorrect cash control (two PoS devices rarely share the same till and therefore needs their own cash payment method).

This commit makes sure payment methods of type Cash aren't set by default when creating new PoS.
it also blocks the user from setting the same Cash payment method to multiple PoS configs.

closes odoo/odoo#92664

Task-id: 2857417
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-02-13 12:36:15 +01:00
Samuel Degueldre 621c8cf5fe [REF] pos_restaurant: rewrite resize logic for tables on floor screen
The previous code had a lot of repetition and made use of deprecated
features such as useListener. This commit refactors the resize logic by
creating a simple ResizeHandle component that encapsulates the drag
handle logic, it then communicates delta in x and y to the EditableTable
which applies it to the correct side and adds constraints on the
coordinates.

It also slightly improves the UX for round tables by also giving them
"corner" drag handles, which let you resize two dimensions at once
instead of just one, this also makes the code more uniform between the
table types, the only difference being where we position the drag
handles so that they're visible.

closes odoo/odoo#112430

Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-02-13 11:29:55 +01:00
Touati Djamel (otd) 7f0a084243 [FIX] stock, purchase_stock: apply putaway strategy even if no package
Steps to reproduce the bug:
- Enable “Storage location” option
- Create a storable product “P1”
- Create a putaway rule:
    - When in: WH/Stock
    - Store to: WH/Stock/shelf1
    - product: P1
- Go to operation types -> “Receipts orders”
    - Enable “Show Detailed operations” and
    “Pre-fill detailed operations”
- Create a purchase order:
     - Add 2unit of “P1”
     - Confirm the PO
- Go to the receipt:
     - the destination location is correctly set “WH/stock/shelf1”
     - set the qty done to 1
     - validate the delivery and create a back order

Problem:
The destination location is “WH/Stock” instead of “WH/stock/shelf1”
because the ```_apply_putaway_strategy``` function is not called on
the ```stock.move.line``` when there is no package

opw-3162934

closes odoo/odoo#112400

X-original-commit: b4c83ab2b202702e096c775ae73f4646ba93eae4
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-02-13 11:29:52 +01:00
Eteil Djoumatchoua (etdj) 67677a91a3 [FIX] delivery: add test for delivery w/carrier when no linked sale order flow
This commit adds a test to a fix done in https://github.com/odoo/odoo/commit/afed7db30042e2ea91cdae292dadb7b6f742e33d

bug introduced during: odoo/odoo#109298
opw-3162826

closes odoo/odoo#112451

X-original-commit: 7bbae5f8673c3ea8dfb428a1a7c1eb808f9139fc
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-02-13 09:17:19 +01:00
Lucas Lefèvre 68c1aad930 [REF] spreadsheet: assign filter in history
The filter can be assigned in the history directly with its
"id". No need to copy the object

closes odoo/odoo#112309

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-02-13 08:19:00 +01:00
Julien CastiauxandMartin Trigaux 2fdacf2334 [FIX] core: remove custom open in logging facility
Remove custom open introduced by bpo-26789 as we do not need it.

closes odoo/odoo#112453

X-original-commit: 8eaac9744b93e7132827edb2a59c28bb43732ec1
Related: odoo/enterprise#36978
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Co-authored-by: Martin Trigaux <mat@odoo.com>
2023-02-12 14:14:41 +01:00
Julien (jula) 926d8c6c5d [FIX] web, stock: escape JSON error when downloading report
__Description of the issue:__

When something goes wrong while downloading a report file, a 500 error
is sent as JSON. However the frontend interprets this response as HTML
and then try to parse the text content as JSON.

Most of the time this works, but if the response contains any HTML tags,
like `<lambda>` from a Python stacktrace, the JSON response will get
misinterpreted as HTML instead of regular text, causing the subsequent
JSON interpretation to fail.

The end result for the user is that empty tracebacks will be displayed
instead of User Errors or actual tracebacks.

__Desired behavior:__

The JSON response is HTML escaped before being sent and will therefore
be correctly parsed and displayed to the user.

This basically restore what was done prior of #104594.

Enterprise: odoo/enterprise#36523
X-original-commit: 5999a7d336553053c5638f69344cdfbc84a8c681
Part-of: odoo/odoo#112453
2023-02-12 14:14:41 +01:00
Abdelouahab (abla) 139f7726e7 [FIX] account: do not add banner on corrupted PDF
To reproduce
============
- create a vendor Bill
- add the PDF (from ticket attached files) in chatter
- go back to list view and select the bill -> print Original Bills
a traceback is raised

Problem
=======
for some excptional PDF files (like the one attached in the ticket),
the library PyPDF2 that  we use to manage PDF files crashes.

Solution
========
a [fix](https://github.com/odoo/odoo/commit/e55196375aa124558b87ebd50012d5664295ca07) was backported from 16 and updated
so that we don't block the flow, we let a message on chatter that there was an error and we ignore adding the banner.

opw-3141143

closes odoo/odoo#112467

X-original-commit: d73a6261b9c7de41a1de6a2cd888c131ecee023b
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: abla001 <abla@odoo.com>
2023-02-11 19:20:58 +01:00
Romain Derie ba42f2dda9 [FIX] website: show homepage in page list when multi website is disabled
Since website was moved from frontend to backend in 16.0 with [1], there
was an issue with the page list view which would not show the homepage
record when multi website group was not enabled.

Indeed, we have our own `recordFilter` method which is based on the
`website_id` field.
But the framework ignore this field (it doesn't read the property at all
and so don't have access to its value) if it's hidden by a `groups`
property. In such cases, the field should be duplicated and hidden with
`invisible`, as those fields will have their value retrieved depsite
being hidden.

Step to reproduce:
- Install website with no demo data (to have only one website)
  Or go to runbot / install website with demo data and disable the multi
  website group
- Go to Website > Site > Pages
- You don't see the homepage in the list, because there is 2 homepage
  (one specific and one generic) but since the website_id is not fetch,
  both are considered generic (which is not supposed to be possible)
  and the filter is then considering those to be shadowed by the other,
  ultimately filtering out both.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

closes odoo/odoo#112461

X-original-commit: 5ff5daee518d23c3b6958133eb1f99bc5fc1063f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-02-11 19:20:56 +01:00
Laurent Smet b79863a62e [FIX] account: Prevent reset draft an exchange journal entry
An exchange journal entry must not be reset to draft manually. It's done by odoo itself automatically when breaking an existing reconciliation.

closes odoo/odoo#112472

X-original-commit: ad9d53c8976ed78f3f6fdd65795c582d533de436
Related: odoo/enterprise#36999
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-02-11 18:23:59 +01:00
Laurent Smet 1899db8fa5 [IMP] account: Improve perf of reconciliation
Benchmark:
A batch of 1000 payments and a move of 1000 lines to reconcile each payment separately.

Current observed time: +-288s

Improvement:
Adds some context keys when creating the account.full.reconcile to avoid the recomputation of dynamic lines (invoices), synchronization of payments/statement lines and check if the move is well balanced.
=> +-288s => +-34s

X-original-commit: 17c039788365065830dd9d7d2559fcb11f77606c
Part-of: odoo/odoo#112472
2023-02-11 18:23:58 +01:00
Thibault Libioulle ea780d1f71 [FIX] purchase: fix StopIteration when notify recipients
This commit fixes the case where portal_customer is not added in the
recipients group by the portal mixin.

Steps to reproduce:
- Go on a purchase
- Log a note and tag a user who handles notification by email
- Traceback:
```
    File "/home/odoo/src/odoo/addons/purchase/models/purchase.py",
                        line 346, in _notify_get_recipients_groups
    customer_portal_group = next(group for group in groups if group[0] == 'portal_customer')

    StopIteration
```

Current Behavior:
- Traceback StopIteration

Expected Behavior:
- Log a note with the tagged (boomer) user.

See odoo/odoo@f879cf2867

closes odoo/odoo#112465

X-original-commit: 7b9dd53a5573141275d41436189c782bccb96c3d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-11 00:41:45 +01:00
Patrick Hoste aca7beb2e2 [FIX] hr_expense: fix alias_domain configuration
Before this commit, if hr_expense module was installed it was
impossible to configure alias_domain in the settings, the change
wasn't taken into account. This was due to the presence of the
field at two separate place and one of them having the readonly
parameter set.
This commit fix this issue that was introduced by :
5eca7b7378

Task-3127163

closes odoo/odoo#112443

X-original-commit: fc1c20cb5ce471b65120ec3eff7abd18ffd3a9fb
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-10 19:53:06 +01:00
tsm-odoo 7df0ce5570 [FIX] bus: do not handle events of outdated websockets
Before this commit, late close events were not handled properly. This
could have led to non-reconnecting websockets. The problematic scheme
is the following:
- Close the socket (eg. upon the reception of an `offline` event), let's assume that
the other end will not perform the closing handshake, the connection will be
closed once the browser presumes it is dead.
- Create a new socket (eg. upon the reception of an `online` event)
- The browser assumes the connection is dead and dispatches a `close` event,
the worker switches to the `reconnecting` state and expects an `open` event  to
update its state to connected. Since there is already a running socket, the worker
won't open a new one and will never receive the `open` event.
- Server closes the connection  (eg. `KEEP_ALIVE_TIMEOUT`)
- The close handler is called but since it is in the `reconnecting` state, it assumes
it shouldn't do anything thus, no reconnect attempt is made.

This PR fixed this issue by ignoring events linked to outdated sockets.

closes odoo/odoo#112456

X-original-commit: a2454739156d8742f7606f090126f32735fb15df
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-10 18:52:22 +01:00
FrancoisGe 01519ac2f6 [REF] hr_attendance: convert legacy client actions to owl
The goal of this commit is to convert the last legacy client actions from
/hr_attendance to owl.

Client actions:
    hr_attendance_greeting_message
    hr_attendance_kiosk_confirm
    hr_attendance_kiosk_mode
    hr_attendance_my_attendances

closes odoo/odoo#110095

Taskid: 3138068
Related: odoo/enterprise#35884
Related: odoo/upgrade#4296
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-02-10 17:49:45 +01:00
Martin Trigaux ae2de8101d [I18N] migrate to the nex transifex API
Tansifex is deprecating it's client and switches to a go-based
solution in its API v3

The new client is still backward compatible with the old format but
the v2 API is going to be phased out.
See https://github.com/transifex/cli to install the deplyments using
the tx client

This PR is the result of the "tx migrate" command

closes odoo/odoo#112402

Transifex: adapt to new URL format
X-original-commit: 7ca55aec4f1faa8bc2ad80d730a7f0771df3998e
Related: odoo/documentation#3534
Related: odoo/enterprise#36950
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-02-10 16:49:15 +01:00