Commit Graph
158615 Commits
Author SHA1 Message Date
Victor Feyens ca56549d7a [FIX] sale: salesperson always set to current user
Forward-port of #94947 for 16.0+

closes odoo/odoo#112935

X-original-commit: ee3404603af8a38e21b922c39aa36a6b1e17b44d
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-02-18 04:36:30 +01:00
Géry Debongnie 785e4fa812 [IMP] web: update owl from v2.0.5 to v2.0.6
This update conatins the following commit:

 - [IMP] devtools: provide access to Fiber and RootFiber
 - [FIX] props validation: do not subscribe to props keys
 - [FIX] reactivity: only show key in subscription if observed by callback
 - [FIX] components: stop rendering stale t-component when delayed

More details at: https://github.com/odoo/owl/releases/tag/v2.0.6

closes odoo/odoo#113041

X-original-commit: fd67ca5d2aaa9683ac1e4667e76fc4230d5d62c6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-18 02:49:53 +01:00
Abdelouahab (abla) 5b4c93e387 [FIX] web : typo t-if vs if
To reproduce
=============
- on settings upload a custom background on document layout and save it
- open document layout again and try to download the image -> Traceback

Problem
=======
when calling download method we will ask server for a record with `id=false`
which gives an error

Solution
========
download button shouldn't be visible when `record.resId == false`

opw-3138230

closes odoo/odoo#113029

X-original-commit: 2e2cdee563dd645cabe2d361489d6eb17b174a33
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-18 02:49:50 +01:00
tsm-odoo f95c95b44f [FIX] bus: fix bus test undeterministic runbot error
Before this commit, the bus service test "tabs share message from a
channel" was sometimes failing. This is due to the fact that it was
only waiting a `nextTick` to receive the message but the message is
not guaranteed to arrive within a tick. Indeed, the message is first
sent from the worker `MessagePort` via `postMessage` then triggered
on the event bus via `dispatchEvent`.

closes odoo/odoo#113008

X-original-commit: a8d25a89a9fbdb9d51926df2c33c1f4b5eba9b3f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-02-18 02:49:48 +01:00
tsm-odoo 5b4da6ae73 [IMP] im_livechat, web: prettify im_livechat module
closes odoo/odoo#112999

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-18 02:49:45 +01:00
David Monjoie c79bb3c9c6 [FIX] web_editor: fix missing setDirty prop
Commit [1] removed the protection around the call to setDirty because setDirty
is always defined when the field is initialized through the standard field.js
mechanism. However, in todo_list.js in hr_payroll, the html field is called
without going through that mechanism, resulting in the prop being missing and the
call to fail with a traceback.

This could be fixed by adding the missing prop to todo_list.js, but other people
are likely to do the same mistake in the future so adding a default of our own is
probably better to avoid future similar bugs.

[1]: https://github.com/odoo/odoo/commit/f56e3bca2456f04616982a9a0e77b8d4c5a0abff

closes odoo/odoo#112994

X-original-commit: a6043b3aa290d6cecaabc02995e490f44cbd6ce2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-02-18 02:49:42 +01:00
David Monjoie 11d1eff8c9 [IMP] web_editor: allow users to select font size 16
The default font size of the frontend is 16 so the `default` option
in the font size dropdown was supposed to be enough for this use case.

However, this is not true in the context of website_blog where the
default font size of blog content is not 16. This is not a problem
because if the user does not like the default blog font size then
they can change it using the font dropdown... except they have no
way to select 16 for a size and `default` doesn't mean 16 in blog.

This commit adds an explicit entry for 16 in the font size dropdown.

opw-3110711

closes odoo/odoo#113011

X-original-commit: a35679d5a30e3931216c65ff4ea896e507ba4cf1
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-02-18 00:23:51 +01:00
Andrea Grazioso (agr-odoo) 4451220811 [FIX] account,purchase,sale: order tax amount mismatch
With Rounding Method set to 'Round Globally'
Create a Quotation with 2 lines:
- Price 6.7, Tax 15%
- Price 6.7, Tax 15%
Total is 15.41, Tax amount 2.01
When sending the quotation via email or in list view the amount total
shown is 15.42.

This occurs because:
- order total is computed as sum of the lines `price_total` field,
which, defined as Monetary, store already rounded values
- line total is computed via `_compute_taxes`, where
tax amount is always rounded per line

opw-3113851

closes odoo/odoo#113026

X-original-commit: c677f45dcb050ce7e6f755b71e56c9b9120bf613
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2023-02-17 22:02:40 +01:00
xO-Tx d1e5e4420a [FIX] web_editor: prevent editor rollback of top menu
To reproduce the issue:

- Website > Add menu items to activate the "+" dropdown.
- Edit mode > The top menu disappears.

On `_activateContenteditable()`, The `initAutoMoreMenu` > `_adapt()`
mutations (changes to move the overflowing menu items to a "+" dropdown)
are recorded and rollbacked by the editor, leading to reset the top menu
to the step before removing the `.o_menu_loading` class.

Recording the `initAutoMoreMenu` mutations leads to some other issues:

On edit mode (without overflowing items):

- Website > Edit mode > The editor starts (before any updates) with an
extra "history step".
- Undo > The top menu disappears.

On edit mode (with "Mega Menu" items):

- Website > Edit mode > Edit text in a "Mega Menu" item > The top menu
disappears.

The goal of this commit is to fix this behaviour using the
`renderingClasses` filter (added in [1]) to prevent the `o_menu_loading`
class from being taken into account in the `filterMutationRecords()`.

[1]: The https://github.com/odoo/odoo/commit/1c25ddb42393b136cac2a0ee0b9b7280fd803e7d

opw-3146873

closes odoo/odoo#113016

X-original-commit: 96c9ebd26aabc3f99acf5d586746b05db7cf4953
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-02-17 22:02:38 +01:00
Thibault Delavallée 2075dd0848 [FIX] mail: fix language fetch when sending notification
When using the composer in batch and comment mode, the first record of the
batch was used to find the language for notifications instead of the one
linked to the message.

Previously to odoo/odoo#99482 batch comment mode was not supported and there
were always only a singleton as record ids. Now that it is supported we have
to be more careful when dealing with IDs.

To solve this issue we check the message res_id which effectively contains
the correct record ID.

Oversight of odoo/odoo#99482

Task-3035101 (Mail: Support batch-posting from composer)

closes odoo/odoo#113015

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-17 22:02:35 +01:00
Thibault Delavallée 6715a90e94 [FIX] test_mail: fix python issue
Not sure why but this piece of code seem to work on runbot but not locally.
Let us make both of them happy.

Part-of: odoo/odoo#113015
2023-02-17 22:02:35 +01:00
william-andre d782b8b925 [IMP] l10n_*: convert CoA in new format
Converted using https://github.com/william-andre/transform_coa

closes odoo/odoo#110016

Related: odoo/enterprise#35836
Related: odoo/documentation#3336
Related: odoo/upgrade#4276
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-17 19:30:40 +01:00
wan 5125748616 [REF] account: remove chart template
Rewrite the whole chart template mechanism, removing the templates
stored in the database. The new format will mainly use CSV.

Speed up install time
---------------------

* About half of the time of installing a localization for the first time is
  taken by creating the template records. This new in code format gets
  completely rid of this.
* Creating the template records could often not be done in batch because
  of parent/children relations.
* The instanciation of the accounts on the company has been entirely
  reworked too, by
  - optimizing the order of creation of records to avoid UPDATE queries
  - using precomputed fields to avoid UPDATE queries
  - updating the translation in batch
  - deactivating logging in the chatter
  - avoiding access rights checks by checking the rights at the start

Overall, when installing a chart template for the first time, it is 4
times faster because half of the time spent on saving the template in
the database is not done at all anymore, and the instanciation on the
company is more than twice as fast.

Reduce technical debt
---------------------

There is no need to synchronize the templates with the real records
anymore. No need to use hooks to copy the data from one to the other.

It is easier to change a template in a stable version, which can often
be necessary due to legal reasons (i.e. a change of tax rates, reporting
tags,...)

Two modules have been removed:
* `l10n_generic_coa`: since there is nothing left datawise in this
  module, it can be integrated in `account` for free. It is just code
  and CSV.
* `l10n_multilang`: the fields that this module modified to be
  translatable are now always translatable:
  - there was an issue when updating modules that deleted all the
    translations because the fields were not translatable at some point
    during the loading of the registry, then they because translatable
    again but lost all translations because of the column type change.
  - most devs are not able to understand all the languages needed for
    all the localization available. Therefore, english has been added in
    the sources in most localization to understand better issues while
    debugging.
  - no need to call post init hooks anymore, doing the sync with the
    templates.
  - more: see "Translations" section

Because most of the data is now in CSV, it is also easier for product
owners to edit, audit, modify files themselves, removing one layer
during trivial development processes when only data should be changed.

More flexibility for declaration
--------------------------------

The data declaration can now be done easily in python or CSV.
A nice feature is that you can declare everything at once, even for some
more complex chart of accounts:
* if you have to set default taxes on accounts, would need to
  - declare the accounts because accounts are required on the taxes
  - declare the taxes
  - declare the taxes to put on the accounts
  This would lead to scatter information in multiple files. Now,
  everything can be declared in the same place and the loading of the
  chart of accounts will do the 3 steps automatically.
* if you have a relation of child/parent, you would first need to
  declare the parents then the children, and the loading would not be
  efficient because done one by one. Now, everything is done in batch
  automatically without having to think about it.

It is also easier to update fields on records where there was no field
for that on the templates, like
* setting a restriction for journals on accounts
* setting specific values on the company
* modifying journals and linking them easily by using the xml_id instead
  of having to compute it manually

Translations
------------

Some countries have multiple languages (i.e. Belgium uses officially
French, Dutch and German, and the CoA also has an official English
version) and we must support the languages in all these countries.
All these translations are known, and hard coded without using out
translation platform (Transifex). We also like to have the English
version (even if an official one doesn't exist) so that support can be
done more easily in databases using chart templates in other languages
(especially using a non roman alphabet).

Because the translations were not on Transifex for these records, it was
really hard to maintain: the translation templates (`.pot` files) were
not easy to extract as the automatic export would give values mixing
both the CoA and the menuitmes, the fields' strings,... But we don't
want to translate the CoA as we already know the value.
Managing the translations in the `.po` files was also annoying:
- it is easy to forget that the translations need an update too
- it requires a special editor, special terminal commands that everyone
  is not familiar with
- it is easy to make mistakes in the source string

The new format is the following: `field@en_US` where `field` is the
translatable field (usually `name`) and `en_US` is the locale code.
This allows to have the whole declaration on one line, everything in one
file. It also makes the process easier when debugging: instead of
searching for the translation in the `.po` files, it directly appears
next to the configuration of the account/tax/... .

Update of the code
------------------

The code can be updated using this script
https://github.com/william-andre/transform_coa
Forward ports can be managed too by stashing/resetting/checkout the new
modules or the changes in the modules updated in the same PR.

task-2687567

Part-of: odoo/odoo#110016
2023-02-17 19:30:40 +01:00
william-andre aa041fc75f [FIX] account: compute name of multiple moves at the same time
Computing the name of multiple moves at the same time could lead to some
errors because we don't know when the field will be flushed:
1: We can't rely on the context to compute moves, for instance when
   mixing payments and other moves in a bank journal. The context key
   has been removed as it could be useful only when the `payment_id` was
   not set yet, which should only happen in the Form view. But the name
   of payments was not editable before posting a first time(like it is
   for invoices)
   Was failing following test with only `account_reports` installed
   `TestReconciliationReport.test_reconciliation_report_multi_currencies`
2: There was an optimization tho avoid doing `O(n)` queries to find if
   the current move is the first one of the sequence (and needs to be
   precomputed in draft because of that). The algorithm is doing the
   same `SELECT` after anyways[1] or even a second one to relax the
   domain, followed by an `UPDATE` right after. This can't be batched
   and delayed because we rely on the SQL unique constraint to assign
   the numbers.
   Was failing folloing test with only `account_reports` installed
   `TestAgedReceivableReport.test_aged_receivable_sort_lines_by_date`

The reason why it started causing issues on some test databases (only
`account_reports` installed, not on a full runbot build) is still
unknown.

[1]: In order to reduce the number of duplicated queries, we could do it
only once per tuple (journal, date range, is_refund, is_payment), but
getting this tuple is not so easy and reliable without a complex
implementation. It is also not really possible to cache and reuse (i.e
in `highest_number`) because the value changes when other moves are
posted.

Part-of: odoo/odoo#110016
2023-02-17 19:30:39 +01:00
william-andre b08b46f6f2 [FIX] base: allow to remove default properties when uninstalling module
Uninstalling a module shouldn't be blocked by properties using the
record.
Instead, we are removing the property.

Part-of: odoo/odoo#110016
2023-02-17 19:30:39 +01:00
william-andre 14ab457c6f [FIX] sale_stock: prepare query count tests
We don't want the query count to be impacted by whether a localization
is installed or not.
The code of a localization will most likely always check for the country
code of the company linked to the document, which adds an extra query
only in certain cases.

In order to fix that, we simply always prefetch this before running the
tests. The query count is also adapted because this means that we are
also prefetching the data of the company.
The prefetching is done in a way that it shouldn't prevent detecting
future "query leaks"

Part-of: odoo/odoo#110016
2023-02-17 19:30:39 +01:00
william-andre e41f2f720d [REF] account: merge repartition lines m2o field
Part-of: odoo/odoo#110016
2023-02-17 19:30:39 +01:00
william-andre a4527062cb [FIX] l10n_tr: make chart template visible
The field seems to have been ignored when merging templates in
1b0fdb8471

Part-of: odoo/odoo#110016
2023-02-17 19:30:38 +01:00
william-andre 2fefea1eb0 [FIX] l10n_be: do not search for account when it already exists
Moreover, it was searching for a template and not an account, not really
useful...

Part-of: odoo/odoo#110016
2023-02-17 19:30:38 +01:00
william-andre 2d6719cdd8 [FIX] l10n_ro: remove parents from account groups
The parents are computed automatically.
This configuration causes a recursion error, during the computation of
the parent path, if we delay the automation of the parents computation.

Part-of: odoo/odoo#110016
2023-02-17 19:30:38 +01:00
william-andre 98a40889ea [FIX] l10n_{dk,dz,id,ie}: add default tax group
Part-of: odoo/odoo#110016
2023-02-17 19:30:38 +01:00
william-andre b46d2cd609 [IMP] l10n_{dz,ma,ph}: add demo company
Part-of: odoo/odoo#110016
2023-02-17 19:30:37 +01:00
william-andre 88de6c41ee [MOV] l10n_in{,_tcs_tds}: merge modules
Part-of: odoo/odoo#110016
2023-02-17 19:30:37 +01:00
Merel Geens (mege) b2e421bff2 [FIX] sale_loyalty: round real points for coupon
`_get_real_points_for_coupon` subtracts several floats which can result
in rounding errors when a comparison is made in `action_confirm` that
checks if the result is smaller than 0. If the result is something like
-1 * 10^-14, Odoo will tell the user the coupon is invalid, which is
false. To prevent this from happening, we round according to the
associated currency of the points.

opw-3120442

closes odoo/odoo#112995

X-original-commit: 59c43f5cc460f311388540558e0fb0731b02cbc2
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-02-17 16:45:15 +01:00
Florent de LabarreandJohn Laterre 50cf4a75ce [FIX] account: prevent wrong hash result
In case of the user have no access to all account.move, the hash result can be wrong.

Before this PR a user with limited access can print this report.

closes odoo/odoo#112970

X-original-commit: 8263b210ea980539941ce10f5c102c9056959b72
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Co-authored-by: John Laterre (jol) <jol@odoo.com>
2023-02-17 14:09:54 +01:00
niyasraphy e6c77e54d9 [FIX] stock: allow cancelling picking with no move lines
before this commit, trying to cancel a picking with no move lines, will not move the picking to the cancel state.

* create a new picking
* keep move lines empty
* click on the cancel button
* picking will remain in the draft state

after this commit, on cancelling a picking with empty lines, will move the picking to the cancel state.

closes odoo/odoo#112784

X-original-commit: fefd9402142e9a1f28a2b04b8df96d8fb73d441d
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-02-17 14:09:51 +01:00
Anita (anko) e5c187ade8 [IMP] payment(_paypal): UX and payment flow improvements
UX was lacking comparing to other payment providers,
important fields were not always shown or were checkboxes
when they should be automatically true.

In order to make payment flow easier and more intitive, unnecessary fields
were removed, email is automatically filled. Now when user cancels transaction
on paypal before paying, it automatically cancels transaction on Odoo. Additionaly, quick
onboarding is only available if user already has paypal account and Stripe
no longer installs ond configures paypal if Stripe's onboarding get canceled.

task-2854184

closes odoo/odoo#104974

Related: odoo/upgrade#4025
Related: odoo/documentation#3063
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-02-17 14:09:43 +01:00
Julien Van Roy 5a5a00a352 [FIX] account_edi_ubl_cii: fix for NZ partners - GLN instead of vat
For the A-NZ UBL 1.0.8 format, when selecting NZ partners, the elements
in `/cac:Party/cbc:EndpointID` and
`/cac:Party/cac:PartyLegalEntity/cbc:CompanyID` should be the GLN: the
Global Location Number (the corresponding EAS is 0088). The GLN is the
`company_registry` for NZ partners.

Before this fix, the VAT was filled for both elements and it raised a
"GLN must have a valid format according to GS1 rules." error on Ecosio.

closes odoo/odoo#112983

X-original-commit: 2e2ff2813de8b5c1f272eb84319170e07d19154e
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Julien Van Roy <juvr@odoo.com>
2023-02-17 13:06:59 +01:00
Benoit Sociasandqsm-odoo 85c0f12c88 [FIX] web_editor: make empty we-select visible
When a `we-select` has no elements, it is drawn as a flat line.

This commit puts a "/" in its toggler content. This character is the
same one as the one that is displayed if the selected value is not one
of the available values.

Steps to reproduce:
- Delete all `website.snippet.filter`
- In debug mode, drop a "Dynamic Snippet" in a website page
- Select it
=> The "Filter" option was displayed as a flat line.

opw-3166634

closes odoo/odoo#112932

X-original-commit: dc6ff20386567abbabcb2d35388a3dc8995cab28
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-02-17 13:06:56 +01:00
Horacio Tellez 0f2de18849 [IMP] payment: only give access to tokens when required by the flow
Until this point the access to tokens was somehow arbitrary and
illogical.
After this commit we will uniformize the tokens access rule where by
default an user can only access its own tokens by default and in
function of the use case then relax the rules.

Task - 2832561

closes odoo/odoo#104808

Related: odoo/enterprise#33541
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-02-17 13:06:53 +01:00
Fernanda Hernández d75339f1d3 [FIX] payment_authorize: use name to send values when partner is a company
Currently, the name's fields to send to Authorize when the partner is a company are:

* firstName
* lastName

if we consider following name `Company Duck Inc`:

the code is sending:

* firstName: ''
* lastName: 'Duck'

Only it sends the `lastName` with the second word found in the name,
due to the new validations in Authorize.Net, this kind of transactions
are marked as suspicious and it's not confirming the transactions, leave them
as pending, this commit is sending the full name in `lastName`
instead of only second word to meet with the validation in Authorize.Net

Also, we are sending the fields `firstName` and  `lastName`, with the
maximum length allowed by Authorize.

closes odoo/odoo#112977

X-original-commit: 77d83b327fd99ed090194ec0d3a771c9afc47115
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-02-17 12:07:56 +01:00
Rémi Rahir (rar) 829329ab84 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/1b667256 [IMP] format: set decimal change on each cell of zone
https://github.com/odoo/o-spreadsheet/commit/f9766810 [FIX] Top_bar: topbar dropdown z-index
https://github.com/odoo/o-spreadsheet/commit/73819bd5 [IMP] Toolbar: make font size selector editable
https://github.com/odoo/o-spreadsheet/commit/db50da0d [FIX] scorecard: rendering issue while resizing
https://github.com/odoo/o-spreadsheet/commit/fdd0ca6c [FIX] topbar: colorPicker maximum height props
https://github.com/odoo/o-spreadsheet/commit/25fd9bbe [FIX] top_bar: auto selecting adjacent cells for filter
https://github.com/odoo/o-spreadsheet/commit/079bf8d5 [FIX] top_bar: respond menu upon scaling viewport
https://github.com/odoo/o-spreadsheet/commit/74b2b2eb [IMP] parser: improve parenthesis error messages
https://github.com/odoo/o-spreadsheet/commit/43dd7222 [REF] parser: rename unknown to empty AST node
https://github.com/odoo/o-spreadsheet/commit/b3895766 [REF] parse: remove binding power
https://github.com/odoo/o-spreadsheet/commit/42594be1 [FIX] bottom_bar_statistic: close context menu on change
https://github.com/odoo/o-spreadsheet/commit/ed572ee5 [FIX] chart: add dimensions to canvas
https://github.com/odoo/o-spreadsheet/commit/6609e980 [REF/IMP] tests: mount owl App in test mode and mount components in helper
https://github.com/odoo/o-spreadsheet/commit/80a0b53d [FIX] Edition: Reference loop should not alter sheetname of the reference
https://github.com/odoo/o-spreadsheet/commit/378af542 [FIX] FigureContainer: Do not update figure when not dragged

closes odoo/odoo#112972

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-02-17 12:07:53 +01:00
lejeune quentin ab57a7fef4 [FIX] hw_drivers: Certificate checked before start nginx
Currently we verify the SSL certificate of the iot after starting the nginx web server.

So for the Windows iot if a new certificate is downloaded it will only be loaded by nginx
on the next restart of the iot because the process that runs nginx is a child of the one that runs the iot

With this commit we restart the windows iot if a new certificate is uploaded

closes odoo/odoo#112945

X-original-commit: 880afb3006ece93ee6575c977233bfb61081bf3a
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2023-02-17 12:07:48 +01:00
Yaroslav Soroko (yaso) fc9eb4691e [IMP] Added helpers to download and unzip files
This commit adds "download_from_url" and "unzip_file" functions to
helpers.py
These allow to downloaad files and unzip them from Python and let us
remove the bash scripts we were previously using for the same purpose.
More specifically this allows the same code to be used on Linux and
Windows IoT to download and unzip files

closes odoo/odoo#112942

X-original-commit: 01aad66d5bde13ced704dfc5226f271da185887a
Related: odoo/enterprise#37205
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2023-02-17 12:07:45 +01:00
lejeune quentin ac839d337e [ADD] hw_*: Add python modules for using Samba
For the use of driver using the Samba share file we need the modules
PySmbClient==0.1.5
cryptocode==0.1

closes odoo/odoo#112940

X-original-commit: 38f8cf92c05ebea2714d513f1916ef581b0d9c73
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2023-02-17 12:07:39 +01:00
Alexandre Kühn 9ee7bdaec5 [FIX] im_livechat: translate livechat button text per user language
Before this commit, the livechat button text was not considering
the language of the user for translation. The translation must
not be loaded at field initialization, but when the value is
accessed e.g. from a livechat visitor.

closes odoo/odoo#112936

X-original-commit: 48dbf94068e09d831e4bf262b70b11adaade4b57
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-02-17 12:07:34 +01:00
Bruno Boi 30950f83b9 [IMP] web, mass_mailing: introduce useThrottleForAnimation hook
Before this commit
Many of the usages of the "throttleForAnimation" util did not
cancel the call to the throttled function when the using
component is unmounted.

After this commit
A "useThrottleForAnimation" hook:
- is introduced
- is tested (as of the prior "useDebounced" hook which was not)
- replace the "throttleForAnimation" usages.

closes odoo/odoo#112913

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-17 12:07:25 +01:00
Bruno Boi 2eaedb4b8d [REF] web: sort by ASC order core/utils/timing
Part-of: odoo/odoo#112913
2023-02-17 12:07:25 +01:00
Bruno Boi db4ec2ba2f [REM] web, web_editor: remove throttle function
This function is deprecated as its behaviour is closer to "debounce".
Furthermore, it is not covered by any tests.

Only one usage has been found in the code base:
- the VideoSelector component from web_editor

This usage has been replaced by the "debounce" timing utility,
which is appropriate considering what the code tries to do.

Part-of: odoo/odoo#112913
2023-02-17 12:07:25 +01:00
Odoo's Mergebot 9169ba9e4b [IMP] web: add "crop" overlay in barcode scanner
The commit restores a similar crop overlay like in the Odoo Android Mobile App for the Barcode scanner.

This feature helps to scan the right barcode when the user scans a barcode surrounded by other barcode, which before this commit a barcode was scanned but in some cases not the good one. The commit solves the problem by returning only the values into the rectangle overlay.

Also in this PR we upgrade:
* the lib to the latest version 0.19
* improve the code readability by splitting big files
* add some missing return values in the ZXing wrapper

closes odoo/odoo#112855

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-02-17 12:07:21 +01:00
Romeo Fragomeli dabd469c68 [REF] web: avoid async Promise
The executor function can also be an async function. However, this is
usually a mistake, for a few reasons:
* If an async executor function throws an error, the error will be lost
 and won’t cause the newly-constructed Promise to reject. This could
 make it difficult to debug and handle some errors.
* If a Promise executor function is using await, this is usually a sign
 that it is not actually necessary to use the new Promise constructor,
 or the scope of the new Promise constructor can be reduced.

Ref:
https://eslint.org/docs/latest/rules/no-async-promise-executor

Part-of: odoo/odoo#112855
2023-02-17 12:07:21 +01:00
Romeo Fragomeli 3693b9431b [IMP] web: add support for crop area for ZXingBarcodeDetector
As the lib ZXing barcode don't support scanning multiples barcodes at
once we have to find another way to match only the barcode into the
rectangle overlay.

Note:
Actually the barcode scanner have two ways to filter the barcode in the
rectangle overlay:
* native BarcodeDetector API -> we filter the barcode results by
 filtering the coordinate of the detected barcode (boundingBox)
* ZXing (lib) wrapper -> the lib scans only the cropped area from the
 source image (Camera)

Refs:
https://github.com/zxing-js/library/issues/346
https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector/detect#return_value

Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli f9fd098f18 [IMP] web: add "crop" overlay in barcode scanner
The commit restores a similar crop overlay like in the Odoo Android
Mobile App for the Barcode scanner.

This feature helps to scan the right barcode when the user scans a
barcode surrounded by other barcode, which before this commit a barcode
was scanned but in some cases not the good one. The commit solves the
problem by returning only the values into the rectangle overlay.

Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli 5d211327c1 [IMP] web: ZXingBarcodeDetector support corner points
Adds to the ZXingBarcodeDetector the missing data into the return values
of detect method.

Note: ZXingBarcodeDetector is a wrapper that implements the interface of
the native BarcodeDetector

> * boundingBox: A DOMRectReadOnly, which returns the dimensions of a
> rectangle representing the extent of a detected barcode, aligned with
> the image.
> * cornerPoints: The x and y co-ordinates of the four corner points of
> the detected barcode relative to the image, starting with the top left
> and working clockwise. This may not be square due to perspective
> distortions within the image.

Ref:
https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector

Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli 2cf9a8a479 [REF] web: extract ZXingBarcodeDetector into dedicated file
Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli 79a87e854c [IMP] web: upgrade ZXing.js to version v0.19.2
Part-of: odoo/odoo#112855
2023-02-17 12:07:19 +01:00
Rémy Voet (ryv) ba565758c6 [REM] core: remove deprecated methods of models.py
closes odoo/odoo#112817

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2023-02-17 12:07:14 +01:00
Rémy Voet (ryv) 5c413c43e2 [REM] core: remove deprecated method of sql_db.py
Part-of: odoo/odoo#112817
2023-02-17 12:07:14 +01:00
pedrambiria b855cbfbab [FIX] point_of_sale: reset NumberBuffer after scanning a barcode
Before this commit: if you scan a barcode to add a product and then
change its quantity, it will use previos `NumberBuffer` that have
been used before.

The solution is to reset the `NumberBuffer` after scanning a barcode.

opw-3170518

closes odoo/odoo#112765

X-original-commit: 1100b518f54c0b8cf29a312e768c1494635059a6
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-02-17 12:07:10 +01:00
Rémy Voet (ryv) 529a363519 [REM] core: remove useless return value from Field.write.
According to the method documentation, `Field.write` should return
the subset of record actually write.
But it is not respected at every return, it is not used at all and it generated extra completixy for nothing.

Then remove every return values.

closes odoo/odoo#111108

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-02-17 12:07:08 +01:00